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

Unified Diff: tests/SurfaceTest.cpp

Issue 933043006: Implement SkBaseDevice snapshot support Base URL: https://skia.googlesource.com/skia.git@skimage-filters-04-snapshot-devices
Patch Set: Created 5 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 | « tests/DeferredCanvasTest.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
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index 6142af9ed12649e02af442bd00189ed4b45f0903..80dfaccfe682f4bcfbdc0f1c9448cd376a31761b 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -449,7 +449,7 @@ static void TestGetTexture(skiatest::Reporter* reporter,
} else {
REPORTER_ASSERT(reporter, NULL == texture);
}
- surface->notifyContentWillChange(SkSurface::kDiscard_ContentChangeMode);
+ surface->getCanvas()->discard();
REPORTER_ASSERT(reporter, image->getTexture() == texture);
}
@@ -459,8 +459,8 @@ static void TestGetTexture(skiatest::Reporter* reporter,
#include "SkSurface_Gpu.h"
SkSurface::Budgeted is_budgeted(SkSurface* surf) {
- return ((SkSurface_Gpu*)surf)->getDevice()->accessRenderTarget()->resourcePriv().isBudgeted() ?
- SkSurface::kYes_Budgeted : SkSurface::kNo_Budgeted;
+ return static_cast<SkSurface_Gpu*>(surf)->isBackendBudgeted() ? SkSurface::kYes_Budgeted
+ : SkSurface::kNo_Budgeted;
}
SkSurface::Budgeted is_budgeted(SkImage* image) {
@@ -500,16 +500,14 @@ static void test_surface_budget(skiatest::Reporter* reporter, GrContext* context
#endif
static void TestSurfaceNoCanvas(skiatest::Reporter* reporter,
- SurfaceType surfaceType,
- GrContext* context,
- SkSurface::ContentChangeMode mode) {
+ SurfaceType surfaceType,
+ GrContext* context) {
// Verifies the robustness of SkSurface for handling use cases where calls
// are made before a canvas is created.
{
// Test passes by not asserting
SkSurface* surface = createSurface(surfaceType, context);
SkAutoTUnref<SkSurface> aur_surface(surface);
- surface->notifyContentWillChange(mode);
SkDEBUGCODE(surface->validate();)
}
{
@@ -519,16 +517,12 @@ static void TestSurfaceNoCanvas(skiatest::Reporter* reporter,
SkAutoTUnref<SkImage> aur_image1(image1);
SkDEBUGCODE(image1->validate();)
SkDEBUGCODE(surface->validate();)
- surface->notifyContentWillChange(mode);
- SkDEBUGCODE(image1->validate();)
- SkDEBUGCODE(surface->validate();)
SkImage* image2 = surface->newImageSnapshot();
SkAutoTUnref<SkImage> aur_image2(image2);
SkDEBUGCODE(image2->validate();)
SkDEBUGCODE(surface->validate();)
- REPORTER_ASSERT(reporter, image1 != image2);
+ REPORTER_ASSERT(reporter, image1 == image2);
}
-
}
DEF_GPUTEST(Surface, reporter, factory) {
@@ -536,8 +530,7 @@ DEF_GPUTEST(Surface, reporter, factory) {
TestSurfaceCopyOnWrite(reporter, kRaster_SurfaceType, NULL);
TestSurfaceWritableAfterSnapshotRelease(reporter, kRaster_SurfaceType, NULL);
- TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kDiscard_ContentChangeMode);
- TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL, SkSurface::kRetain_ContentChangeMode);
+ TestSurfaceNoCanvas(reporter, kRaster_SurfaceType, NULL);
test_empty_image(reporter);
test_empty_surface(reporter, NULL);
@@ -561,10 +554,8 @@ DEF_GPUTEST(Surface, reporter, factory) {
TestSurfaceCopyOnWrite(reporter, kGpuScratch_SurfaceType, context);
TestSurfaceWritableAfterSnapshotRelease(reporter, kGpu_SurfaceType, context);
TestSurfaceWritableAfterSnapshotRelease(reporter, kGpuScratch_SurfaceType, context);
- TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kDiscard_ContentChangeMode);
- TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kDiscard_ContentChangeMode);
- TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context, SkSurface::kRetain_ContentChangeMode);
- TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context, SkSurface::kRetain_ContentChangeMode);
+ TestSurfaceNoCanvas(reporter, kGpu_SurfaceType, context);
+ TestSurfaceNoCanvas(reporter, kGpuScratch_SurfaceType, context);
TestGetTexture(reporter, kGpu_SurfaceType, context);
TestGetTexture(reporter, kGpuScratch_SurfaceType, context);
test_empty_surface(reporter, context);
« no previous file with comments | « tests/DeferredCanvasTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698