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

Unified Diff: src/effects/SkPixelXorXfermode.cpp

Issue 1646453003: Make SkPixelXorXfermode's opColor be SkPMColor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to ToT Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/effects/SkPixelXorXfermode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkPixelXorXfermode.cpp
diff --git a/src/effects/SkPixelXorXfermode.cpp b/src/effects/SkPixelXorXfermode.cpp
index e2ecb0e365364ed6b896da4a0569a024aa7f6a04..a9316cc55e4660492bbbbd346a6964fda87b48b2 100644
--- a/src/effects/SkPixelXorXfermode.cpp
+++ b/src/effects/SkPixelXorXfermode.cpp
@@ -120,7 +120,7 @@ class GLPixelXorFP;
class PixelXorFP : public GrFragmentProcessor {
public:
- static const GrFragmentProcessor* Create(SkColor opColor, const GrFragmentProcessor* dst) {
+ static const GrFragmentProcessor* Create(SkPMColor opColor, const GrFragmentProcessor* dst) {
return new PixelXorFP(opColor, dst);
}
@@ -134,7 +134,7 @@ public:
return str;
}
- SkColor opColor() const { return fOpColor; }
+ SkPMColor opColor() const { return fOpColor; }
private:
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@@ -150,7 +150,7 @@ private:
inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
}
- PixelXorFP(SkColor opColor, const GrFragmentProcessor* dst)
+ PixelXorFP(SkPMColor opColor, const GrFragmentProcessor* dst)
: fOpColor(opColor) {
this->initClassID<PixelXorFP>();
@@ -159,7 +159,7 @@ private:
SkASSERT(0 == dstIndex);
}
- SkColor fOpColor;
+ SkPMColor fOpColor;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
typedef GrFragmentProcessor INHERITED;
@@ -193,9 +193,9 @@ protected:
void onSetData(const GrGLSLProgramDataManager& pdman, const GrProcessor& proc) override {
const PixelXorFP& pixXor = proc.cast<PixelXorFP>();
pdman.set3f(fOpColorUni,
- SkColorGetR(pixXor.opColor())/255.0f,
- SkColorGetG(pixXor.opColor())/255.0f,
- SkColorGetB(pixXor.opColor())/255.0f);
+ SkGetPackedR32(pixXor.opColor())/255.0f,
+ SkGetPackedG32(pixXor.opColor())/255.0f,
+ SkGetPackedB32(pixXor.opColor())/255.0f);
}
private:
@@ -218,7 +218,7 @@ const GrFragmentProcessor* PixelXorFP::TestCreate(GrProcessorTestData* d) {
SkColor color = d->fRandom->nextU();
SkAutoTUnref<const GrFragmentProcessor> dst(GrProcessorUnitTest::CreateChildFP(d));
- return new PixelXorFP(color, dst);
+ return new PixelXorFP(SkPreMultiplyColor(color), dst);
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(PixelXorFP);
@@ -229,7 +229,7 @@ GR_DEFINE_FRAGMENT_PROCESSOR_TEST(PixelXorFP);
class PixelXorXP : public GrXferProcessor {
public:
- PixelXorXP(const DstTexture* dstTexture, bool hasMixedSamples, SkColor opColor)
+ PixelXorXP(const DstTexture* dstTexture, bool hasMixedSamples, SkPMColor opColor)
: INHERITED(dstTexture, true, hasMixedSamples)
, fOpColor(opColor) {
this->initClassID<PixelXorXP>();
@@ -239,7 +239,7 @@ public:
GrGLSLXferProcessor* createGLSLInstance() const override;
- SkColor opColor() const { return fOpColor; }
+ SkPMColor opColor() const { return fOpColor; }
private:
GrXferProcessor::OptFlags onGetOptimizations(const GrPipelineOptimizations& optimizations,
@@ -257,7 +257,7 @@ private:
return fOpColor == xp.fOpColor;
}
- SkColor fOpColor;
+ SkPMColor fOpColor;
typedef GrXferProcessor INHERITED;
};
@@ -296,10 +296,10 @@ private:
void onSetData(const GrGLSLProgramDataManager& pdman,
const GrXferProcessor& processor) override {
const PixelXorXP& pixelXor = processor.cast<PixelXorXP>();
- pdman.set3f(fOpColorUni,
- SkColorGetR(pixelXor.opColor())/255.0f,
- SkColorGetG(pixelXor.opColor())/255.0f,
- SkColorGetB(pixelXor.opColor())/255.0f);
+ pdman.set3f(fOpColorUni,
+ SkGetPackedR32(pixelXor.opColor())/255.0f,
+ SkGetPackedG32(pixelXor.opColor())/255.0f,
+ SkGetPackedB32(pixelXor.opColor())/255.0f);
};
GrGLSLProgramDataManager::UniformHandle fOpColorUni;
@@ -319,7 +319,7 @@ GrGLSLXferProcessor* PixelXorXP::createGLSLInstance() const { return new GLPixel
class GrPixelXorXPFactory : public GrXPFactory {
public:
- static GrXPFactory* Create(SkColor opColor) {
+ static GrXPFactory* Create(SkPMColor opColor) {
return new GrPixelXorXPFactory(opColor);
}
@@ -330,7 +330,7 @@ public:
}
private:
- GrPixelXorXPFactory(SkColor opColor)
+ GrPixelXorXPFactory(SkPMColor opColor)
: fOpColor(opColor) {
this->initClassID<GrPixelXorXPFactory>();
}
@@ -355,7 +355,7 @@ private:
GR_DECLARE_XP_FACTORY_TEST;
- SkColor fOpColor;
+ SkPMColor fOpColor;
typedef GrXPFactory INHERITED;
};
@@ -365,13 +365,13 @@ GR_DEFINE_XP_FACTORY_TEST(GrPixelXorXPFactory);
const GrXPFactory* GrPixelXorXPFactory::TestCreate(GrProcessorTestData* d) {
SkColor color = d->fRandom->nextU();
- return GrPixelXorXPFactory::Create(color);
+ return GrPixelXorXPFactory::Create(SkPreMultiplyColor(color));
}
///////////////////////////////////////////////////////////////////////////////
bool SkPixelXorXfermode::asFragmentProcessor(const GrFragmentProcessor** output,
- const GrFragmentProcessor* dst) const {
+ const GrFragmentProcessor* dst) const {
if (output) {
*output = PixelXorFP::Create(fOpColor, dst);
}
« no previous file with comments | « include/effects/SkPixelXorXfermode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698