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