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

Side by Side Diff: include/effects/SkMergeImageFilter.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/SkDropShadowImageFilter.h ('k') | include/effects/SkMorphologyImageFilter.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 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
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 #ifndef SkMergeImageFilter_DEFINED 8 #ifndef SkMergeImageFilter_DEFINED
9 #define SkMergeImageFilter_DEFINED 9 #define SkMergeImageFilter_DEFINED
10 10
11 #include "SkImageFilter.h" 11 #include "SkImageFilter.h"
12 12
13 #include "SkXfermode.h" 13 #include "SkXfermode.h"
14 14
15 class SK_API SkMergeImageFilter : public SkImageFilter { 15 class SK_API SkMergeImageFilter : public SkImageFilter {
16 public: 16 public:
17 virtual ~SkMergeImageFilter(); 17 virtual ~SkMergeImageFilter();
18 18
19 static SkImageFilter* Create(SkImageFilter* first, SkImageFilter* second, 19 static SkMergeImageFilter* Create(SkImageFilter* first, SkImageFilter* secon d,
20 SkXfermode::Mode mode = SkXfermode::kSrcOver_Mo de, 20 SkXfermode::Mode mode = SkXfermode::kSrcOv er_Mode,
21 const CropRect* cropRect = NULL) { 21 const CropRect* cropRect = NULL) {
22 SkImageFilter* inputs[2] = { first, second }; 22 SkImageFilter* inputs[2] = { first, second };
23 SkXfermode::Mode modes[2] = { mode, mode }; 23 SkXfermode::Mode modes[2] = { mode, mode };
24 return new SkMergeImageFilter(inputs, 2, modes, cropRect); 24 return new SkMergeImageFilter(inputs, 2, modes, cropRect);
25 } 25 }
26 26 static SkMergeImageFilter* Create(SkImageFilter* filters[], int count,
27 static SkImageFilter* Create(SkImageFilter* filters[], int count, 27 const SkXfermode::Mode modes[] = NULL,
28 const SkXfermode::Mode modes[] = NULL, 28 const CropRect* cropRect = NULL) {
29 const CropRect* cropRect = NULL) {
30 return new SkMergeImageFilter(filters, count, modes, cropRect); 29 return new SkMergeImageFilter(filters, count, modes, cropRect);
31 } 30 }
32 31
33 SK_TO_STRING_OVERRIDE() 32 SK_TO_STRING_OVERRIDE()
34 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter) 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkMergeImageFilter)
35 34
36 protected: 35 protected:
36 SkMergeImageFilter(SkImageFilter* filters[], int count,
37 const SkXfermode::Mode modes[],
38 const CropRect* cropRect);
37 void flatten(SkWriteBuffer&) const override; 39 void flatten(SkWriteBuffer&) const override;
38 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, SkBitmap* re sult, 40
39 SkIPoint* loc) const override; 41 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&,
42 SkBitmap* result, SkIPoint* loc) const override;
40 43
41 private: 44 private:
42 SkMergeImageFilter(SkImageFilter* filters[], int count, const SkXfermode::Mo de modes[], 45 uint8_t* fModes; // SkXfermode::Mode
43 const CropRect* cropRect);
44
45 uint8_t* fModes; // SkXfermode::Mode
46 46
47 // private storage, to avoid dynamically allocating storage for our copy 47 // private storage, to avoid dynamically allocating storage for our copy
48 // of the modes (unless the count is so large we can't fit). 48 // of the modes (unless the count is so large we can't fit).
49 intptr_t fStorage[16]; 49 intptr_t fStorage[16];
50 50
51 void initAllocModes(); 51 void initAllocModes();
52 void initModes(const SkXfermode::Mode []); 52 void initModes(const SkXfermode::Mode []);
53 53
54 typedef SkImageFilter INHERITED; 54 typedef SkImageFilter INHERITED;
55 }; 55 };
56 56
57 #endif 57 #endif
OLDNEW
« no previous file with comments | « include/effects/SkDropShadowImageFilter.h ('k') | include/effects/SkMorphologyImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698