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

Unified Diff: src/gpu/GrPipelineBuilder.h

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/GrPaint.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 cccbc2c47de3325e86f4daf61195cc5b844250ad..a7556eb59d5177e9948b52e4c3c1b0063dcc300e 100644
--- a/src/gpu/GrPipelineBuilder.h
+++ b/src/gpu/GrPipelineBuilder.h
@@ -16,6 +16,7 @@
#include "GrUserStencilSettings.h"
#include "GrXferProcessor.h"
#include "SkMatrix.h"
+#include "SkRefCnt.h"
#include "effects/GrCoverageSetOpXP.h"
#include "effects/GrDisableColorXP.h"
#include "effects/GrPorterDuffXferProcessor.h"
@@ -56,47 +57,43 @@ public:
this->numCoverageFragmentProcessors(); }
const GrFragmentProcessor* getColorFragmentProcessor(int idx) const {
- return fColorFragmentProcessors[idx];
+ return fColorFragmentProcessors[idx].get();
}
const GrFragmentProcessor* getCoverageFragmentProcessor(int idx) const {
- return fCoverageFragmentProcessors[idx];
+ return fCoverageFragmentProcessors[idx].get();
}
- const GrFragmentProcessor* addColorFragmentProcessor(const GrFragmentProcessor* processor) {
+ void addColorFragmentProcessor(sk_sp<GrFragmentProcessor> processor) {
SkASSERT(processor);
- fColorFragmentProcessors.push_back(SkRef(processor));
- return processor;
+ fColorFragmentProcessors.push_back(std::move(processor));
}
- const GrFragmentProcessor* addCoverageFragmentProcessor(const GrFragmentProcessor* processor) {
+ void addCoverageFragmentProcessor(sk_sp<GrFragmentProcessor> processor) {
SkASSERT(processor);
- fCoverageFragmentProcessors.push_back(SkRef(processor));
- return processor;
+ fCoverageFragmentProcessors.push_back(std::move(processor));
}
/**
* Creates a GrSimpleTextureEffect that uses local coords as texture coordinates.
*/
void addColorTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
- this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
+ this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(texture, matrix));
}
void addCoverageTextureProcessor(GrTexture* texture, const SkMatrix& matrix) {
- this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix))->unref();
+ this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(texture, matrix));
}
void addColorTextureProcessor(GrTexture* texture,
const SkMatrix& matrix,
const GrTextureParams& params) {
- this->addColorFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix,
- params))->unref();
+ this->addColorFragmentProcessor(GrSimpleTextureEffect::Make(texture, matrix, params));
}
void addCoverageTextureProcessor(GrTexture* texture,
const SkMatrix& matrix,
const GrTextureParams& params) {
- this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Create(texture, matrix,
- params))->unref();
+ this->addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(texture, matrix, params));
}
/**
@@ -125,10 +122,9 @@ public:
bool isSet() const { return SkToBool(fPipelineBuilder); }
- const GrFragmentProcessor* addCoverageFragmentProcessor(
- const GrFragmentProcessor* processor) {
+ void addCoverageFragmentProcessor(sk_sp<GrFragmentProcessor> processor) {
SkASSERT(this->isSet());
- return fPipelineBuilder->addCoverageFragmentProcessor(processor);
+ return fPipelineBuilder->addCoverageFragmentProcessor(std::move(processor));
}
private:
@@ -148,9 +144,8 @@ public:
* Installs a GrXPFactory. This object controls how src color, fractional pixel coverage,
* and the dst color are blended.
*/
- const GrXPFactory* setXPFactory(const GrXPFactory* xpFactory) {
- fXPFactory.reset(SkSafeRef(xpFactory));
- return xpFactory;
+ void setXPFactory(sk_sp<GrXPFactory> xpFactory) {
+ fXPFactory = std::move(xpFactory);
}
/**
@@ -158,11 +153,11 @@ public:
* rendering to the stencil buffer.
*/
void setDisableColorXPFactory() {
- fXPFactory.reset(GrDisableColorXPFactory::Create());
+ fXPFactory = GrDisableColorXPFactory::Make();
}
const GrXPFactory* getXPFactory() const {
- return fXPFactory;
+ return fXPFactory.get();
}
/**
@@ -304,12 +299,12 @@ private:
// This is used to assert that this condition holds.
SkDEBUGCODE(mutable int fBlockEffectRemovalCnt;)
- typedef SkSTArray<4, const GrFragmentProcessor*, true> FragmentProcessorArray;
+ typedef SkSTArray<4, sk_sp<GrFragmentProcessor>> FragmentProcessorArray;
uint32_t fFlags;
const GrUserStencilSettings* fUserStencilSettings;
DrawFace fDrawFace;
- mutable SkAutoTUnref<const GrXPFactory> fXPFactory;
+ mutable sk_sp<GrXPFactory> fXPFactory;
FragmentProcessorArray fColorFragmentProcessors;
FragmentProcessorArray fCoverageFragmentProcessors;
« no previous file with comments | « src/gpu/GrPaint.cpp ('k') | src/gpu/GrPipelineBuilder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698