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

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

Issue 182983003: Factory methods for heap-allocated SkImageFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years, 9 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/SkOffsetImageFilter.h ('k') | include/effects/SkResizeImageFilter.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 The Android Open Source Project 2 * Copyright 2013 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 SkPictureImageFilter_DEFINED 8 #ifndef SkPictureImageFilter_DEFINED
9 #define SkPictureImageFilter_DEFINED 9 #define SkPictureImageFilter_DEFINED
10 10
11 #include "SkImageFilter.h" 11 #include "SkImageFilter.h"
12 #include "SkPicture.h" 12 #include "SkPicture.h"
13 13
14 class SK_API SkPictureImageFilter : public SkImageFilter { 14 class SK_API SkPictureImageFilter : public SkImageFilter {
15 public: 15 public:
16 /** 16 /**
17 * Refs the passed-in picture. 17 * Refs the passed-in picture.
18 */ 18 */
19 explicit SkPictureImageFilter(SkPicture* picture); 19 static SkPictureImageFilter* Create(SkPicture* picture) {
20 return SkNEW_ARGS(SkPictureImageFilter, (picture));
21 }
20 22
21 /** 23 /**
22 * Refs the passed-in picture. rect can be used to crop or expand the desti nation rect when 24 * Refs the passed-in picture. cropRect can be used to crop or expand the d estination rect when
23 * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.) 25 * the picture is drawn. (No scaling is implied by the dest rect; only the CTM is applied.)
24 */ 26 */
25 SkPictureImageFilter(SkPicture* picture, const SkRect& rect); 27 static SkPictureImageFilter* Create(SkPicture* picture, const SkRect& cropRe ct) {
28 return SkNEW_ARGS(SkPictureImageFilter, (picture, cropRect));
29 }
26 30
27 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter) 31 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPictureImageFilter)
28 32
29 protected: 33 protected:
30 virtual ~SkPictureImageFilter(); 34 virtual ~SkPictureImageFilter();
31 /* Constructs an SkPictureImageFilter object from an SkReadBuffer. 35 /* Constructs an SkPictureImageFilter object from an SkReadBuffer.
32 * Note: If the SkPictureImageFilter object construction requires bitmap 36 * Note: If the SkPictureImageFilter object construction requires bitmap
33 * decoding, the decoder must be set on the SkReadBuffer parameter by calli ng 37 * decoding, the decoder must be set on the SkReadBuffer parameter by calli ng
34 * SkReadBuffer::setBitmapDecoder() before calling this constructor. 38 * SkReadBuffer::setBitmapDecoder() before calling this constructor.
35 * @param SkReadBuffer Serialized picture data. 39 * @param SkReadBuffer Serialized picture data.
36 */ 40 */
37 explicit SkPictureImageFilter(SkReadBuffer&); 41 explicit SkPictureImageFilter(SkReadBuffer&);
38 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; 42 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
39 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&, 43 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const SkMatrix&,
40 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE; 44 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE;
41 45
46 #ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
47 public:
48 #endif
49 explicit SkPictureImageFilter(SkPicture* picture);
50 SkPictureImageFilter(SkPicture* picture, const SkRect& cropRect);
51
42 private: 52 private:
43 SkPicture* fPicture; 53 SkPicture* fPicture;
44 SkRect fRect; 54 SkRect fCropRect;
45 typedef SkImageFilter INHERITED; 55 typedef SkImageFilter INHERITED;
46 }; 56 };
47 57
48 #endif 58 #endif
OLDNEW
« no previous file with comments | « include/effects/SkOffsetImageFilter.h ('k') | include/effects/SkResizeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698