aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects
diff options
context:
space:
mode:
authorGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-12-06 23:45:58 +0000
committerGravatar senorblanco@chromium.org <senorblanco@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2010-12-06 23:45:58 +0000
commit038aff623d9fd47946cd31685f74cf473f7c84f0 (patch)
tree9b5f5caae5b9fb8de931bb7ca25767aef8078c43 /include/effects
parent8cfdf01ff953b47fdd5c29ebd54fea8a7a9be83e (diff)
Patch by Mike Lawther (mikelawther@chromium.org).
The HTML5 canvas client of BlurDrawLooper needs the option to not apply the canvas transform to the blur offset. see http://www.whatwg.org/specs/web-apps/current-work/multipage/the-canvas-elemen... - "The shadowOffsetX and shadowOffsetY attributes specify the distance that the shadow will be offset in the positive horizontal and positive vertical distance respectively. Their values are in coordinate space units. They are not affected by the current transformation matrix." This patch is part of fixing http://code.google.com/p/chromium/issues/detail?id=64647. Review URL: http://codereview.appspot.com/3391041/ git-svn-id: http://skia.googlecode.com/svn/trunk@631 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/effects')
-rw-r--r--include/effects/SkBlurDrawLooper.h16
-rw-r--r--include/effects/SkBlurMaskFilter.h12
2 files changed, 26 insertions, 2 deletions
diff --git a/include/effects/SkBlurDrawLooper.h b/include/effects/SkBlurDrawLooper.h
index 028b2ebc8b..6f96ff633d 100644
--- a/include/effects/SkBlurDrawLooper.h
+++ b/include/effects/SkBlurDrawLooper.h
@@ -29,7 +29,19 @@ class SkMaskFilter;
*/
class SkBlurDrawLooper : public SkDrawLooper {
public:
- SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color);
+ enum BlurFlags {
+ kNone_BlurFlag = 0x00,
+ /**
+ The blur layer's dx/dy/radius aren't affected by the canvas
+ transform.
+ */
+ kIgnoreTransform_BlurFlag = 0x01,
+ /** mask for all blur flags */
+ kAll_BlurFlag = 0x01
+ };
+
+ SkBlurDrawLooper(SkScalar radius, SkScalar dx, SkScalar dy, SkColor color,
+ uint32_t flags = kNone_BlurFlag);
virtual ~SkBlurDrawLooper();
// overrides from SkDrawLooper
@@ -41,6 +53,7 @@ public:
return SkNEW_ARGS(SkBlurDrawLooper, (buffer));
}
+
protected:
SkBlurDrawLooper(SkFlattenableReadBuffer&);
// overrides from SkFlattenable
@@ -55,6 +68,7 @@ private:
SkColor fBlurColor;
SkColor fSavedColor; // remember the original
int fSaveCount;
+ uint32_t fBlurFlags;
enum State {
kBeforeEdge,
diff --git a/include/effects/SkBlurMaskFilter.h b/include/effects/SkBlurMaskFilter.h
index b90ea5e49e..0a68f54041 100644
--- a/include/effects/SkBlurMaskFilter.h
+++ b/include/effects/SkBlurMaskFilter.h
@@ -32,12 +32,22 @@ public:
kBlurStyleCount
};
+ enum BlurFlags {
+ kNone_BlurFlag = 0x00,
+ /** The blur layer's radius is not affected by transforms */
+ kIgnoreTransform_BlurFlag = 0x01,
+ /** mask for all blur flags */
+ kAll_BlurFlag = 0x01
+ };
+
/** Create a blur maskfilter.
@param radius The radius to extend the blur from the original mask. Must be > 0.
@param style The BlurStyle to use
+ @param flags Flags to use - defaults to none
@return The new blur maskfilter
*/
- static SkMaskFilter* Create(SkScalar radius, BlurStyle style);
+ static SkMaskFilter* Create(SkScalar radius, BlurStyle style,
+ uint32_t flags = kNone_BlurFlag);
/** Create an emboss maskfilter
@param direction array of 3 scalars [x, y, z] specifying the direction of the light source