OLD | NEW |
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 SkBitmapSource_DEFINED | 8 #ifndef SkBitmapSource_DEFINED |
9 #define SkBitmapSource_DEFINED | 9 #define SkBitmapSource_DEFINED |
10 | 10 |
11 #include "SkImageFilter.h" | 11 #include "SkImageFilter.h" |
12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
13 | 13 |
14 class SK_API SkBitmapSource : public SkImageFilter { | 14 class SK_API SkBitmapSource : public SkImageFilter { |
15 public: | 15 public: |
16 static SkBitmapSource* Create(const SkBitmap& bitmap) { | 16 static SkBitmapSource* Create(const SkBitmap& bitmap) { |
17 return SkNEW_ARGS(SkBitmapSource, (bitmap)); | 17 return SkNEW_ARGS(SkBitmapSource, (bitmap)); |
18 } | 18 } |
19 static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect, | 19 static SkBitmapSource* Create(const SkBitmap& bitmap, const SkRect& srcRect, |
20 const SkRect& dstRect) { | 20 const SkRect& dstRect) { |
21 return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect)); | 21 return SkNEW_ARGS(SkBitmapSource, (bitmap, srcRect, dstRect)); |
22 } | 22 } |
23 virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVER
RIDE; | 23 virtual void computeFastBounds(const SkRect& src, SkRect* dst) const SK_OVER
RIDE; |
24 | 24 |
25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) | 25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) |
26 | 26 |
27 protected: | 27 protected: |
28 explicit SkBitmapSource(const SkBitmap& bitmap); | 28 explicit SkBitmapSource(const SkBitmap& bitmap); |
29 SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect&
dstRect); | 29 SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, const SkRect&
dstRect); |
30 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | |
31 explicit SkBitmapSource(SkReadBuffer& buffer); | |
32 #endif | |
33 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; | 30 virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE; |
34 | 31 |
35 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | 32 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
36 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; | 33 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE; |
37 | 34 |
38 private: | 35 private: |
39 SkBitmap fBitmap; | 36 SkBitmap fBitmap; |
40 SkRect fSrcRect, fDstRect; | 37 SkRect fSrcRect, fDstRect; |
41 typedef SkImageFilter INHERITED; | 38 typedef SkImageFilter INHERITED; |
42 }; | 39 }; |
43 | 40 |
44 #endif | 41 #endif |
OLD | NEW |