mirror of
https://github.com/aseprite/aseprite.git
synced 2025-03-03 07:13:45 +00:00
Fix random pixels from memory in SkiaSurface::create/createRgba/applyScale()
This commit is contained in:
parent
def9e7242a
commit
b44c4f8b7b
@ -37,6 +37,7 @@ public:
|
||||
void create(int width, int height) {
|
||||
m_bitmap.tryAllocPixels(
|
||||
SkImageInfo::MakeN32Premul(width, height));
|
||||
m_bitmap.eraseColor(SK_ColorTRANSPARENT);
|
||||
|
||||
rebuild();
|
||||
}
|
||||
@ -44,6 +45,7 @@ public:
|
||||
void createRgba(int width, int height) {
|
||||
m_bitmap.tryAllocPixels(
|
||||
SkImageInfo::MakeN32Premul(width, height));
|
||||
m_bitmap.eraseColor(SK_ColorTRANSPARENT);
|
||||
|
||||
rebuild();
|
||||
}
|
||||
@ -95,10 +97,13 @@ public:
|
||||
result.tryAllocPixels(
|
||||
SkImageInfo::MakeN32Premul(width()*scaleFactor, height()*scaleFactor));
|
||||
|
||||
SkPaint paint;
|
||||
paint.setXfermodeMode(SkXfermode::kSrc_Mode);
|
||||
|
||||
SkCanvas canvas(result);
|
||||
SkRect srcRect = SkRect::Make(SkIRect::MakeXYWH(0, 0, m_bitmap.width(), m_bitmap.height()));
|
||||
SkRect dstRect = SkRect::Make(SkIRect::MakeXYWH(0, 0, result.width(), result.height()));
|
||||
canvas.drawBitmapRectToRect(m_bitmap, &srcRect, dstRect);
|
||||
canvas.drawBitmapRectToRect(m_bitmap, &srcRect, dstRect, &paint);
|
||||
|
||||
swapBitmap(result);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user