Bitmaps: use original size for caching

Fixes https://gitlab.com/kicad/code/kicad/-/issues/13486
This commit is contained in:
Jon Evans 2023-01-11 21:15:07 -05:00
parent 253122dc78
commit 05b578a9bb
1 changed files with 4 additions and 4 deletions

View File

@ -159,8 +159,10 @@ GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
{
CACHED_BITMAP bmp;
bmp.w = aBitmap->GetSizePixels().x;
bmp.h = aBitmap->GetSizePixels().y;
const wxImage& imgData = *aBitmap->GetOriginalImageData();
bmp.w = imgData.GetSize().x;
bmp.h = imgData.GetSize().y;
// The bitmap size needs to be a multiple of 4.
// This is easiest to achieve by ensuring that each row
@ -186,8 +188,6 @@ GLuint GL_BITMAP_CACHE::cacheBitmap( const BITMAP_BASE* aBitmap )
bmp.size = ( bmp.w + extra_w ) * bmp.h * 4;
auto buf = std::make_unique<uint8_t[]>( bmp.size );
const wxImage& imgData = *aBitmap->GetOriginalImageData();
for( int y = 0; y < bmp.h; y++ )
{
for( int x = 0; x < bmp.w; x++ )