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

Unified Diff: tests/SerializationTest.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/ReadPixelsTest.cpp ('k') | tests/SkResourceCacheTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SerializationTest.cpp
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 4e11f120db7a984902050c89e303a35212bdf151..450f94f47ec55006a06ba64f86ecc8d7369e23e4 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -335,14 +335,12 @@ static void TestPictureTypefaceSerialization(skiatest::Reporter* reporter) {
compare_bitmaps(reporter, origBitmap, destBitmap);
}
-static bool setup_bitmap_for_canvas(SkBitmap* bitmap) {
- SkImageInfo info = SkImageInfo::Make(
- kBitmapSize, kBitmapSize, kN32_SkColorType, kPremul_SkAlphaType);
- return bitmap->allocPixels(info);
+static void setup_bitmap_for_canvas(SkBitmap* bitmap) {
+ bitmap->allocN32Pixels(kBitmapSize, kBitmapSize);
}
-static bool make_checkerboard_bitmap(SkBitmap& bitmap) {
- bool success = setup_bitmap_for_canvas(&bitmap);
+static void make_checkerboard_bitmap(SkBitmap& bitmap) {
+ setup_bitmap_for_canvas(&bitmap);
SkCanvas canvas(bitmap);
canvas.clear(0x00000000);
@@ -363,14 +361,12 @@ static bool make_checkerboard_bitmap(SkBitmap& bitmap) {
canvas.restore();
}
}
-
- return success;
}
-static bool draw_something(SkCanvas* canvas) {
+static void draw_something(SkCanvas* canvas) {
SkPaint paint;
SkBitmap bitmap;
- bool success = make_checkerboard_bitmap(bitmap);
+ make_checkerboard_bitmap(bitmap);
canvas->save();
canvas->scale(0.5f, 0.5f);
@@ -389,8 +385,6 @@ static bool draw_something(SkCanvas* canvas) {
paint.setColor(SK_ColorBLACK);
paint.setTextSize(SkIntToScalar(kBitmapSize/3));
canvas->drawText("Picture", 7, SkIntToScalar(kBitmapSize/2), SkIntToScalar(kBitmapSize/4), paint);
-
- return success;
}
DEF_TEST(Serialization, reporter) {
@@ -481,10 +475,9 @@ DEF_TEST(Serialization, reporter) {
// Test simple SkPicture serialization
{
SkPictureRecorder recorder;
- bool didDraw = draw_something(recorder.beginRecording(SkIntToScalar(kBitmapSize),
- SkIntToScalar(kBitmapSize),
- NULL, 0));
- REPORTER_ASSERT(reporter, didDraw);
+ draw_something(recorder.beginRecording(SkIntToScalar(kBitmapSize),
+ SkIntToScalar(kBitmapSize),
+ NULL, 0));
SkAutoTUnref<SkPicture> pict(recorder.endRecording());
// Serialize picture
« no previous file with comments | « tests/ReadPixelsTest.cpp ('k') | tests/SkResourceCacheTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698