OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef SkBitmapController_DEFINED | 8 #ifndef SkBitmapController_DEFINED |
9 #define SkBitmapController_DEFINED | 9 #define SkBitmapController_DEFINED |
10 | 10 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkBitmapCache.h" | 12 #include "SkBitmapCache.h" |
13 #include "SkFilterQuality.h" | 13 #include "SkFilterQuality.h" |
14 #include "SkMatrix.h" | 14 #include "SkMatrix.h" |
15 | 15 |
16 class SkBitmapProvider; | 16 class SkBitmapProvider; |
17 | 17 |
18 /** | 18 /** |
19 * Handles request to scale, filter, and lock a bitmap to be rasterized. | 19 * Handles request to scale, filter, and lock a bitmap to be rasterized. |
20 */ | 20 */ |
21 class SkBitmapController : ::SkNoncopyable { | 21 class SkBitmapController : ::SkNoncopyable { |
22 public: | 22 public: |
23 class State : ::SkNoncopyable { | 23 class State : ::SkNoncopyable { |
24 public: | 24 public: |
25 virtual ~State() {} | 25 virtual ~State() {} |
26 | 26 |
27 const SkPixmap& pixmap() const { return fPixmap; } | 27 const SkPixmap& pixmap() const { return fPixmap; } |
28 const SkMatrix& invMatrix() const { return fInvMatrix; } | 28 const SkMatrix& invMatrix() const { return fInvMatrix; } |
29 SkFilterQuality quality() const { return fQuality; } | 29 SkFilterQuality quality() const { return fQuality; } |
30 | 30 |
31 protected: | 31 protected: |
32 SkPixmap fPixmap; | 32 SkPixmap fPixmap; |
33 SkMatrix fInvMatrix; | 33 SkMatrix fInvMatrix; |
34 SkFilterQuality fQuality; | 34 SkFilterQuality fQuality; |
35 | 35 |
36 private: | 36 private: |
37 friend class SkBitmapController; | 37 friend class SkBitmapController; |
38 }; | 38 }; |
39 | 39 |
40 virtual ~SkBitmapController() {} | 40 virtual ~SkBitmapController() {} |
41 | 41 |
42 State* requestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFil
terQuality, | 42 State* requestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFil
terQuality, |
43 void* storage, size_t storageSize); | 43 void* storage, size_t storageSize); |
44 | 44 |
45 State* requestBitmap(const SkBitmapProvider& bp, const SkMatrix& inv, SkFilt
erQuality quality) { | 45 State* requestBitmap(const SkBitmapProvider& bp, const SkMatrix& inv, SkFilt
erQuality quality) { |
46 return this->requestBitmap(bp, inv, quality, nullptr, 0); | 46 return this->requestBitmap(bp, inv, quality, nullptr, 0); |
47 } | 47 } |
48 | 48 |
49 protected: | 49 protected: |
50 virtual State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inv,
SkFilterQuality, | 50 virtual State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inv,
SkFilterQuality, |
51 void* storage, size_t storageSize) = 0; | 51 void* storage, size_t storageSize) = 0; |
52 }; | 52 }; |
53 | 53 |
54 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 54 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
55 | 55 |
56 class SkDefaultBitmapController : public SkBitmapController { | 56 class SkDefaultBitmapController : public SkBitmapController { |
57 public: | 57 public: |
58 SkDefaultBitmapController() {} | 58 SkDefaultBitmapController() {} |
59 | 59 |
60 protected: | 60 protected: |
61 State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkF
ilterQuality, | 61 State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkF
ilterQuality, |
62 void* storage, size_t storageSize) override; | 62 void* storage, size_t storageSize) override; |
63 }; | 63 }; |
64 | 64 |
65 #endif | 65 #endif |
OLD | NEW |