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 test only works with the GPU backend. | 9 // This test only works with the GPU backend. |
10 | 10 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 void createYUVTextures(GrContext* context, GrBackendObject yuvIDs[3]) { | 97 void createYUVTextures(GrContext* context, GrBackendObject yuvIDs[3]) { |
98 const GrGpu* gpu = context->getGpu(); | 98 const GrGpu* gpu = context->getGpu(); |
99 if (!gpu) { | 99 if (!gpu) { |
100 return; | 100 return; |
101 } | 101 } |
102 | 102 |
103 for (int i = 0; i < 3; ++i) { | 103 for (int i = 0; i < 3; ++i) { |
104 SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes())); | 104 SkASSERT(fYUVBmps[i].width() == SkToInt(fYUVBmps[i].rowBytes())); |
105 yuvIDs[i] = gpu->createBackendTexture(fYUVBmps[i].getPixels(), | 105 yuvIDs[i] = gpu->createTestingOnlyBackendTexture(fYUVBmps[i].getPixe
ls(), |
106 fYUVBmps[i].width(), fYUVBmps[
i].height(), | 106 fYUVBmps[i].width()
, |
107 kAlpha_8_GrPixelConfig); | 107 fYUVBmps[i].height(
), |
| 108 kAlpha_8_GrPixelCon
fig); |
108 } | 109 } |
109 context->resetContext(); | 110 context->resetContext(); |
110 } | 111 } |
111 | 112 |
112 void deleteYUVTextures(GrContext* context, const GrBackendObject yuvIDs[3])
{ | 113 void deleteYUVTextures(GrContext* context, const GrBackendObject yuvIDs[3])
{ |
113 | 114 |
114 const GrGpu* gpu = context->getGpu(); | 115 const GrGpu* gpu = context->getGpu(); |
115 if (!gpu) { | 116 if (!gpu) { |
116 return; | 117 return; |
117 } | 118 } |
118 | 119 |
119 for (int i = 0; i < 3; ++i) { | 120 for (int i = 0; i < 3; ++i) { |
120 gpu->deleteBackendTexture(yuvIDs[i]); | 121 gpu->deleteTestingOnlyBackendTexture(yuvIDs[i]); |
121 } | 122 } |
122 | 123 |
123 context->resetContext(); | 124 context->resetContext(); |
124 } | 125 } |
125 | 126 |
126 void onDraw(SkCanvas* canvas) override { | 127 void onDraw(SkCanvas* canvas) override { |
127 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 128 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
128 GrContext* context; | 129 GrContext* context; |
129 if (!rt || !(context = rt->getContext())) { | 130 if (!rt || !(context = rt->getContext())) { |
130 this->drawGpuOnlyMessage(canvas); | 131 this->drawGpuOnlyMessage(canvas); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 167 |
167 static const int kBmpSize = 32; | 168 static const int kBmpSize = 32; |
168 | 169 |
169 typedef GM INHERITED; | 170 typedef GM INHERITED; |
170 }; | 171 }; |
171 | 172 |
172 DEF_GM( return SkNEW(ImageFromYUVTextures); ) | 173 DEF_GM( return SkNEW(ImageFromYUVTextures); ) |
173 } | 174 } |
174 | 175 |
175 #endif | 176 #endif |
OLD | NEW |