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

Unified Diff: tests/SurfaceTest.cpp

Issue 13226002: Fixed bug with SkImage leaving canvas backing store in an immutable state after destroy. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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
« src/image/SkImage_Raster.cpp ('K') | « src/image/SkImage_Raster.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SurfaceTest.cpp
===================================================================
--- tests/SurfaceTest.cpp (revision 8437)
+++ tests/SurfaceTest.cpp (working copy)
@@ -133,15 +133,32 @@
testPaint))
}
+static void TestSurfaceWritableAfterSnapshotRelease(skiatest::Reporter* reporter,
+ SurfaceType surfaceType,
+ GrContext* context) {
+ // This test succeeds by not triggering an assertion.
+ // The test verifies that the surface remains writable (usable) after
+ // acquiring and releasing a snapshot without triggering a copy on write.
+ SkSurface* surface = createSurface(surfaceType, context);
+ SkAutoTUnref<SkSurface> aur_surface(surface);
+ SkCanvas* canvas = surface->getCanvas();
+ canvas->clear(1);
+ surface->newImageShapshot()->unref(); // Create and destroy SkImage
+ canvas->clear(2);
+}
+
static void TestSurface(skiatest::Reporter* reporter) {
bsalomon 2013/04/03 14:13:43 Just noting that TestSurface and TestSurfaceGpu co
TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
TestSurfaceCopyOnWrite(reporter, kPicture_SurfaceType, NULL);
+ TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL);
+ TestSurfaceWritableAfterSnapshotRelease(reporter, kPicture_SurfaceType, NULL);
}
static void TestSurfaceGpu(skiatest::Reporter* reporter, GrContextFactory* factory) {
#if SK_SUPPORT_GPU
GrContext* context = factory->get(GrContextFactory::kNative_GLContextType);
TestSurfaceCopyOnWrite(reporter, kGpu_SurfaceType, context);
+ TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, context);
#endif
}
« src/image/SkImage_Raster.cpp ('K') | « src/image/SkImage_Raster.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698