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

Unified Diff: src/gpu/GrPipelineBuilder.h

Issue 1228763005: small cleanups after fixing const of GrPipelineBuilder on DrawTarget (Closed) Base URL: https://skia.googlesource.com/skia.git@const-fix3
Patch Set: tweaks Created 5 years, 5 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 | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrPipelineBuilder.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrPipelineBuilder.h
diff --git a/src/gpu/GrPipelineBuilder.h b/src/gpu/GrPipelineBuilder.h
index 60fcea86c8a233ef37a7c68f2f3993403583d125..dd3db6e092c8eb70d05a34a19a95b26d239543bc 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -109,30 +109,38 @@ public:
/**
* When this object is destroyed it will remove any color/coverage FPs from the pipeline builder
- * that were added after its constructor.
+ * and also remove any additions to the GrProcessorDataManager that were added after its
+ * constructor.
* This class can transiently modify its "const" GrPipelineBuilder object but will restore it
* when done - so it is notionally "const" correct.
*/
- class AutoRestoreFragmentProcessors : public ::SkNoncopyable {
+ class AutoRestoreFragmentProcessorState : public ::SkNoncopyable {
public:
- AutoRestoreFragmentProcessors()
+ AutoRestoreFragmentProcessorState()
: fPipelineBuilder(NULL)
, fColorEffectCnt(0)
- , fCoverageEffectCnt(0) {}
+ , fCoverageEffectCnt(0)
+ , fSaveMarker(0) {}
- AutoRestoreFragmentProcessors(GrPipelineBuilder* ds)
+ AutoRestoreFragmentProcessorState(const GrPipelineBuilder& ds)
: fPipelineBuilder(NULL)
, fColorEffectCnt(0)
- , fCoverageEffectCnt(0) {
- this->set(ds);
+ , fCoverageEffectCnt(0)
+ , fSaveMarker(0) {
+ this->set(&ds);
}
- ~AutoRestoreFragmentProcessors() { this->set(NULL); }
+ ~AutoRestoreFragmentProcessorState() { this->set(NULL); }
void set(const GrPipelineBuilder* ds);
bool isSet() const { return SkToBool(fPipelineBuilder); }
+ GrProcessorDataManager* getProcessorDataManager() {
+ SkASSERT(this->isSet());
+ return fPipelineBuilder->getProcessorDataManager();
+ }
+
const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* processor) {
SkASSERT(this->isSet());
return fPipelineBuilder->addCoverageProcessor(processor);
@@ -143,6 +151,7 @@ public:
GrPipelineBuilder* fPipelineBuilder;
int fColorEffectCnt;
int fCoverageEffectCnt;
+ uint32_t fSaveMarker;
};
/// @}
@@ -261,7 +270,7 @@ public:
public:
AutoRestoreStencil() : fPipelineBuilder(NULL) {}
- AutoRestoreStencil(const GrPipelineBuilder* ds) : fPipelineBuilder(NULL) { this->set(ds); }
+ AutoRestoreStencil(const GrPipelineBuilder& ds) : fPipelineBuilder(NULL) { this->set(&ds); }
~AutoRestoreStencil() { this->set(NULL); }
@@ -415,48 +424,6 @@ public:
GrProcessorDataManager* getProcessorDataManager() { return fProcDataManager.get(); }
const GrProcessorDataManager* processorDataManager() const { return fProcDataManager.get(); }
- /**
- * When this object is destroyed it will remove any additions to the GrProcessorDataManager
- * owned by the GrPipelineBuilder
- * This class can transiently modify its "const" GrPipelineBuilder object but will restore it
- * when done - so it is notionally "const" correct.
- */
- class AutoRestoreProcessorDataManager : public ::SkNoncopyable {
- public:
- AutoRestoreProcessorDataManager() : fPipelineBuilder(NULL), fSaveMarker(0) {}
-
- AutoRestoreProcessorDataManager(GrPipelineBuilder* ds)
- : fPipelineBuilder(NULL)
- , fSaveMarker(0) {
- this->set(ds);
- }
-
- ~AutoRestoreProcessorDataManager() { this->set(NULL); }
-
- void set(const GrPipelineBuilder* ds) {
- if (fPipelineBuilder) {
- fPipelineBuilder->getProcessorDataManager()->restoreToSaveMarker(/*fSaveMarker*/);
- }
- fPipelineBuilder = const_cast<GrPipelineBuilder*>(ds);
- if (ds) {
- fSaveMarker = ds->processorDataManager()->currentSaveMarker();
- }
- }
-
- bool isSet() const { return SkToBool(fPipelineBuilder); }
-
- GrProcessorDataManager* getProcessorDataManager() {
- SkASSERT(this->isSet());
- return fPipelineBuilder->getProcessorDataManager();
- }
-
- private:
- // notionally const (as marginalia)
- GrPipelineBuilder* fPipelineBuilder;
- uint32_t fSaveMarker;
- };
-
-
private:
// Calculating invariant color / coverage information is expensive, so we partially cache the
// results.
« no previous file with comments | « src/gpu/GrOvalRenderer.cpp ('k') | src/gpu/GrPipelineBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698