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

Unified Diff: tests/PictureTest.cpp

Issue 154083004: SkPictureRecord: silently do nothing for non-drawable SkBitmaps. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: really, last rebase Created 6 years, 10 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 | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PictureTest.cpp
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 7665b13d7e42c30be4f1b010d7e61b602996f916..002fe8f441544ad22ab3fc269de4cbef0e2f9f99 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -1031,3 +1031,38 @@ DEF_TEST(Picture, reporter) {
test_clip_expansion(reporter);
test_hierarchical(reporter);
}
+
+static void draw_bitmaps(const SkBitmap bitmap, SkCanvas* canvas) {
+ const SkPaint paint;
+ const SkRect rect = { 5.0f, 5.0f, 8.0f, 8.0f };
+ const SkIRect irect = { 2, 2, 3, 3 };
+
+ // Don't care what these record, as long as they're legal.
+ canvas->drawBitmap(bitmap, 0.0f, 0.0f, &paint);
+ canvas->drawBitmapRectToRect(bitmap, &rect, rect, &paint, SkCanvas::kNone_DrawBitmapRectFlag);
+ canvas->drawBitmapMatrix(bitmap, SkMatrix::I(), &paint);
+ canvas->drawBitmapNine(bitmap, irect, rect, &paint);
+ canvas->drawSprite(bitmap, 1, 1);
+}
+
+static void test_draw_bitmaps(SkCanvas* canvas) {
+ SkBitmap empty;
+ draw_bitmaps(empty, canvas);
+ empty.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
+ draw_bitmaps(empty, canvas);
+}
+
+DEF_TEST(Picture_EmptyBitmap, r) {
+ SkPicture picture;
+ test_draw_bitmaps(picture.beginRecording(10, 10));
+ picture.endRecording();
+}
+
+DEF_TEST(Canvas_EmptyBitmap, r) {
+ SkBitmap dst;
+ dst.setConfig(SkBitmap::kARGB_8888_Config, 10, 10);
+ dst.allocPixels();
+ SkCanvas canvas(dst);
+
+ test_draw_bitmaps(&canvas);
+}
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698