Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1038)

Unified Diff: tests/BitmapCopyTest.cpp

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/ARGBImageEncoderTest.cpp ('k') | tests/BitmapHasherTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapCopyTest.cpp
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index 4a49a6b487b1030b53bf56fd1f5a6ca0e5d6b1e1..6a20668cf6158566f16f32018a514d28d395f0db 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -387,14 +387,16 @@ DEF_TEST(BitmapCopy, reporter) {
ct = init_ctable(kPremul_SkAlphaType);
}
+ int localSubW;
if (isExtracted[copyCase]) { // A larger image to extract from.
- src.allocPixels(SkImageInfo::Make(2 * subW + 1, subH,
- gPairs[i].fColorType,
- kPremul_SkAlphaType));
+ localSubW = 2 * subW + 1;
} else { // Tests expect a 2x2 bitmap, so make smaller.
- src.allocPixels(SkImageInfo::Make(subW, subH,
- gPairs[i].fColorType,
- kPremul_SkAlphaType));
+ localSubW = subW;
+ }
+ // could fail if we pass kIndex_8 for the colortype
+ if (src.tryAllocPixels(SkImageInfo::Make(localSubW, subH, gPairs[i].fColorType,
+ kPremul_SkAlphaType))) {
+ // failure is fine, as we will notice later on
}
SkSafeUnref(ct);
« no previous file with comments | « tests/ARGBImageEncoderTest.cpp ('k') | tests/BitmapHasherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698