Correct rowBytes on SkBitmap to match recycled bitmap sooner

This will prevent us from triggering asserts when we
call lockPixels().

skbug.com/4538

Change-Id: Ibcd18818e33ccbacdcdfa57e822b04dd91b6af17
This commit is contained in:
Matt Sarett
2016-05-19 09:23:41 -04:00
parent 5210974cf5
commit db4773f0df

View File

@@ -717,7 +717,10 @@ bool RecyclingClippingPixelAllocator::allocPixelRef(SkBitmap* bitmap, SkColorTab
// the SkImageInfo.
mRecycledBitmap->reconfigure(mRecycledBitmap->info(), rowBytes, ctable);
// This call will give the bitmap the same pixelRef as mRecycledBitmap.
// Give the bitmap the same pixelRef as mRecycledBitmap.
// skbug.com/4538: We also need to make sure that the rowBytes on the pixel ref
// match the rowBytes on the bitmap.
bitmap->setInfo(bitmap->info(), rowBytes);
bitmap->setPixelRef(mRecycledBitmap->refPixelRef())->unref();
// Make sure that the recycled bitmap has the correct alpha type.