| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 | 180 |
| 181 GrColor refPixels[kWidth * kHeight]; | 181 GrColor refPixels[kWidth * kHeight]; |
| 182 bool flipRef = rectangleDesc.fOrigin == kBottomLeft_GrSurfaceOrigin; | 182 bool flipRef = rectangleDesc.fOrigin == kBottomLeft_GrSurfaceOrigin; |
| 183 for (int y = 0; y < kHeight; ++y) { | 183 for (int y = 0; y < kHeight; ++y) { |
| 184 for (int x = 0; x < kWidth; ++x) { | 184 for (int x = 0; x < kWidth; ++x) { |
| 185 int y0 = flipRef ? kHeight - y - 1 : y; | 185 int y0 = flipRef ? kHeight - y - 1 : y; |
| 186 refPixels[y * kWidth + x] = pixels[y0 * kWidth + x]; | 186 refPixels[y * kWidth + x] = pixels[y0 * kWidth + x]; |
| 187 } | 187 } |
| 188 } | 188 } |
| 189 | 189 |
| 190 SkAutoTUnref<GrTexture> rectangleTexture( | 190 sk_sp<GrTexture> rectangleTexture( |
| 191 context->textureProvider()->wrapBackendTexture(rectangleDesc)); | 191 context->textureProvider()->wrapBackendTexture(rectangleDesc)); |
| 192 if (!rectangleTexture) { | 192 if (!rectangleTexture) { |
| 193 ERRORF(reporter, "Error wrapping rectangle texture in GrTexture."); | 193 ERRORF(reporter, "Error wrapping rectangle texture in GrTexture."); |
| 194 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); | 194 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); |
| 195 continue; | 195 continue; |
| 196 } | 196 } |
| 197 | 197 |
| 198 test_read_pixels(reporter, context, rectangleTexture, refPixels); | 198 test_read_pixels(reporter, context, rectangleTexture.get(), refPixels); |
| 199 | 199 |
| 200 test_copy_surface_src(reporter, context, rectangleTexture, refPixels); | 200 test_copy_surface_src(reporter, context, rectangleTexture.get(), refPixe
ls); |
| 201 | 201 |
| 202 test_copy_surface_dst(reporter, context, rectangleTexture); | 202 test_copy_surface_dst(reporter, context, rectangleTexture.get()); |
| 203 | 203 |
| 204 test_write_pixels(reporter, context, rectangleTexture); | 204 test_write_pixels(reporter, context, rectangleTexture.get()); |
| 205 | 205 |
| 206 test_clear(reporter, context, rectangleTexture); | 206 test_clear(reporter, context, rectangleTexture.get()); |
| 207 | 207 |
| 208 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); | 208 GR_GL_CALL(glContext->gl(), DeleteTextures(1, &rectTexID)); |
| 209 } | 209 } |
| 210 } | 210 } |
| 211 | 211 |
| 212 #endif | 212 #endif |
| OLD | NEW |