Modify SkBitmap::extractSubset() to respect volatility
The resulting subset bitmap will always have the same volatility flag as the
source bitmap.
BUG=452
Review URL: http://codereview.appspot.com/5544052
git-svn-id: http://skia.googlecode.com/svn/trunk@3039 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index c3c6f12..a89064b 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -313,11 +313,14 @@
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 @@
(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 {