From db4773f0df43da92ef5878e5c845552e251b3790 Mon Sep 17 00:00:00 2001 From: Matt Sarett Date: Thu, 19 May 2016 09:23:41 -0400 Subject: [PATCH] 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 --- core/jni/android/graphics/Graphics.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/jni/android/graphics/Graphics.cpp b/core/jni/android/graphics/Graphics.cpp index 528541dadfb89..b5630d54b2ea7 100644 --- a/core/jni/android/graphics/Graphics.cpp +++ b/core/jni/android/graphics/Graphics.cpp @@ -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.