OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 #if SK_SUPPORT_GPU | 9 #if SK_SUPPORT_GPU |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 " texture."); | 66 " texture."); |
67 } | 67 } |
68 | 68 |
69 static void test_copy_surface(skiatest::Reporter* reporter, GrContext* context, | 69 static void test_copy_surface(skiatest::Reporter* reporter, GrContext* context, |
70 GrTexture* externalTexture, uint32_t expectedPixel
Values[]) { | 70 GrTexture* externalTexture, uint32_t expectedPixel
Values[]) { |
71 GrSurfaceDesc copyDesc; | 71 GrSurfaceDesc copyDesc; |
72 copyDesc.fConfig = kRGBA_8888_GrPixelConfig; | 72 copyDesc.fConfig = kRGBA_8888_GrPixelConfig; |
73 copyDesc.fWidth = externalTexture->width(); | 73 copyDesc.fWidth = externalTexture->width(); |
74 copyDesc.fHeight = externalTexture->height(); | 74 copyDesc.fHeight = externalTexture->height(); |
75 copyDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 75 copyDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
76 SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture( | 76 SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture(copyD
esc, true)); |
77 copyDesc, SkBudgeted::kYes)); | |
78 context->copySurface(copy, externalTexture); | 77 context->copySurface(copy, externalTexture); |
79 test_read_pixels(reporter, context, copy, expectedPixelValues); | 78 test_read_pixels(reporter, context, copy, expectedPixelValues); |
80 } | 79 } |
81 | 80 |
82 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EGLImageTest, reporter, context0, glCtx0) { | 81 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EGLImageTest, reporter, context0, glCtx0) { |
83 // Try to create a second GL context and then check if the contexts have nec
essary | 82 // Try to create a second GL context and then check if the contexts have nec
essary |
84 // extensions to run this test. | 83 // extensions to run this test. |
85 | 84 |
86 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { | 85 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { |
87 return; | 86 return; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); | 196 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); |
198 | 197 |
199 test_write_pixels(reporter, context0, externalTextureObj); | 198 test_write_pixels(reporter, context0, externalTextureObj); |
200 | 199 |
201 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); | 200 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); |
202 | 201 |
203 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); | 202 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); |
204 } | 203 } |
205 | 204 |
206 #endif | 205 #endif |
OLD | NEW |