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

Unified Diff: include/core/SkPaint.h

Issue 1770723002: Add variants of the setters on SkPaint which take a sk_sp<effect> (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPaint.h
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index 7090f3e2499f3f68255ae1fc3e641e9e37f1dd81..39ee1e0de1d9b98a1b7b7c005ebd8bb44dc5522d 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -476,7 +476,7 @@ public:
The shader's reference count is not affected.
@return the paint's shader (or NULL)
*/
- SkShader* getShader() const { return fShader; }
+ SkShader* getShader() const { return fShader.get(); }
/** Set or clear the shader object.
* Shaders specify the source color(s) for what is being drawn. If a paint
@@ -500,12 +500,13 @@ public:
* @return shader
*/
SkShader* setShader(SkShader* shader);
+ void setShader(sk_sp<SkShader>);
/** Get the paint's colorfilter. If there is a colorfilter, its reference
count is not changed.
@return the paint's colorfilter (or NULL)
*/
- SkColorFilter* getColorFilter() const { return fColorFilter; }
+ SkColorFilter* getColorFilter() const { return fColorFilter.get(); }
/** Set or clear the paint's colorfilter, returning the parameter.
<p />
@@ -515,13 +516,14 @@ public:
@return filter
*/
SkColorFilter* setColorFilter(SkColorFilter* filter);
+ void setColorFilter(sk_sp<SkColorFilter>);
/** Get the paint's xfermode object.
<p />
The xfermode's reference count is not affected.
@return the paint's xfermode (or NULL)
*/
- SkXfermode* getXfermode() const { return fXfermode; }
+ SkXfermode* getXfermode() const { return fXfermode.get(); }
/** Set or clear the xfermode object.
<p />
@@ -534,6 +536,7 @@ public:
@return xfermode
*/
SkXfermode* setXfermode(SkXfermode* xfermode);
+ void setXfermode(sk_sp<SkXfermode>);
/** Create an xfermode based on the specified Mode, and assign it into the
paint, returning the mode that was set. If the Mode is SrcOver, then
@@ -546,7 +549,7 @@ public:
The patheffect reference count is not affected.
@return the paint's patheffect (or NULL)
*/
- SkPathEffect* getPathEffect() const { return fPathEffect; }
+ SkPathEffect* getPathEffect() const { return fPathEffect.get(); }
/** Set or clear the patheffect object.
<p />
@@ -559,13 +562,14 @@ public:
@return effect
*/
SkPathEffect* setPathEffect(SkPathEffect* effect);
+ void setPathEffect(sk_sp<SkPathEffect>);
/** Get the paint's maskfilter object.
<p />
The maskfilter reference count is not affected.
@return the paint's maskfilter (or NULL)
*/
- SkMaskFilter* getMaskFilter() const { return fMaskFilter; }
+ SkMaskFilter* getMaskFilter() const { return fMaskFilter.get(); }
/** Set or clear the maskfilter object.
<p />
@@ -578,6 +582,7 @@ public:
@return maskfilter
*/
SkMaskFilter* setMaskFilter(SkMaskFilter* maskfilter);
+ void setMaskFilter(sk_sp<SkMaskFilter>);
// These attributes are for text/fonts
@@ -587,7 +592,7 @@ public:
measuring text. The typeface reference count is not affected.
@return the paint's typeface (or NULL)
*/
- SkTypeface* getTypeface() const { return fTypeface; }
+ SkTypeface* getTypeface() const { return fTypeface.get(); }
/** Set or clear the typeface object.
<p />
@@ -600,13 +605,14 @@ public:
@return typeface
*/
SkTypeface* setTypeface(SkTypeface* typeface);
+ void setTypeface(sk_sp<SkTypeface>);
/** Get the paint's rasterizer (or NULL).
<p />
The raster controls how paths/text are turned into alpha masks.
@return the paint's rasterizer (or NULL)
*/
- SkRasterizer* getRasterizer() const { return fRasterizer; }
+ SkRasterizer* getRasterizer() const { return fRasterizer.get(); }
/** Set or clear the rasterizer object.
<p />
@@ -620,15 +626,17 @@ public:
@return rasterizer
*/
SkRasterizer* setRasterizer(SkRasterizer* rasterizer);
+ void setRasterizer(sk_sp<SkRasterizer>);
- SkImageFilter* getImageFilter() const { return fImageFilter; }
+ SkImageFilter* getImageFilter() const { return fImageFilter.get(); }
SkImageFilter* setImageFilter(SkImageFilter*);
+ void setImageFilter(sk_sp<SkImageFilter>);
/**
* Return the paint's SkDrawLooper (if any). Does not affect the looper's
* reference count.
*/
- SkDrawLooper* getLooper() const { return fLooper; }
+ SkDrawLooper* getLooper() const { return fLooper.get(); }
/**
* Set or clear the looper object.
@@ -642,6 +650,7 @@ public:
* @return looper
*/
SkDrawLooper* setLooper(SkDrawLooper* looper);
+ void setLooper(sk_sp<SkDrawLooper>);
enum Align {
kLeft_Align,
@@ -1026,15 +1035,15 @@ public:
SK_TO_STRING_NONVIRT()
private:
- SkTypeface* fTypeface;
- SkPathEffect* fPathEffect;
- SkShader* fShader;
- SkXfermode* fXfermode;
- SkMaskFilter* fMaskFilter;
- SkColorFilter* fColorFilter;
- SkRasterizer* fRasterizer;
- SkDrawLooper* fLooper;
- SkImageFilter* fImageFilter;
+ sk_sp<SkTypeface> fTypeface;
+ sk_sp<SkPathEffect> fPathEffect;
+ sk_sp<SkShader> fShader;
+ sk_sp<SkXfermode> fXfermode;
+ sk_sp<SkMaskFilter> fMaskFilter;
+ sk_sp<SkColorFilter> fColorFilter;
+ sk_sp<SkRasterizer> fRasterizer;
+ sk_sp<SkDrawLooper> fLooper;
+ sk_sp<SkImageFilter> fImageFilter;
SkScalar fTextSize;
SkScalar fTextScaleX;
« no previous file with comments | « no previous file | src/core/SkPaint.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698