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

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

Issue 1389063002: Revert of factories should return baseclass, allowing the impl to specialize (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 unified diff | Download patch
« no previous file with comments | « include/effects/SkBlurImageFilter.h ('k') | include/effects/SkMergeImageFilter.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 17
18 kLast_ShadowMode = kDrawShadowOnly_ShadowMode 18 kLast_ShadowMode = kDrawShadowOnly_ShadowMode
19 }; 19 };
20 20
21 static const int kShadowModeCount = kLast_ShadowMode+1; 21 static const int kShadowModeCount = kLast_ShadowMode+1;
22 22
23 static SkImageFilter* Create(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkSc alar sigmaY, 23 static SkDropShadowImageFilter* Create(SkScalar dx, SkScalar dy,
24 SkColor color, ShadowMode shadowMode, SkImageFi lter* input = NULL, 24 SkScalar sigmaX, SkScalar sigmaY, SkC olor color,
25 const CropRect* cropRect = NULL) { 25 ShadowMode shadowMode,
26 SkImageFilter* input = NULL,
27 const CropRect* cropRect = NULL) {
26 return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadow Mode, input, 28 return new SkDropShadowImageFilter(dx, dy, sigmaX, sigmaY, color, shadow Mode, input,
27 cropRect); 29 cropRect);
28 } 30 }
29 31
30 void computeFastBounds(const SkRect&, SkRect*) const override; 32 void computeFastBounds(const SkRect&, SkRect*) const override;
31 SK_TO_STRING_OVERRIDE() 33 SK_TO_STRING_OVERRIDE()
32 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter) 34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDropShadowImageFilter)
33 35
34 protected: 36 protected:
37 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
38 ShadowMode shadowMode, SkImageFilter* input, const C ropRect* cropRect);
35 void flatten(SkWriteBuffer&) const override; 39 void flatten(SkWriteBuffer&) const override;
36 bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, SkBitmap* result, 40 bool onFilterImage(Proxy*, const SkBitmap& source, const Context&, SkBitmap* result, SkIPoint* loc) const override;
37 SkIPoint* loc) const override; 41 virtual bool onFilterBounds(const SkIRect& src, const SkMatrix&,
38 bool onFilterBounds(const SkIRect& src, const SkMatrix&, SkIRect* dst) const override; 42 SkIRect* dst) const override;
39 43
40 private: 44 private:
41 SkDropShadowImageFilter(SkScalar dx, SkScalar dy, SkScalar sigmaX, SkScalar sigmaY, SkColor,
42 ShadowMode shadowMode, SkImageFilter* input, const C ropRect* cropRect);
43
44 SkScalar fDx, fDy, fSigmaX, fSigmaY; 45 SkScalar fDx, fDy, fSigmaX, fSigmaY;
45 SkColor fColor; 46 SkColor fColor;
46 ShadowMode fShadowMode; 47 ShadowMode fShadowMode;
47
48 typedef SkImageFilter INHERITED; 48 typedef SkImageFilter INHERITED;
49 }; 49 };
OLDNEW
« no previous file with comments | « include/effects/SkBlurImageFilter.h ('k') | include/effects/SkMergeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698