OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "SkColorCubeFilter.h" | 8 #include "SkColorCubeFilter.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkOnce.h" | 10 #include "SkOnce.h" |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 const GrFragmentProcessor&, | 274 const GrFragmentProcessor&, |
275 const char* outputColor, | 275 const char* outputColor, |
276 const char* inputColor, | 276 const char* inputColor, |
277 const TransformedCoordsArray& coor
ds, | 277 const TransformedCoordsArray& coor
ds, |
278 const TextureSamplerArray& sampler
s) { | 278 const TextureSamplerArray& sampler
s) { |
279 if (NULL == inputColor) { | 279 if (NULL == inputColor) { |
280 inputColor = "vec4(1)"; | 280 inputColor = "vec4(1)"; |
281 } | 281 } |
282 | 282 |
283 fColorCubeSizeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi
lity, | 283 fColorCubeSizeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibi
lity, |
284 kFloat_GrSLType, "Size"); | 284 kFloat_GrSLType, kDefault_GrSLPrecis
ion, |
| 285 "Size"); |
285 const char* colorCubeSizeUni = builder->getUniformCStr(fColorCubeSizeUni); | 286 const char* colorCubeSizeUni = builder->getUniformCStr(fColorCubeSizeUni); |
286 fColorCubeInvSizeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Vis
ibility, | 287 fColorCubeInvSizeUni = builder->addUniform(GrGLProgramBuilder::kFragment_Vis
ibility, |
287 kFloat_GrSLType, "InvSize"); | 288 kFloat_GrSLType, kDefault_GrSLPre
cision, |
| 289 "InvSize"); |
288 const char* colorCubeInvSizeUni = builder->getUniformCStr(fColorCubeInvSizeU
ni); | 290 const char* colorCubeInvSizeUni = builder->getUniformCStr(fColorCubeInvSizeU
ni); |
289 | 291 |
290 const char* nonZeroAlpha = "nonZeroAlpha"; | 292 const char* nonZeroAlpha = "nonZeroAlpha"; |
291 const char* unPMColor = "unPMColor"; | 293 const char* unPMColor = "unPMColor"; |
292 const char* cubeIdx = "cubeIdx"; | 294 const char* cubeIdx = "cubeIdx"; |
293 const char* cCoords1 = "cCoords1"; | 295 const char* cCoords1 = "cCoords1"; |
294 const char* cCoords2 = "cCoords2"; | 296 const char* cCoords2 = "cCoords2"; |
295 | 297 |
296 // Note: if implemented using texture3D in OpenGL ES older than OpenGL ES 3.
0, | 298 // Note: if implemented using texture3D in OpenGL ES older than OpenGL ES 3.
0, |
297 // the shader might need "#extension GL_OES_texture_3D : enable". | 299 // the shader might need "#extension GL_OES_texture_3D : enable". |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 SkAutoTUnref<GrTexture> textureCube; | 360 SkAutoTUnref<GrTexture> textureCube; |
359 if (surface) { | 361 if (surface) { |
360 textureCube.reset(surface->asTexture()); | 362 textureCube.reset(surface->asTexture()); |
361 } else { | 363 } else { |
362 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); | 364 textureCube.reset(context->createTexture(NULL, desc, cacheID, fCubeData-
>data(), 0)); |
363 } | 365 } |
364 | 366 |
365 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; | 367 return textureCube ? GrColorCubeEffect::Create(textureCube) : NULL; |
366 } | 368 } |
367 #endif | 369 #endif |
OLD | NEW |