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

Side by Side Diff: include/effects/SkDropShadowImageFilter.h

Issue 789163006: Add toString methods to SkImageFilter-derived classes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Make sure leading 0's aren't stripped off colors Created 6 years 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 unified diff | Download patch
« no previous file with comments | « include/effects/SkDisplacementMapEffect.h ('k') | include/effects/SkMagnifierImageFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkColor.h" 8 #include "SkColor.h"
9 #include "SkImageFilter.h" 9 #include "SkImageFilter.h"
10 #include "SkScalar.h" 10 #include "SkScalar.h"
11 11
12 class SK_API SkDropShadowImageFilter : public SkImageFilter { 12 class SK_API SkDropShadowImageFilter : public SkImageFilter {
13 public: 13 public:
14 enum ShadowMode { 14 enum ShadowMode {
15 kDrawShadowAndForeground_ShadowMode, 15 kDrawShadowAndForeground_ShadowMode,
16 kDrawShadowOnly_ShadowMode 16 kDrawShadowOnly_ShadowMode,
17
18 kLast_ShadowMode = kDrawShadowOnly_ShadowMode
17 }; 19 };
18 20
21 static const int kShadowModeCount = kLast_ShadowMode+1;
22
19 /** @deprecated use another Create function below instead */ 23 /** @deprecated use another Create function below instead */
20 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, 24 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
21 SkScalar sigmaX, SkScalar sigmaY, SkC olor color, 25 SkScalar sigmaX, SkScalar sigmaY, SkC olor color,
22 SkImageFilter* input = NULL, 26 SkImageFilter* input = NULL,
23 const CropRect* cropRect = NULL, 27 const CropRect* cropRect = NULL,
24 uint32_t uniqueID = 0) { 28 uint32_t uniqueID = 0) {
25 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r, 29 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r,
26 kDrawShadowAndForeground_Sha dowMode, 30 kDrawShadowAndForeground_Sha dowMode,
27 input, cropRect, uniqueID)); 31 input, cropRect, uniqueID));
28 } 32 }
29 33
30 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, 34 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
31 SkScalar sigmaX, SkScalar sigmaY, SkC olor color, 35 SkScalar sigmaX, SkScalar sigmaY, SkC olor color,
32 ShadowMode shadowMode, 36 ShadowMode shadowMode,
33 SkImageFilter* input, 37 SkImageFilter* input,
34 const CropRect* cropRect, 38 const CropRect* cropRect,
35 uint32_t uniqueID) { 39 uint32_t uniqueID) {
36 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r, 40 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r,
37 shadowMode, input, cropRect, uniqueID)); 41 shadowMode, input, cropRect, uniqueID));
38 } 42 }
39 43
40 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy, 44 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
41 SkScalar sigmaX, SkScalar sigmaY, SkC olor color, 45 SkScalar sigmaX, SkScalar sigmaY, SkC olor color,
42 ShadowMode shadowMode) { 46 ShadowMode shadowMode) {
43 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r, 47 return SkNEW_ARGS(SkDropShadowImageFilter, (dx, dy, sigmaX, sigmaY, colo r,
44 shadowMode, NULL, NULL, 0)); 48 shadowMode, NULL, NULL, 0));
45 } 49 }
46 50
47 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE; 51 virtual void computeFastBounds(const SkRect&, SkRect*) const SK_OVERRIDE;
52 SK_TO_STRING_OVERRIDE()
48 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) 53 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
49 54
50 protected: 55 protected:
51 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor, 56 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
52 ShadowMode shadowMode, SkImageFilter* input, const C ropRect* cropRect, 57 ShadowMode shadowMode, SkImageFilter* input, const C ropRect* cropRect,
53 uint32_t uniqueID); 58 uint32_t uniqueID);
54 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 59 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
55 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, S kBitmap* result, SkIPoint* loc) const SK_OVERRIDE; 60 virtual bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, S kBitmap* result, SkIPoint* loc) const SK_OVERRIDE;
56 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&, 61 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
57 SkIRect* dst) const SK_OVERRIDE; 62 SkIRect* dst) const SK_OVERRIDE;
58 63
59 private: 64 private:
60 SkScalar fDx, fDy, fSigmaX, fSigmaY; 65 SkScalar fDx, fDy, fSigmaX, fSigmaY;
61 SkColor fColor; 66 SkColor fColor;
62 ShadowMode fShadowMode; 67 ShadowMode fShadowMode;
63 typedef SkImageFilter INHERITED; 68 typedef SkImageFilter INHERITED;
64 }; 69 };
OLDNEW
« no previous file with comments | « include/effects/SkDisplacementMapEffect.h ('k') | include/effects/SkMagnifierImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698