OLD | NEW |
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 Loading... |
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 GrFragmentProcessor&) const SK_OVERRIDE; | 300 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE{ return
true; } |
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 Loading... |
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 GrFragmentProcessor& sBase) const { | |
401 return this->texture(0) == sBase.texture(0); | |
402 } | |
403 | |
404 void ColorTableEffect::onComputeInvariantOutput(InvariantOutput* inout) const { | 400 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 | 401 // If we kept the table in the effect then we could actually run known input
s through the |
406 // table. | 402 // table. |
407 uint8_t invalidateFlags = 0; | 403 uint8_t invalidateFlags = 0; |
408 if (fFlags & SkTable_ColorFilter::kR_Flag) { | 404 if (fFlags & SkTable_ColorFilter::kR_Flag) { |
409 invalidateFlags |= kR_GrColorComponentFlag; | 405 invalidateFlags |= kR_GrColorComponentFlag; |
410 } | 406 } |
411 if (fFlags & SkTable_ColorFilter::kG_Flag) { | 407 if (fFlags & SkTable_ColorFilter::kG_Flag) { |
412 invalidateFlags |= kG_GrColorComponentFlag; | 408 invalidateFlags |= kG_GrColorComponentFlag; |
413 } | 409 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], | 458 SkColorFilter* SkTableColorFilter::CreateARGB(const uint8_t tableA[256], |
463 const uint8_t tableR[256], | 459 const uint8_t tableR[256], |
464 const uint8_t tableG[256], | 460 const uint8_t tableG[256], |
465 const uint8_t tableB[256]) { | 461 const uint8_t tableB[256]) { |
466 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); | 462 return SkNEW_ARGS(SkTable_ColorFilter, (tableA, tableR, tableG, tableB)); |
467 } | 463 } |
468 | 464 |
469 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) | 465 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkTableColorFilter) |
470 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) | 466 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkTable_ColorFilter) |
471 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 467 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |