OLD | NEW |
| (Empty) |
1 /* | |
2 * Copyright 2012 The Android Open Source Project | |
3 * | |
4 * Use of this source code is governed by a BSD-style license that can be | |
5 * found in the LICENSE file. | |
6 */ | |
7 | |
8 #ifndef SkBitmapSource_DEFINED | |
9 #define SkBitmapSource_DEFINED | |
10 | |
11 #include "SkImageFilter.h" | |
12 #include "SkBitmap.h" | |
13 | |
14 class SK_API SkBitmapSource : public SkImageFilter { | |
15 public: | |
16 static SkBitmapSource* Create(const SkBitmap& bitmap) { return new SkBitmapS
ource(bitmap); } | |
17 static SkBitmapSource* Create(const SkBitmap& bitmap, | |
18 const SkRect& srcRect, const SkRect& dstRect, | |
19 SkFilterQuality filterQuality = kHigh_SkFilter
Quality) { | |
20 return new SkBitmapSource(bitmap, srcRect, dstRect, filterQuality); | |
21 } | |
22 void computeFastBounds(const SkRect& src, SkRect* dst) const override; | |
23 | |
24 SK_TO_STRING_OVERRIDE() | |
25 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) | |
26 | |
27 protected: | |
28 explicit SkBitmapSource(const SkBitmap& bitmap); | |
29 SkBitmapSource(const SkBitmap& bitmap, | |
30 const SkRect& srcRect, const SkRect& dstRect, | |
31 SkFilterQuality filterQuality); | |
32 void flatten(SkWriteBuffer&) const override; | |
33 | |
34 bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, | |
35 SkBitmap* result, SkIPoint* offset) const override; | |
36 | |
37 private: | |
38 SkBitmap fBitmap; | |
39 SkRect fSrcRect, fDstRect; | |
40 SkFilterQuality fFilterQuality; | |
41 | |
42 typedef SkImageFilter INHERITED; | |
43 }; | |
44 | |
45 #endif | |
OLD | NEW |