diff options
author | 2011-11-03 19:29:08 +0000 | |
---|---|---|
committer | 2011-11-03 19:29:08 +0000 | |
commit | 15356a68b2a87e3ab9fc49392d085a4201ffeb62 (patch) | |
tree | 62941587a106432b18bbcf86d3ef5ad19a5f3800 /src/core/SkPaint.cpp | |
parent | 3839ca146a896b5662a1fd0323334d6aa3d10290 (diff) |
experimental -- add SkImageFilter to paint. Not called yet.
git-svn-id: http://skia.googlecode.com/svn/trunk@2599 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPaint.cpp')
-rw-r--r-- | src/core/SkPaint.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 0c7cb33f86..ce08e0bc60 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -11,6 +11,7 @@ #include "SkColorFilter.h" #include "SkDrawLooper.h" #include "SkFontHost.h" +#include "SkImageFilter.h" #include "SkMaskFilter.h" #include "SkPathEffect.h" #include "SkRasterizer.h" @@ -55,6 +56,7 @@ SkPaint::SkPaint() { fColorFilter = NULL; fRasterizer = NULL; fLooper = NULL; + fImageFilter = NULL; fWidth = 0; #endif @@ -85,6 +87,7 @@ SkPaint::SkPaint(const SkPaint& src) { SkSafeRef(fColorFilter); SkSafeRef(fRasterizer); SkSafeRef(fLooper); + SkSafeRef(fImageFilter); } SkPaint::~SkPaint() { @@ -96,6 +99,7 @@ SkPaint::~SkPaint() { SkSafeUnref(fColorFilter); SkSafeUnref(fRasterizer); SkSafeUnref(fLooper); + SkSafeUnref(fImageFilter); } SkPaint& SkPaint::operator=(const SkPaint& src) { @@ -109,6 +113,7 @@ SkPaint& SkPaint::operator=(const SkPaint& src) { SkSafeRef(src.fColorFilter); SkSafeRef(src.fRasterizer); SkSafeRef(src.fLooper); + SkSafeRef(src.fImageFilter); SkSafeUnref(fTypeface); SkSafeUnref(fPathEffect); @@ -118,6 +123,7 @@ SkPaint& SkPaint::operator=(const SkPaint& src) { SkSafeUnref(fColorFilter); SkSafeUnref(fRasterizer); SkSafeUnref(fLooper); + SkSafeUnref(fImageFilter); #ifdef ANDROID uint32_t oldGenerationID = fGenerationID; @@ -356,6 +362,12 @@ SkDrawLooper* SkPaint::setLooper(SkDrawLooper* looper) { return looper; } +SkImageFilter* SkPaint::setImageFilter(SkImageFilter* imageFilter) { + SkRefCnt_SafeAssign(fImageFilter, imageFilter); + GEN_ID_INC; + return imageFilter; +} + /////////////////////////////////////////////////////////////////////////////// #include "SkGlyphCache.h" @@ -1859,3 +1871,21 @@ bool SkPaint::nothingToDraw() const { } +//////////// Move these to their own file soon. + +bool SkImageFilter::filterImage(const SkBitmap& src, const SkMatrix& matrix, + SkBitmap* result, SkIPoint* offset) { + SkASSERT(result); + SkASSERT(offset); + return this->onFilterImage(src, matrix, result, offset); +} + +bool SkImageFilter::onFilterImage(const SkBitmap& src, const SkMatrix&, + SkBitmap* result, SkIPoint* offset) { + return false; +} + +bool SkImageFilter::asABlur(SkSize* sigma) const { + return false; +} + |