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

Unified Diff: include/gpu/effects/GrPorterDuffXferProcessor.h

Issue 1455273006: Make specialized SrcOver XPFactory (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/gpu/effects/GrCustomXfermode.h ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/effects/GrPorterDuffXferProcessor.h
diff --git a/include/gpu/effects/GrPorterDuffXferProcessor.h b/include/gpu/effects/GrPorterDuffXferProcessor.h
index d297e3290854c01e1d963df5c5f9f1b68fc4ac19..72faeb572cc8e0fc4c2bf02dd7c8b8c94ca6ecec 100644
--- a/include/gpu/effects/GrPorterDuffXferProcessor.h
+++ b/include/gpu/effects/GrPorterDuffXferProcessor.h
@@ -14,9 +14,9 @@
class GrProcOptInfo;
-class GrPorterDuffXPFactory : public GrXPFactory {
+class GrPDXPFactory : public GrXPFactory {
public:
- static GrXPFactory* Create(SkXfermode::Mode mode);
+ static const GrXPFactory* Create(SkXfermode::Mode mode);
bool supportsRGBCoverage(GrColor /*knownColor*/, uint32_t /*knownColorFlags*/) const override {
return true;
@@ -26,7 +26,7 @@ public:
GrXPFactory::InvariantBlendedColor*) const override;
private:
- GrPorterDuffXPFactory(SkXfermode::Mode);
+ GrPDXPFactory(SkXfermode::Mode);
GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
const GrProcOptInfo& colorPOI,
@@ -40,7 +40,7 @@ private:
bool hasMixedSamples) const override;
bool onIsEqual(const GrXPFactory& xpfBase) const override {
- const GrPorterDuffXPFactory& xpf = xpfBase.cast<GrPorterDuffXPFactory>();
+ const GrPDXPFactory& xpf = xpfBase.cast<GrPDXPFactory>();
return fXfermode == xpf.fXfermode;
}
@@ -53,4 +53,47 @@ private:
typedef GrXPFactory INHERITED;
};
+class GrSrcOverPDXPFactory : public GrXPFactory {
+public:
+ GrSrcOverPDXPFactory();
+
+ bool supportsRGBCoverage(GrColor /*knownColor*/, uint32_t /*knownColorFlags*/) const override {
+ return true;
+ }
+
+ void getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
+ GrXPFactory::InvariantBlendedColor*) const override;
+
+private:
+ GrXferProcessor* onCreateXferProcessor(const GrCaps& caps,
+ const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool hasMixedSamples,
+ const DstTexture*) const override;
+
+ bool willReadDstColor(const GrCaps& caps,
+ const GrProcOptInfo& colorPOI,
+ const GrProcOptInfo& coveragePOI,
+ bool hasMixedSamples) const override;
+
+ bool onIsEqual(const GrXPFactory& /*xpfBase*/) const override {
+ return true;
+ }
+
+ GR_DECLARE_XP_FACTORY_TEST;
+
+ typedef GrXPFactory INHERITED;
+};
+
+namespace GrPorterDuffXPFactory {
+ const GrSrcOverPDXPFactory gSrcOverPDXPFactory;
+
+ inline const GrXPFactory* Create(SkXfermode::Mode mode) {
+ if (SkXfermode::kSrcOver_Mode == mode) {
+ return SkRef(&gSrcOverPDXPFactory);
+ }
+ return GrPDXPFactory::Create(mode);
+ }
+};
+
#endif
« no previous file with comments | « include/gpu/effects/GrCustomXfermode.h ('k') | src/core/SkXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698