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

Unified Diff: gm/stroketext.cpp

Issue 196223013: check for null-device pixels in onWritePixels, so we don't crash (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 | « no previous file | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/stroketext.cpp
diff --git a/gm/stroketext.cpp b/gm/stroketext.cpp
index 1791fea528ca3f4a1bf4cf3c7e1f4f6fd134f793..b9d56f10e470b167e9df738e3d3a671209a0d073 100644
--- a/gm/stroketext.cpp
+++ b/gm/stroketext.cpp
@@ -8,6 +8,21 @@
#include "gm.h"
#include "SkCanvas.h"
+static void test_nulldev(SkCanvas* canvas) {
bsalomon 2014/03/14 14:03:45 should this be in a unit test?
+ SkBitmap bm;
+ bm.setConfig(SkBitmap::kARGB_8888_Config, 30, 30);
+ // notice: no pixels mom! be sure we don't crash
+ // https://code.google.com/p/chromium/issues/detail?id=352616
+ SkCanvas c(bm);
+
+ SkBitmap src;
+ src.allocN32Pixels(10, 10);
+ src.eraseColor(SK_ColorRED);
+
+ // ensure we don't crash
+ c.writePixels(src, 0, 0);
+}
+
static void draw_text_stroked(SkCanvas* canvas, const SkPaint& paint) {
SkPaint p(paint);
SkPoint loc = { 20, 450 };
@@ -44,6 +59,7 @@ protected:
}
virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
+ if (true) { test_nulldev(canvas); }
SkPaint paint;
paint.setAntiAlias(true);
« no previous file with comments | « no previous file | src/core/SkBitmapDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698