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

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

Issue 1266633003: Added registerChild; transforms, textures, glKey automatically handled. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: refactored to onGetGLProcessorKey; removed emitSamplers specialized template; fixed nits Created 5 years, 4 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/SkLinearGradient.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 2015 Google Inc. 2 * Copyright 2015 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkTableColorFilter.h" 9 #include "SkTableColorFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 #include "gl/builders/GrGLProgramBuilder.h" 341 #include "gl/builders/GrGLProgramBuilder.h"
342 342
343 class ColorTableEffect : public GrFragmentProcessor { 343 class ColorTableEffect : public GrFragmentProcessor {
344 public: 344 public:
345 static GrFragmentProcessor* Create(GrContext* context, SkBitmap bitmap, unsi gned flags); 345 static GrFragmentProcessor* Create(GrContext* context, SkBitmap bitmap, unsi gned flags);
346 346
347 virtual ~ColorTableEffect(); 347 virtual ~ColorTableEffect();
348 348
349 const char* name() const override { return "ColorTable"; } 349 const char* name() const override { return "ColorTable"; }
350 350
351 void getGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const over ride;
352
353 GrGLFragmentProcessor* createGLInstance() const override; 351 GrGLFragmentProcessor* createGLInstance() const override;
354 352
355 const GrTextureStripAtlas* atlas() const { return fAtlas; } 353 const GrTextureStripAtlas* atlas() const { return fAtlas; }
356 int atlasRow() const { return fRow; } 354 int atlasRow() const { return fRow; }
357 355
358 private: 356 private:
357 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov erride;
358
359 bool onIsEqual(const GrFragmentProcessor&) const override; 359 bool onIsEqual(const GrFragmentProcessor&) const override;
360 360
361 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 361 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
362 362
363 ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row, un signed flags); 363 ColorTableEffect(GrTexture* texture, GrTextureStripAtlas* atlas, int row, un signed flags);
364 364
365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
366 366
367 GrTextureAccess fTextureAccess; 367 GrTextureAccess fTextureAccess;
368 368
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 this->initClassID<ColorTableEffect>(); 493 this->initClassID<ColorTableEffect>();
494 this->addTextureAccess(&fTextureAccess); 494 this->addTextureAccess(&fTextureAccess);
495 } 495 }
496 496
497 ColorTableEffect::~ColorTableEffect() { 497 ColorTableEffect::~ColorTableEffect() {
498 if (fAtlas) { 498 if (fAtlas) {
499 fAtlas->unlockRow(fRow); 499 fAtlas->unlockRow(fRow);
500 } 500 }
501 } 501 }
502 502
503 void ColorTableEffect::getGLProcessorKey(const GrGLSLCaps& caps, 503 void ColorTableEffect::onGetGLProcessorKey(const GrGLSLCaps& caps,
504 GrProcessorKeyBuilder* b) const { 504 GrProcessorKeyBuilder* b) const {
505 GLColorTableEffect::GenKey(*this, caps, b); 505 GLColorTableEffect::GenKey(*this, caps, b);
506 } 506 }
507 507
508 GrGLFragmentProcessor* ColorTableEffect::createGLInstance() const { 508 GrGLFragmentProcessor* ColorTableEffect::createGLInstance() const {
509 return SkNEW_ARGS(GLColorTableEffect, (*this)); 509 return SkNEW_ARGS(GLColorTableEffect, (*this));
510 } 510 }
511 511
512 bool ColorTableEffect::onIsEqual(const GrFragmentProcessor& other) const { 512 bool ColorTableEffect::onIsEqual(const GrFragmentProcessor& other) const {
513 // For non-atlased instances, the texture (compared by base class) is suffic ient to 513 // For non-atlased instances, the texture (compared by base class) is suffic ient to
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
612 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], 612 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256],
613 const uint8_t tableR[256], 613 const uint8_t tableR[256],
614 const uint8_t tableG[256], 614 const uint8_t tableG[256],
615 const uint8_t tableB[256]) { 615 const uint8_t tableB[256]) {
616 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); 616 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB));
617 } 617 }
618 618
619 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) 619 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter)
620 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) 620 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter)
621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 621 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkPerlinNoiseShader.cpp ('k') | src/effects/gradients/SkLinearGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698