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

Unified Diff: tests/WritePixelsTest.cpp

Issue 352573005: writepixels needs to bump genID (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/WritePixelsTest.cpp
diff --git a/tests/WritePixelsTest.cpp b/tests/WritePixelsTest.cpp
index 1a527937dec4c3e87c2ed13fb029490923bb02b8..70b91f227f24e48f13a767ac0ab7027e7af3a3e8 100644
--- a/tests/WritePixelsTest.cpp
+++ b/tests/WritePixelsTest.cpp
@@ -10,6 +10,7 @@
#include "SkColorPriv.h"
#include "SkMathPriv.h"
#include "SkRegion.h"
+#include "SkSurface.h"
#include "Test.h"
#include "sk_tool_utils.h"
@@ -351,7 +352,24 @@ static bool setupBitmap(SkBitmap* bm, SkColorType ct, SkAlphaType at, int w, int
return true;
}
+static void call_writepixels(SkCanvas* canvas) {
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1);
+ SkPMColor pixel = 0;
+ canvas->writePixels(info, &pixel, sizeof(SkPMColor), 0, 0);
+}
+
+static void test_surface_genid(skiatest::Reporter* reporter) {
+ const SkImageInfo info = SkImageInfo::MakeN32Premul(100, 100);
+ SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info));
+ uint32_t genID1 = surface->generationID();
+ call_writepixels(surface->getCanvas());
+ uint32_t genID2 = surface->generationID();
+ REPORTER_ASSERT(reporter, genID1 != genID2);
+}
+
DEF_GPUTEST(WritePixels, reporter, factory) {
+ test_surface_genid(reporter);
+
SkCanvas canvas;
const SkIRect testRects[] = {
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698