| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2015 Google Inc. | 3 * Copyright 2015 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 // This is a GPU-backend specific test. It relies on static intializers to work | 9 // This is a GPU-backend specific test. It relies on static intializers to work |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 gpu->discard(NULL); | 51 gpu->discard(NULL); |
| 52 SkAutoTMalloc<GrColor> buffer(25); | 52 SkAutoTMalloc<GrColor> buffer(25); |
| 53 | 53 |
| 54 GrSurfaceDesc surfDesc; | 54 GrSurfaceDesc surfDesc; |
| 55 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 55 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 56 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; | 56 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; |
| 57 surfDesc.fWidth = 5; | 57 surfDesc.fWidth = 5; |
| 58 surfDesc.fHeight = 5; | 58 surfDesc.fHeight = 5; |
| 59 surfDesc.fConfig = config; | 59 surfDesc.fConfig = config; |
| 60 surfDesc.fSampleCnt = 0; | 60 surfDesc.fSampleCnt = 0; |
| 61 GrTexture* tex = gpu->createTexture(surfDesc, false, nullptr, 0); | 61 GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo, nullptr, 0); |
| 62 SkASSERT(tex); | 62 SkASSERT(tex); |
| 63 SkASSERT(tex->asRenderTarget()); | 63 SkASSERT(tex->asRenderTarget()); |
| 64 SkIRect rect = SkIRect::MakeWH(5, 5); | 64 SkIRect rect = SkIRect::MakeWH(5, 5); |
| 65 | 65 |
| 66 gpu->clear(rect, GrColor_TRANSPARENT_BLACK, tex->asRenderTarget()); | 66 gpu->clear(rect, GrColor_TRANSPARENT_BLACK, tex->asRenderTarget()); |
| 67 | 67 |
| 68 gpu->readPixels(tex, 0, 0, 5, 5, config, (void*)buffer.get(), 0); | 68 gpu->readPixels(tex, 0, 0, 5, 5, config, (void*)buffer.get(), 0); |
| 69 | 69 |
| 70 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(buffer.get(
), | 70 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(buffer.get(
), |
| 71 GrColor_TRA
NSPARENT_BLACK, | 71 GrColor_TRA
NSPARENT_BLACK, |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 SkAutoTMalloc<GrColor> buffer(width * height); | 106 SkAutoTMalloc<GrColor> buffer(width * height); |
| 107 SkAutoTMalloc<GrColor> subBuffer(subWidth * subHeight); | 107 SkAutoTMalloc<GrColor> subBuffer(subWidth * subHeight); |
| 108 | 108 |
| 109 GrSurfaceDesc surfDesc; | 109 GrSurfaceDesc surfDesc; |
| 110 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag; | 110 surfDesc.fFlags = kRenderTarget_GrSurfaceFlag; |
| 111 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; | 111 surfDesc.fOrigin = kTopLeft_GrSurfaceOrigin; |
| 112 surfDesc.fWidth = width; | 112 surfDesc.fWidth = width; |
| 113 surfDesc.fHeight = height; | 113 surfDesc.fHeight = height; |
| 114 surfDesc.fConfig = config; | 114 surfDesc.fConfig = config; |
| 115 surfDesc.fSampleCnt = 0; | 115 surfDesc.fSampleCnt = 0; |
| 116 GrTexture* tex = gpu->createTexture(surfDesc, false, nullptr, 0); | 116 GrTexture* tex = gpu->createTexture(surfDesc, SkBudgeted::kNo, nullptr, 0); |
| 117 SkASSERT(tex); | 117 SkASSERT(tex); |
| 118 SkASSERT(tex->asRenderTarget()); | 118 SkASSERT(tex->asRenderTarget()); |
| 119 | 119 |
| 120 SkIRect fullRect = SkIRect::MakeWH(10, 10); | 120 SkIRect fullRect = SkIRect::MakeWH(10, 10); |
| 121 gpu->clear(fullRect, GrColor_TRANSPARENT_BLACK, tex->asRenderTarget()); | 121 gpu->clear(fullRect, GrColor_TRANSPARENT_BLACK, tex->asRenderTarget()); |
| 122 | 122 |
| 123 gpu->readPixels(tex, 0, 0, width, height, config, (void*)buffer.get(), 0); | 123 gpu->readPixels(tex, 0, 0, width, height, config, (void*)buffer.get(), 0); |
| 124 | 124 |
| 125 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(buffer.get(
), | 125 REPORTER_ASSERT(reporter, does_full_buffer_contain_correct_color(buffer.get(
), |
| 126 GrColor_TRA
NSPARENT_BLACK, | 126 GrColor_TRA
NSPARENT_BLACK, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 basic_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); | 209 basic_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); |
| 210 basic_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); | 210 basic_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); |
| 211 sub_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); | 211 sub_clear_test(reporter, context, kRGBA_8888_GrPixelConfig); |
| 212 sub_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); | 212 sub_clear_test(reporter, context, kBGRA_8888_GrPixelConfig); |
| 213 } | 213 } |
| 214 | 214 |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 #endif | 218 #endif |
| OLD | NEW |