Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: src/effects/SkArithmeticMode.cpp

Issue 608253002: Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix isSolidWhite Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 283
284 virtual ~GrArithmeticEffect(); 284 virtual ~GrArithmeticEffect();
285 285
286 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 286 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
287 287
288 typedef GrGLArithmeticEffect GLProcessor; 288 typedef GrGLArithmeticEffect GLProcessor;
289 static const char* Name() { return "Arithmetic"; } 289 static const char* Name() { return "Arithmetic"; }
290 GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture() ; } 290 GrTexture* backgroundTexture() const { return fBackgroundAccess.getTexture() ; }
291 291
292 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
293
294 float k1() const { return fK1; } 292 float k1() const { return fK1; }
295 float k2() const { return fK2; } 293 float k2() const { return fK2; }
296 float k3() const { return fK3; } 294 float k3() const { return fK3; }
297 float k4() const { return fK4; } 295 float k4() const { return fK4; }
298 bool enforcePMColor() const { return fEnforcePMColor; } 296 bool enforcePMColor() const { return fEnforcePMColor; }
299 297
300 private: 298 private:
301 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 299 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
302 300
301 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
302
303 GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMCol or, 303 GrArithmeticEffect(float k1, float k2, float k3, float k4, bool enforcePMCol or,
304 GrTexture* background); 304 GrTexture* background);
305 float fK1, fK2, fK3, fK4; 305 float fK1, fK2, fK3, fK4;
306 bool fEnforcePMColor; 306 bool fEnforcePMColor;
307 GrCoordTransform fBackgroundTransform; 307 GrCoordTransform fBackgroundTransform;
308 GrTextureAccess fBackgroundAccess; 308 GrTextureAccess fBackgroundAccess;
309 309
310 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 310 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
311 typedef GrFragmentProcessor INHERITED; 311 typedef GrFragmentProcessor INHERITED;
312 312
(...skipping 24 matching lines...) Expand all
337 fK3 == s.fK3 && 337 fK3 == s.fK3 &&
338 fK4 == s.fK4 && 338 fK4 == s.fK4 &&
339 fEnforcePMColor == s.fEnforcePMColor && 339 fEnforcePMColor == s.fEnforcePMColor &&
340 backgroundTexture() == s.backgroundTexture(); 340 backgroundTexture() == s.backgroundTexture();
341 } 341 }
342 342
343 const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const { 343 const GrBackendFragmentProcessorFactory& GrArithmeticEffect::getFactory() const {
344 return GrTBackendFragmentProcessorFactory<GrArithmeticEffect>::getInstance() ; 344 return GrTBackendFragmentProcessorFactory<GrArithmeticEffect>::getInstance() ;
345 } 345 }
346 346
347 void GrArithmeticEffect::getConstantColorComponents(GrColor* color, uint32_t* va lidFlags) const { 347 void GrArithmeticEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
348 // TODO: optimize this 348 // TODO: optimize this
349 *validFlags = 0; 349 inout->fValidFlags = 0;
350 inout->fIsSingleComponent = false;
350 } 351 }
351 352
352 /////////////////////////////////////////////////////////////////////////////// 353 ///////////////////////////////////////////////////////////////////////////////
353 354
354 GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendProcessorFactory& fact ory, 355 GrGLArithmeticEffect::GrGLArithmeticEffect(const GrBackendProcessorFactory& fact ory,
355 const GrProcessor&) 356 const GrProcessor&)
356 : INHERITED(factory), 357 : INHERITED(factory),
357 fEnforcePMColor(true) { 358 fEnforcePMColor(true) {
358 } 359 }
359 360
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 background); 453 background);
453 } 454 }
454 return true; 455 return true;
455 } 456 }
456 457
457 #endif 458 #endif
458 459
459 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 460 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
460 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 461 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
461 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 462 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkAlphaThresholdFilter.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698