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

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

Issue 654273002: Push isEqual/onIsEqual down from GrProcessor to subclasses. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.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 #include "SkBitmap.h" 2 #include "SkBitmap.h"
3 #include "SkTableColorFilter.h" 3 #include "SkTableColorFilter.h"
4 #include "SkColorPriv.h" 4 #include "SkColorPriv.h"
5 #include "SkReadBuffer.h" 5 #include "SkReadBuffer.h"
6 #include "SkWriteBuffer.h" 6 #include "SkWriteBuffer.h"
7 #include "SkUnPreMultiply.h" 7 #include "SkUnPreMultiply.h"
8 #include "SkString.h" 8 #include "SkString.h"
9 9
10 class SkTable_ColorFilter : public SkColorFilter { 10 class SkTable_ColorFilter : public SkColorFilter {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 } 290 }
291 291
292 virtual ~ColorTableEffect(); 292 virtual ~ColorTableEffect();
293 293
294 static const char* Name() { return "ColorTable"; } 294 static const char* Name() { return "ColorTable"; }
295 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 295 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
296 296
297 typedef GLColorTableEffect GLProcessor; 297 typedef GLColorTableEffect GLProcessor;
298 298
299 private: 299 private:
300 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 300 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
301 301
302 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 302 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
303 303
304 explicit ColorTableEffect(GrTexture* texture, unsigned flags); 304 explicit ColorTableEffect(GrTexture* texture, unsigned flags);
305 305
306 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 306 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
307 307
308 GrTextureAccess fTextureAccess; 308 GrTextureAccess fTextureAccess;
309 unsigned fFlags; // currently not used in shader code, just to assist 309 unsigned fFlags; // currently not used in shader code, just to assist
310 // onComputeInvariantOutput(). 310 // onComputeInvariantOutput().
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 this->addTextureAccess(&fTextureAccess); 390 this->addTextureAccess(&fTextureAccess);
391 } 391 }
392 392
393 ColorTableEffect::~ColorTableEffect() { 393 ColorTableEffect::~ColorTableEffect() {
394 } 394 }
395 395
396 const GrBackendFragmentProcessorFactory& ColorTableEffect::getFactory() const { 396 const GrBackendFragmentProcessorFactory& ColorTableEffect::getFactory() const {
397 return GrTBackendFragmentProcessorFactory<ColorTableEffect>::getInstance(); 397 return GrTBackendFragmentProcessorFactory<ColorTableEffect>::getInstance();
398 } 398 }
399 399
400 bool ColorTableEffect::onIsEqual(const GrProcessor& sBase) const { 400 bool ColorTableEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
401 return this->texture(0) == sBase.texture(0); 401 return this->texture(0) == sBase.texture(0);
402 } 402 }
403 403
404 void ColorTableEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 404 void ColorTableEffect::onComputeInvariantOutput(InvariantOutput* inout) const {
405 // If we kept the table in the effect then we could actually run known input s through the 405 // If we kept the table in the effect then we could actually run known input s through the
406 // table. 406 // table.
407 uint8_t invalidateFlags = 0; 407 uint8_t invalidateFlags = 0;
408 if (fFlags & SkTable_ColorFilter::kR_Flag) { 408 if (fFlags & SkTable_ColorFilter::kR_Flag) {
409 invalidateFlags |= kR_GrColorComponentFlag; 409 invalidateFlags |= kR_GrColorComponentFlag;
410 } 410 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], 462 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
463 const uint8_t tableR[256], 463 const uint8_t tableR[256],
464 const uint8_t tableG[256], 464 const uint8_t tableG[256],
465 const uint8_t tableB[256]) { 465 const uint8_t tableB[256]) {
466 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); 466 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
467 } 467 }
468 468
469 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) 469 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
470 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) 470 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
471 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 471 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkGradientShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698