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 "SkReadBuffer.h" | 10 #include "SkReadBuffer.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 #if SK_SUPPORT_GPU | 250 #if SK_SUPPORT_GPU |
251 | 251 |
252 class GrGLArithmeticEffect : public GrGLFragmentProcessor { | 252 class GrGLArithmeticEffect : public GrGLFragmentProcessor { |
253 public: | 253 public: |
254 GrGLArithmeticEffect(const GrBackendProcessorFactory&, const GrProcessor&); | 254 GrGLArithmeticEffect(const GrBackendProcessorFactory&, const GrProcessor&); |
255 virtual ~GrGLArithmeticEffect(); | 255 virtual ~GrGLArithmeticEffect(); |
256 | 256 |
257 virtual void emitCode(GrGLFPBuilder*, | 257 virtual void emitCode(GrGLFPBuilder*, |
258 const GrFragmentProcessor&, | 258 const GrFragmentProcessor&, |
259 const GrProcessorKey&, | |
260 const char* outputColor, | 259 const char* outputColor, |
261 const char* inputColor, | 260 const char* inputColor, |
262 const TransformedCoordsArray&, | 261 const TransformedCoordsArray&, |
263 const TextureSamplerArray&) SK_OVERRIDE; | 262 const TextureSamplerArray&) SK_OVERRIDE; |
264 | 263 |
265 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 264 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; |
266 | 265 |
267 static void GenKey(const GrProcessor&, const GrGLCaps& caps, GrProcessorKeyB
uilder* b); | 266 static void GenKey(const GrProcessor&, const GrGLCaps& caps, GrProcessorKeyB
uilder* b); |
268 | 267 |
269 private: | 268 private: |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 const GrProcessor&) | 354 const GrProcessor&) |
356 : INHERITED(factory), | 355 : INHERITED(factory), |
357 fEnforcePMColor(true) { | 356 fEnforcePMColor(true) { |
358 } | 357 } |
359 | 358 |
360 GrGLArithmeticEffect::~GrGLArithmeticEffect() { | 359 GrGLArithmeticEffect::~GrGLArithmeticEffect() { |
361 } | 360 } |
362 | 361 |
363 void GrGLArithmeticEffect::emitCode(GrGLFPBuilder* builder, | 362 void GrGLArithmeticEffect::emitCode(GrGLFPBuilder* builder, |
364 const GrFragmentProcessor& fp, | 363 const GrFragmentProcessor& fp, |
365 const GrProcessorKey& key, | |
366 const char* outputColor, | 364 const char* outputColor, |
367 const char* inputColor, | 365 const char* inputColor, |
368 const TransformedCoordsArray& coords, | 366 const TransformedCoordsArray& coords, |
369 const TextureSamplerArray& samplers) { | 367 const TextureSamplerArray& samplers) { |
370 | 368 |
371 GrTexture* backgroundTex = fp.cast<GrArithmeticEffect>().backgroundTexture()
; | 369 GrTexture* backgroundTex = fp.cast<GrArithmeticEffect>().backgroundTexture()
; |
372 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 370 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
373 const char* dstColor; | 371 const char* dstColor; |
374 if (backgroundTex) { | 372 if (backgroundTex) { |
375 fsBuilder->codeAppend("\t\tvec4 bgColor = "); | 373 fsBuilder->codeAppend("\t\tvec4 bgColor = "); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 background); | 450 background); |
453 } | 451 } |
454 return true; | 452 return true; |
455 } | 453 } |
456 | 454 |
457 #endif | 455 #endif |
458 | 456 |
459 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) | 457 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) |
460 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) | 458 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) |
461 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 459 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |