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

Unified Diff: tests/ImageTest.cpp

Issue 1446453003: Generate list of GPU contexts outside SurfaceTest tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: msvc fixes Created 5 years, 1 month 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/gpu/GrContextFactory.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageTest.cpp
diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp
index d139ca7075101e524b9f6979c290f8e432bed110..7bce8e5a5d2425ee421727297b3406487a7c6129 100644
--- a/tests/ImageTest.cpp
+++ b/tests/ImageTest.cpp
@@ -415,60 +415,6 @@ struct ReleaseDataContext {
}
};
-// May we (soon) eliminate the need to keep testing this, by hiding the bloody device!
-#include "SkDevice.h"
-static uint32_t get_legacy_gen_id(SkSurface* surf) {
- SkBaseDevice* device = surf->getCanvas()->getDevice_just_for_deprecated_compatibility_testing();
- return device->accessBitmap(false).getGenerationID();
-}
-
-/*
- * Test legacy behavor of bumping the surface's device's bitmap's genID when we access its
- * texture handle for writing.
- *
- * Note: this needs to be tested separately from checking newImageSnapshot, as calling that
- * can also incidentally bump the genID (when a new backing surface is created).
- */
-template <class F>
-static void test_texture_handle_genID(skiatest::Reporter* reporter, SkSurface* surf, F f) {
- const uint32_t gen0 = get_legacy_gen_id(surf);
- f(surf, SkSurface::kFlushRead_BackendHandleAccess);
- const uint32_t gen1 = get_legacy_gen_id(surf);
- REPORTER_ASSERT(reporter, gen0 == gen1);
-
- f(surf, SkSurface::kFlushWrite_BackendHandleAccess);
- const uint32_t gen2 = get_legacy_gen_id(surf);
- REPORTER_ASSERT(reporter, gen0 != gen2);
-
- f(surf, SkSurface::kDiscardWrite_BackendHandleAccess);
- const uint32_t gen3 = get_legacy_gen_id(surf);
- REPORTER_ASSERT(reporter, gen0 != gen3);
- REPORTER_ASSERT(reporter, gen2 != gen3);
-}
-
-template <class F>
-static void test_backend_handle(skiatest::Reporter* reporter, SkSurface* surf, F f) {
- SkAutoTUnref<SkImage> image0(surf->newImageSnapshot());
- GrBackendObject obj = f(surf, SkSurface::kFlushRead_BackendHandleAccess);
- REPORTER_ASSERT(reporter, obj != 0);
- SkAutoTUnref<SkImage> image1(surf->newImageSnapshot());
- // just read access should not affect the snapshot
- REPORTER_ASSERT(reporter, image0->uniqueID() == image1->uniqueID());
-
- obj = f(surf, SkSurface::kFlushWrite_BackendHandleAccess);
- REPORTER_ASSERT(reporter, obj != 0);
- SkAutoTUnref<SkImage> image2(surf->newImageSnapshot());
- // expect a new image, since we claimed we would write
- REPORTER_ASSERT(reporter, image0->uniqueID() != image2->uniqueID());
-
- obj = f(surf, SkSurface::kDiscardWrite_BackendHandleAccess);
- REPORTER_ASSERT(reporter, obj != 0);
- SkAutoTUnref<SkImage> image3(surf->newImageSnapshot());
- // expect a new(er) image, since we claimed we would write
- REPORTER_ASSERT(reporter, image0->uniqueID() != image3->uniqueID());
- REPORTER_ASSERT(reporter, image2->uniqueID() != image3->uniqueID());
-}
-
static SkImage* create_image(skiatest::Reporter* reporter,
ImageType imageType, GrContext* context, SkColor color,
ReleaseDataContext* releaseContext) {
@@ -495,22 +441,6 @@ static SkImage* create_image(skiatest::Reporter* reporter,
SkAutoTUnref<SkSurface> surf(
SkSurface::NewRenderTarget(context, SkSurface::kNo_Budgeted, info, 0));
surf->getCanvas()->clear(color);
- // test our backing texture / rendertarget while were here...
- auto textureAccessorFunc =
- [](SkSurface* surf, SkSurface::BackendHandleAccess access) -> GrBackendObject {
- return surf->getTextureHandle(access); };
- auto renderTargetAccessorFunc =
- [](SkSurface* surf, SkSurface::BackendHandleAccess access) -> GrBackendObject {
- GrBackendObject obj;
- SkAssertResult(surf->getRenderTargetHandle(&obj, access));
- return obj; };
- test_backend_handle(reporter, surf, textureAccessorFunc);
- test_backend_handle(reporter, surf, renderTargetAccessorFunc);
- test_texture_handle_genID(reporter, surf, textureAccessorFunc);
- test_texture_handle_genID(reporter, surf, renderTargetAccessorFunc);
-
- // redraw so our returned image looks as expected.
- surf->getCanvas()->clear(color);
return surf->newImageSnapshot();
}
case kCodec_ImageType: {
« no previous file with comments | « src/gpu/GrContextFactory.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698