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

Unified Diff: include/gpu/GrPaint.h

Issue 866573002: XPFactory lazily initializie in drawstate / GrPaint (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup Created 5 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/gpu/GrContext.h ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrPaint.h
diff --git a/include/gpu/GrPaint.h b/include/gpu/GrPaint.h
index 6f8528234e924d159bc093c7a37aea1d65c76090..8163f6e4d8a4a23189293966e2017d2f0c28852b 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -45,7 +45,7 @@
*/
class GrPaint {
public:
- GrPaint() { this->reset(); }
+ GrPaint();
GrPaint(const GrPaint& paint) { *this = paint; }
@@ -113,7 +113,12 @@ public:
int numCoverageStages() const { return fCoverageStages.count(); }
int numTotalStages() const { return this->numColorStages() + this->numCoverageStages(); }
- const GrXPFactory* getXPFactory() const { return fXPFactory.get(); }
+ const GrXPFactory* getXPFactory() const {
+ if (!fXPFactory) {
+ fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode));
+ }
+ return fXPFactory.get();
+ }
const GrFragmentStage& getColorStage(int s) const { return fColorStages[s]; }
const GrFragmentStage& getCoverageStage(int s) const { return fCoverageStages[s]; }
@@ -133,22 +138,13 @@ public:
}
/**
- * Resets the paint to the defaults.
- */
- void reset() {
- this->resetOptions();
- this->resetColor();
- this->resetStages();
- }
-
- /**
* Returns true if isOpaque would return true and the paint represents a solid constant color
* draw. If the result is true, constantColor will be updated to contain the constant color.
*/
bool isOpaqueAndConstantColor(GrColor* constantColor) const;
private:
- SkAutoTUnref<const GrXPFactory> fXPFactory;
+ mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
SkSTArray<4, GrFragmentStage> fColorStages;
SkSTArray<2, GrFragmentStage> fCoverageStages;
@@ -156,17 +152,6 @@ private:
bool fDither;
GrColor fColor;
-
- void resetOptions() {
- fAntiAlias = false;
- fDither = false;
- }
-
- void resetColor() {
- fColor = GrColorPackRGBA(0xff, 0xff, 0xff, 0xff);
- }
-
- void resetStages();
};
#endif
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698