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 "SkImage.h" | 14 #include "SkImage.h" |
15 #include "SkMatrix.h" | 15 #include "SkMatrix.h" |
16 | 16 |
17 class SkBitmapProvider { | 17 class SkBitmapProvider { |
18 public: | 18 public: |
19 SkBitmapProvider(const SkBitmap& bm) : fBitmap(bm) {} | 19 explicit SkBitmapProvider(const SkBitmap& bm) : fBitmap(bm) {} |
20 SkBitmapProvider(const SkImage* img) : fImage(SkRef(img)) {} | 20 explicit SkBitmapProvider(const SkImage* img) : fImage(SkSafeRef(img)) {} |
| 21 SkBitmapProvider(const SkBitmapProvider& other) |
| 22 : fBitmap(other.fBitmap) |
| 23 , fImage(SkSafeRef(other.fImage.get())) |
| 24 {} |
21 | 25 |
22 int width() const; | 26 int width() const; |
23 int height() const; | 27 int height() const; |
24 uint32_t getID() const; | 28 uint32_t getID() const; |
25 | 29 |
26 bool validForDrawing() const; | 30 bool validForDrawing() const; |
27 SkImageInfo info() const; | 31 SkImageInfo info() const; |
28 | 32 |
29 SkBitmapCacheDesc makeCacheDesc(int w, int h) const; | 33 SkBitmapCacheDesc makeCacheDesc(int w, int h) const; |
30 SkBitmapCacheDesc makeCacheDesc() const; | 34 SkBitmapCacheDesc makeCacheDesc() const; |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 class SkDefaultBitmapController : public SkBitmapController { | 84 class SkDefaultBitmapController : public SkBitmapController { |
81 public: | 85 public: |
82 SkDefaultBitmapController() {} | 86 SkDefaultBitmapController() {} |
83 | 87 |
84 protected: | 88 protected: |
85 State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkF
ilterQuality, | 89 State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkF
ilterQuality, |
86 void* storage, size_t storageSize) override; | 90 void* storage, size_t storageSize) override; |
87 }; | 91 }; |
88 | 92 |
89 #endif | 93 #endif |
OLD | NEW |