diff options
author | Robert Phillips <robertphillips@google.com> | 2016-12-13 09:01:40 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-13 17:57:13 +0000 |
commit | 4431de6af930a8638c194b072558ea3a4b79d908 (patch) | |
tree | 49a3f17bb0abc6fcb43d8c7ce58061e0bb9822a7 /tests/EGLImageTest.cpp | |
parent | 36aa176d0d32f9cea3d1998fac3c295d31e1d596 (diff) |
Add a deferred copy surface
This CL forces all GrSurface copies to go through a GrSurfaceContext (rather than GrContext).
There is a bit of goofiness going on here until read/writePixels is also consolidated in GrSurfaceContext and a proxy-backed SkImage/SkSurface is added.
Change-Id: Iab1867668d8146a766201158a251b9174438ee2b
Reviewed-on: https://skia-review.googlesource.com/5773
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'tests/EGLImageTest.cpp')
-rw-r--r-- | tests/EGLImageTest.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/tests/EGLImageTest.cpp b/tests/EGLImageTest.cpp index f78a0ea02a..0dcacf9b6b 100644 --- a/tests/EGLImageTest.cpp +++ b/tests/EGLImageTest.cpp @@ -10,6 +10,7 @@ #include "GrContext.h" #include "GrContextFactory.h" #include "GrShaderCaps.h" +#include "GrSurfaceContext.h" #include "gl/GrGLGpu.h" #include "gl/GrGLUtil.h" #include "gl/GLTestContext.h" @@ -40,7 +41,7 @@ static void cleanup(GLTestContext* glctx0, GrGLuint texID0, GLTestContext* glctx } static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, - GrTexture* externalTexture, uint32_t expectedPixelValues[]) { + GrSurface* externalTexture, uint32_t expectedPixelValues[]) { int pixelCnt = externalTexture->width() * externalTexture->height(); SkAutoTMalloc<uint32_t> pixels(pixelCnt); memset(pixels.get(), 0, sizeof(uint32_t)*pixelCnt); @@ -76,9 +77,13 @@ static void test_copy_surface(skiatest::Reporter* reporter, GrContext* context, copyDesc.fWidth = externalTexture->width(); copyDesc.fHeight = externalTexture->height(); copyDesc.fFlags = kRenderTarget_GrSurfaceFlag; - sk_sp<GrTexture> copy(context->textureProvider()->createTexture(copyDesc, SkBudgeted::kYes)); - context->copySurface(copy.get(), externalTexture); - test_read_pixels(reporter, context, copy.get(), expectedPixelValues); + + sk_sp<GrSurfaceProxy> copy(GrSurfaceProxy::TestCopy(context, copyDesc, + externalTexture, SkBudgeted::kYes)); + + GrSurface* copySurf = copy->instantiate(context->textureProvider()); + + test_read_pixels(reporter, context, copySurf, expectedPixelValues); } DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(EGLImageTest, reporter, ctxInfo) { |