OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkArithmeticMode.h" | 8 #include "SkArithmeticMode.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkFlattenableBuffers.h" | 10 #include "SkFlattenableBuffers.h" |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 void GrGLArithmeticEffect::emitCode(GrGLShaderBuilder* builder, | 344 void GrGLArithmeticEffect::emitCode(GrGLShaderBuilder* builder, |
345 const GrDrawEffect& drawEffect, | 345 const GrDrawEffect& drawEffect, |
346 EffectKey key, | 346 EffectKey key, |
347 const char* outputColor, | 347 const char* outputColor, |
348 const char* inputColor, | 348 const char* inputColor, |
349 const TextureSamplerArray& samplers) { | 349 const TextureSamplerArray& samplers) { |
350 | 350 |
351 GrTexture* backgroundTex = drawEffect.castEffect<GrArithmeticEffect>().backg
roundTexture(); | 351 GrTexture* backgroundTex = drawEffect.castEffect<GrArithmeticEffect>().backg
roundTexture(); |
352 const char* dstColor; | 352 const char* dstColor; |
353 if (backgroundTex) { | 353 if (backgroundTex) { |
354 const char* bgCoords; | 354 SkString bgCoords; |
355 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder, key, &
bgCoords, NULL, "BG"); | 355 GrSLType bgCoordsType = fBackgroundEffectMatrix.emitCode(builder, key, &
bgCoords, NULL, "BG"); |
356 builder->fsCodeAppend("\t\tvec4 bgColor = "); | 356 builder->fsCodeAppend("\t\tvec4 bgColor = "); |
357 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, | 357 builder->appendTextureLookup(GrGLShaderBuilder::kFragment_ShaderType, |
358 samplers[0], | 358 samplers[0], |
359 bgCoords, | 359 bgCoords.c_str(), |
360 bgCoordsType); | 360 bgCoordsType); |
361 builder->fsCodeAppendf(";\n"); | 361 builder->fsCodeAppendf(";\n"); |
362 dstColor = "bgColor"; | 362 dstColor = "bgColor"; |
363 } else { | 363 } else { |
364 dstColor = builder->dstColor(); | 364 dstColor = builder->dstColor(); |
365 } | 365 } |
366 | 366 |
367 SkASSERT(NULL != dstColor); | 367 SkASSERT(NULL != dstColor); |
368 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, | 368 fKUni = builder->addUniform(GrGLShaderBuilder::kFragment_ShaderType, |
369 kVec4f_GrSLType, "k"); | 369 kVec4f_GrSLType, "k"); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 background); | 446 background); |
447 } | 447 } |
448 return true; | 448 return true; |
449 } | 449 } |
450 | 450 |
451 #endif | 451 #endif |
452 | 452 |
453 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 453 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
454 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 454 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
455 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 455 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |