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

Unified Diff: include/gpu/GrPaint.h

Issue 1306803003: Revert of Remove GrStagedProcessor, remove the word Stage as it applies to FPs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/GrFragmentProcessor.h ('k') | include/gpu/GrStagedProcessor.h » ('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 30138633c951a7249b31fac142c629b3656fef37..e4b2b099d18737faed35fec26278650fd608958f 100644
--- a/include/gpu/GrPaint.h
+++ b/include/gpu/GrPaint.h
@@ -11,6 +11,7 @@
#define GrPaint_DEFINED
#include "GrColor.h"
+#include "GrStagedProcessor.h"
#include "GrProcessorDataManager.h"
#include "GrXferProcessor.h"
#include "effects/GrPorterDuffXferProcessor.h"
@@ -43,7 +44,7 @@
GrPaint(const GrPaint& paint) { *this = paint; }
- ~GrPaint() { this->resetFragmentProcessors(); }
+ ~GrPaint() {}
/**
* The initial color of the drawn primitive. Defaults to solid white.
@@ -77,18 +78,18 @@
/**
* Appends an additional color processor to the color computation.
*/
- const GrFragmentProcessor* addColorFragmentProcessor(const GrFragmentProcessor* fp) {
+ const GrFragmentProcessor* addColorProcessor(const GrFragmentProcessor* fp) {
SkASSERT(fp);
- fColorFragmentProcessors.push_back(SkRef(fp));
+ SkNEW_APPEND_TO_TARRAY(&fColorStages, GrFragmentStage, (fp));
return fp;
}
/**
* Appends an additional coverage processor to the coverage computation.
*/
- const GrFragmentProcessor* addCoverageFragmentProcessor(const GrFragmentProcessor* fp) {
+ const GrFragmentProcessor* addCoverageProcessor(const GrFragmentProcessor* fp) {
SkASSERT(fp);
- fCoverageFragmentProcessors.push_back(SkRef(fp));
+ SkNEW_APPEND_TO_TARRAY(&fCoverageStages, GrFragmentStage, (fp));
return fp;
}
@@ -101,10 +102,9 @@
void addColorTextureProcessor(GrTexture*, const SkMatrix&, const GrTextureParams&);
void addCoverageTextureProcessor(GrTexture*, const SkMatrix&, const GrTextureParams&);
- int numColorFragmentProcessors() const { return fColorFragmentProcessors.count(); }
- int numCoverageFragmentProcessors() const { return fCoverageFragmentProcessors.count(); }
- int numTotalFragmentProcessors() const { return this->numColorFragmentProcessors() +
- this->numCoverageFragmentProcessors(); }
+ int numColorStages() const { return fColorStages.count(); }
+ int numCoverageStages() const { return fCoverageStages.count(); }
+ int numTotalStages() const { return this->numColorStages() + this->numCoverageStages(); }
const GrXPFactory* getXPFactory() const {
if (!fXPFactory) {
@@ -113,27 +113,17 @@
return fXPFactory.get();
}
- const GrFragmentProcessor* getColorFragmentProcessor(int i) const {
- return fColorFragmentProcessors[i];
- }
- const GrFragmentProcessor* getCoverageFragmentProcessor(int i) const {
- return fCoverageFragmentProcessors[i];
- }
+ const GrFragmentStage& getColorStage(int s) const { return fColorStages[s]; }
+ const GrFragmentStage& getCoverageStage(int s) const { return fCoverageStages[s]; }
GrPaint& operator=(const GrPaint& paint) {
fAntiAlias = paint.fAntiAlias;
fDither = paint.fDither;
fColor = paint.fColor;
- this->resetFragmentProcessors();
- fColorFragmentProcessors = paint.fColorFragmentProcessors;
- fCoverageFragmentProcessors = paint.fCoverageFragmentProcessors;
- for (int i = 0; i < fColorFragmentProcessors.count(); ++i) {
- fColorFragmentProcessors[i]->ref();
- }
- for (int i = 0; i < fColorFragmentProcessors.count(); ++i) {
- fColorFragmentProcessors[i]->ref();
- }
+
+ fColorStages = paint.fColorStages;
+ fCoverageStages = paint.fCoverageStages;
fXPFactory.reset(SkRef(paint.getXPFactory()));
fProcDataManager.reset(SkNEW_ARGS(GrProcessorDataManager, (*paint.processorDataManager())));
@@ -154,26 +144,15 @@
const GrProcessorDataManager* processorDataManager() const { return fProcDataManager.get(); }
private:
- void resetFragmentProcessors() {
- for (int i = 0; i < fColorFragmentProcessors.count(); ++i) {
- fColorFragmentProcessors[i]->unref();
- }
- for (int i = 0; i < fCoverageFragmentProcessors.count(); ++i) {
- fCoverageFragmentProcessors[i]->unref();
- }
- fColorFragmentProcessors.reset();
- fCoverageFragmentProcessors.reset();
- }
+ mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
+ SkSTArray<4, GrFragmentStage> fColorStages;
+ SkSTArray<2, GrFragmentStage> fCoverageStages;
- mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
- SkSTArray<4, const GrFragmentProcessor*, true> fColorFragmentProcessors;
- SkSTArray<2, const GrFragmentProcessor*, true> fCoverageFragmentProcessors;
+ bool fAntiAlias;
+ bool fDither;
- bool fAntiAlias;
- bool fDither;
-
- GrColor fColor;
- SkAutoTUnref<GrProcessorDataManager> fProcDataManager;
+ GrColor fColor;
+ SkAutoTUnref<GrProcessorDataManager> fProcDataManager;
};
#endif
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | include/gpu/GrStagedProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698