No changes, just get rid of unnecessary variables in wxCairoBitmapData.
Don't use bw and bh when we have perfectly appropriate m_width and m_height. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@69362 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1276,23 +1276,22 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
|
|||||||
|
|
||||||
int stride = InitBuffer(bmp.GetWidth(), bmp.GetHeight(), bufferFormat);
|
int stride = InitBuffer(bmp.GetWidth(), bmp.GetHeight(), bufferFormat);
|
||||||
|
|
||||||
int bw = m_width;
|
|
||||||
int bh = m_height;
|
|
||||||
wxBitmap bmpSource = bmp; // we need a non-const instance
|
wxBitmap bmpSource = bmp; // we need a non-const instance
|
||||||
wxUint32* data = (wxUint32*)m_buffer;
|
wxUint32* data = (wxUint32*)m_buffer;
|
||||||
|
|
||||||
if ( bufferFormat == CAIRO_FORMAT_ARGB32 )
|
if ( bufferFormat == CAIRO_FORMAT_ARGB32 )
|
||||||
{
|
{
|
||||||
// use the bitmap's alpha
|
// use the bitmap's alpha
|
||||||
wxAlphaPixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh));
|
wxAlphaPixelData
|
||||||
|
pixData(bmpSource, wxPoint(0, 0), wxSize(m_width, m_height));
|
||||||
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
|
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
|
||||||
|
|
||||||
wxAlphaPixelData::Iterator p(pixData);
|
wxAlphaPixelData::Iterator p(pixData);
|
||||||
for (int y=0; y<bh; y++)
|
for (int y=0; y<m_height; y++)
|
||||||
{
|
{
|
||||||
wxAlphaPixelData::Iterator rowStart = p;
|
wxAlphaPixelData::Iterator rowStart = p;
|
||||||
wxUint32* const rowStartDst = data;
|
wxUint32* const rowStartDst = data;
|
||||||
for (int x=0; x<bw; x++)
|
for (int x=0; x<m_width; x++)
|
||||||
{
|
{
|
||||||
// Each pixel in CAIRO_FORMAT_ARGB32 is a 32-bit quantity,
|
// Each pixel in CAIRO_FORMAT_ARGB32 is a 32-bit quantity,
|
||||||
// with alpha in the upper 8 bits, then red, then green, then
|
// with alpha in the upper 8 bits, then red, then green, then
|
||||||
@@ -1317,15 +1316,16 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
|
|||||||
}
|
}
|
||||||
else // no alpha
|
else // no alpha
|
||||||
{
|
{
|
||||||
wxNativePixelData pixData(bmpSource, wxPoint(0,0), wxSize(bw, bh));
|
wxNativePixelData
|
||||||
|
pixData(bmpSource, wxPoint(0, 0), wxSize(m_width, m_height));
|
||||||
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
|
wxCHECK_RET( pixData, wxT("Failed to gain raw access to bitmap data."));
|
||||||
|
|
||||||
wxNativePixelData::Iterator p(pixData);
|
wxNativePixelData::Iterator p(pixData);
|
||||||
for (int y=0; y<bh; y++)
|
for (int y=0; y<m_height; y++)
|
||||||
{
|
{
|
||||||
wxNativePixelData::Iterator rowStart = p;
|
wxNativePixelData::Iterator rowStart = p;
|
||||||
wxUint32* const rowStartDst = data;
|
wxUint32* const rowStartDst = data;
|
||||||
for (int x=0; x<bw; x++)
|
for (int x=0; x<m_width; x++)
|
||||||
{
|
{
|
||||||
// Each pixel in CAIRO_FORMAT_RGB24 is a 32-bit quantity, with
|
// Each pixel in CAIRO_FORMAT_RGB24 is a 32-bit quantity, with
|
||||||
// the upper 8 bits unused. Red, Green, and Blue are stored in
|
// the upper 8 bits unused. Red, Green, and Blue are stored in
|
||||||
@@ -1349,15 +1349,16 @@ wxCairoBitmapData::wxCairoBitmapData( wxGraphicsRenderer* renderer, const wxBitm
|
|||||||
wxBitmap bmpMask = bmpSource.GetMaskBitmap();
|
wxBitmap bmpMask = bmpSource.GetMaskBitmap();
|
||||||
bufferFormat = CAIRO_FORMAT_ARGB32;
|
bufferFormat = CAIRO_FORMAT_ARGB32;
|
||||||
data = (wxUint32*)m_buffer;
|
data = (wxUint32*)m_buffer;
|
||||||
wxNativePixelData pixData(bmpMask, wxPoint(0,0), wxSize(bw, bh));
|
wxNativePixelData
|
||||||
wxCHECK_RET( pixData, wxT("Failed to gain raw access to mask bitmap data."));
|
pixData(bmpMask, wxPoint(0, 0), wxSize(m_width, m_height));
|
||||||
|
wxCHECK_RET( pixData, wxT("Failed to gain raw access to mask data."));
|
||||||
|
|
||||||
wxNativePixelData::Iterator p(pixData);
|
wxNativePixelData::Iterator p(pixData);
|
||||||
for (int y=0; y<bh; y++)
|
for (int y=0; y<m_height; y++)
|
||||||
{
|
{
|
||||||
wxNativePixelData::Iterator rowStart = p;
|
wxNativePixelData::Iterator rowStart = p;
|
||||||
wxUint32* const rowStartDst = data;
|
wxUint32* const rowStartDst = data;
|
||||||
for (int x=0; x<bw; x++)
|
for (int x=0; x<m_width; x++)
|
||||||
{
|
{
|
||||||
if (p.Red()+p.Green()+p.Blue() == 0)
|
if (p.Red()+p.Green()+p.Blue() == 0)
|
||||||
*data = 0;
|
*data = 0;
|
||||||
|
Reference in New Issue
Block a user