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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 98 |
99 void createYUVTextures(GrContext* context, GrGLuint yuvIDs[3]) { | 99 void createYUVTextures(GrContext* context, GrGLuint yuvIDs[3]) { |
100 GrTestTarget tt; | 100 GrTestTarget tt; |
101 context->getTestTarget(&tt); | 101 context->getTestTarget(&tt); |
102 if (!tt.target()) { | 102 if (!tt.target()) { |
103 SkDEBUGFAIL("Couldn't get Gr test target."); | 103 SkDEBUGFAIL("Couldn't get Gr test target."); |
104 return; | 104 return; |
105 } | 105 } |
106 | 106 |
107 // We currently hav only implemented the texture uploads for GL. | 107 // We currently hav only implemented the texture uploads for GL. |
108 const GrGLInterface* gl = tt.glInterface(); | 108 const GrGLInterface* gl = tt.glContext()->interface(); |
109 if (!gl) { | 109 if (!gl) { |
110 return; | 110 return; |
111 } | 111 } |
112 | 112 |
113 GR_GL_CALL(gl, GenTextures(3, yuvIDs)); | 113 GR_GL_CALL(gl, GenTextures(3, yuvIDs)); |
114 GR_GL_CALL(gl, ActiveTexture(GR_GL_TEXTURE0)); | 114 GR_GL_CALL(gl, ActiveTexture(GR_GL_TEXTURE0)); |
115 GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); | 115 GR_GL_CALL(gl, PixelStorei(GR_GL_UNPACK_ALIGNMENT, 1)); |
116 for (int i = 0; i < 3; ++i) { | 116 for (int i = 0; i < 3; ++i) { |
117 GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, yuvIDs[i])); | 117 GR_GL_CALL(gl, BindTexture(GR_GL_TEXTURE_2D, yuvIDs[i])); |
118 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FIL
TER, | 118 GR_GL_CALL(gl, TexParameteri(GR_GL_TEXTURE_2D, GR_GL_TEXTURE_MAG_FIL
TER, |
(...skipping 13 matching lines...) Expand all Loading... |
132 } | 132 } |
133 | 133 |
134 void deleteYUVTextures(GrContext* context, const GrGLuint yuvIDs[3]) { | 134 void deleteYUVTextures(GrContext* context, const GrGLuint yuvIDs[3]) { |
135 GrTestTarget tt; | 135 GrTestTarget tt; |
136 context->getTestTarget(&tt); | 136 context->getTestTarget(&tt); |
137 if (!tt.target()) { | 137 if (!tt.target()) { |
138 SkDEBUGFAIL("Couldn't get Gr test target."); | 138 SkDEBUGFAIL("Couldn't get Gr test target."); |
139 return; | 139 return; |
140 } | 140 } |
141 | 141 |
142 const GrGLInterface* gl = tt.glInterface(); | 142 const GrGLInterface* gl = tt.glContext()->interface(); |
143 if (!gl) { | 143 if (!gl) { |
144 return; | 144 return; |
145 } | 145 } |
146 GR_GL_CALL(gl, DeleteTextures(3, yuvIDs)); | 146 GR_GL_CALL(gl, DeleteTextures(3, yuvIDs)); |
147 context->resetContext(); | 147 context->resetContext(); |
148 } | 148 } |
149 | 149 |
150 void onDraw(SkCanvas* canvas) override { | 150 void onDraw(SkCanvas* canvas) override { |
151 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); | 151 GrRenderTarget* rt = canvas->internal_private_accessTopLayerRenderTarget
(); |
152 GrContext* context; | 152 GrContext* context; |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 static const int kBmpSize = 32; | 196 static const int kBmpSize = 32; |
197 | 197 |
198 typedef GM INHERITED; | 198 typedef GM INHERITED; |
199 }; | 199 }; |
200 | 200 |
201 DEF_GM( return SkNEW(ImageFromYUVTextures); ) | 201 DEF_GM( return SkNEW(ImageFromYUVTextures); ) |
202 } | 202 } |
203 | 203 |
204 #endif | 204 #endif |
OLD | NEW |