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" |
11 #include "GrDrawContext.h" | 11 #include "GrDrawContext.h" |
12 #include "gl/GrGLGpu.h" | 12 #include "gl/GrGLGpu.h" |
13 #include "gl/GrGLUtil.h" | 13 #include "gl/GrGLUtil.h" |
14 #include "gl/GLTestContext.h" | 14 #include "gl/GLContext.h" |
15 | 15 |
16 static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, | 16 static void test_read_pixels(skiatest::Reporter* reporter, GrContext* context, |
17 GrTexture* rectangleTexture, uint32_t expectedPixel
Values[]) { | 17 GrTexture* rectangleTexture, uint32_t expectedPixel
Values[]) { |
18 int pixelCnt = rectangleTexture->width() * rectangleTexture->height(); | 18 int pixelCnt = rectangleTexture->width() * rectangleTexture->height(); |
19 SkAutoTMalloc<uint32_t> pixels(pixelCnt); | 19 SkAutoTMalloc<uint32_t> pixels(pixelCnt); |
20 memset(pixels.get(), 0, sizeof(uint32_t)*pixelCnt); | 20 memset(pixels.get(), 0, sizeof(uint32_t)*pixelCnt); |
21 bool read = rectangleTexture->readPixels(0, 0, rectangleTexture->width(), | 21 bool read = rectangleTexture->readPixels(0, 0, rectangleTexture->width(), |
22 rectangleTexture->height(), kRGBA_88
88_GrPixelConfig, | 22 rectangleTexture->height(), kRGBA_88
88_GrPixelConfig, |
23 pixels.get()); | 23 pixels.get()); |
24 if (!read) { | 24 if (!read) { |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 | 198 |
199 test_write_pixels(reporter, context, rectangleTexture); | 199 test_write_pixels(reporter, context, rectangleTexture); |
200 | 200 |
201 test_clear(reporter, context, rectangleTexture); | 201 test_clear(reporter, context, rectangleTexture); |
202 | 202 |
203 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); | 203 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); |
204 } | 204 } |
205 } | 205 } |
206 | 206 |
207 #endif | 207 #endif |
OLD | NEW |