diff options
-rw-r--r-- | src/core/SkBitmap.cpp | 1 | ||||
-rw-r--r-- | tests/BitmapCopyTest.cpp | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/src/core/SkBitmap.cpp b/src/core/SkBitmap.cpp index fe32845d37..9a21320620 100644 --- a/src/core/SkBitmap.cpp +++ b/src/core/SkBitmap.cpp @@ -822,6 +822,7 @@ bool SkBitmap::extractSubset(SkBitmap* result, const SkIRect& subset) const { SkBitmap dst; dst.setConfig(this->config(), r.width(), r.height(), this->rowBytes()); dst.setIsOpaque(this->isOpaque()); + dst.setIsVolatile(this->isVolatile()); if (fPixelRef) { // share the pixelref with a custom offset diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp index c3c6f126b0..a89064b62f 100644 --- a/tests/BitmapCopyTest.cpp +++ b/tests/BitmapCopyTest.cpp @@ -313,11 +313,14 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) { SkIRect r; r.set(1, 1, 2, 2); bitmap.setIsOpaque(true); + bitmap.setIsVolatile(true); if (bitmap.extractSubset(&subset, r)) { REPORTER_ASSERT(reporter, subset.width() == 1); REPORTER_ASSERT(reporter, subset.height() == 1); REPORTER_ASSERT(reporter, subset.isOpaque() == bitmap.isOpaque()); + REPORTER_ASSERT(reporter, + subset.isVolatile() == true); SkBitmap copy; REPORTER_ASSERT(reporter, @@ -334,9 +337,12 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) { (copy.getColorTable() != NULL) == hasCT); } bitmap.setIsOpaque(false); + bitmap.setIsVolatile(false); if (bitmap.extractSubset(&subset, r)) { REPORTER_ASSERT(reporter, subset.isOpaque() == bitmap.isOpaque()); + REPORTER_ASSERT(reporter, + subset.isVolatile() == false); } } } else { |