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(copyD
esc, true)); | 76 SkAutoTUnref<GrTexture> copy(context->textureProvider()->createTexture( |
| 77 copyDesc, SkBudgeted::kYes)); |
77 context->copySurface(copy, externalTexture); | 78 context->copySurface(copy, externalTexture); |
78 test_read_pixels(reporter, context, copy, expectedPixelValues); | 79 test_read_pixels(reporter, context, copy, expectedPixelValues); |
79 } | 80 } |
80 | 81 |
81 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EGLImageTest, reporter, context0, glCtx0) { | 82 DEF_GPUTEST_FOR_RENDERING_CONTEXTS(EGLImageTest, reporter, context0, glCtx0) { |
82 // Try to create a second GL context and then check if the contexts have nec
essary | 83 // Try to create a second GL context and then check if the contexts have nec
essary |
83 // extensions to run this test. | 84 // extensions to run this test. |
84 | 85 |
85 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { | 86 if (kGLES_GrGLStandard != glCtx0->gl()->fStandard) { |
86 return; | 87 return; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); | 197 test_read_pixels(reporter, context0, externalTextureObj, pixels.get()); |
197 | 198 |
198 test_write_pixels(reporter, context0, externalTextureObj); | 199 test_write_pixels(reporter, context0, externalTextureObj); |
199 | 200 |
200 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); | 201 test_copy_surface(reporter, context0, externalTextureObj, pixels.get()); |
201 | 202 |
202 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); | 203 cleanup(glCtx0, externalTexture.fID, glCtx1, context1, backendTexture1, imag
e); |
203 } | 204 } |
204 | 205 |
205 #endif | 206 #endif |
OLD | NEW |