| 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 // This test only works with the GPU backend. | 8 // This test only works with the GPU backend. |
| 9 | 9 |
| 10 #include "gm.h" | 10 #include "gm.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 for (int i = 0; i < 3; ++i) { | 118 for (int i = 0; i < 3; ++i) { |
| 119 gpu->deleteTestingOnlyBackendTexture(yuvHandles[i]); | 119 gpu->deleteTestingOnlyBackendTexture(yuvHandles[i]); |
| 120 } | 120 } |
| 121 | 121 |
| 122 context->resetContext(); | 122 context->resetContext(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void onDraw(SkCanvas* canvas) override { | 125 void onDraw(SkCanvas* canvas) override { |
| 126 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 126 GrContext* context = canvas->getGrContext(); |
| 127 GrContext* context; | 127 if (!context) { |
| 128 if (!rt || !(context = rt->getContext())) { | |
| 129 skiagm::GM::DrawGpuOnlyMessage(canvas); | 128 skiagm::GM::DrawGpuOnlyMessage(canvas); |
| 130 return; | 129 return; |
| 131 } | 130 } |
| 132 | 131 |
| 133 GrBackendObject yuvHandles[3]; | 132 GrBackendObject yuvHandles[3]; |
| 134 this->createYUVTextures(context, yuvHandles); | 133 this->createYUVTextures(context, yuvHandles); |
| 135 | 134 |
| 136 static const SkScalar kPad = 10.f; | 135 static const SkScalar kPad = 10.f; |
| 137 | 136 |
| 138 SkISize sizes[] = { | 137 SkISize sizes[] = { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 163 | 162 |
| 164 static const int kBmpSize = 32; | 163 static const int kBmpSize = 32; |
| 165 | 164 |
| 166 typedef GM INHERITED; | 165 typedef GM INHERITED; |
| 167 }; | 166 }; |
| 168 | 167 |
| 169 DEF_GM(return new ImageFromYUVTextures;) | 168 DEF_GM(return new ImageFromYUVTextures;) |
| 170 } | 169 } |
| 171 | 170 |
| 172 #endif | 171 #endif |
| OLD | NEW |