Index: src/core/SkBitmapController.h |
diff --git a/src/core/SkBitmapController.h b/src/core/SkBitmapController.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5ef8d8953a7495d487537edb0953e0101855a808 |
--- /dev/null |
+++ b/src/core/SkBitmapController.h |
@@ -0,0 +1,60 @@ |
+/* |
+ * Copyright 2015 Google Inc. |
+ * |
+ * Use of this source code is governed by a BSD-style license that can be |
+ * found in the LICENSE file. |
+ */ |
+ |
+#ifndef SkBitmapController_DEFINED |
+#define SkBitmapController_DEFINED |
+ |
+#include "SkBitmap.h" |
+#include "SkFilterQuality.h" |
+#include "SkMatrix.h" |
+ |
+class SkInPlace; |
+ |
+/** |
+ * Handles request to scale, filter, and lock a bitmap to be rasterized. |
+ */ |
+class SkBitmapController { |
scroggo
2015/06/02 21:17:33
I tend to default to making classes noncopyable. I
reed1
2015/06/04 13:17:03
Done.
|
+public: |
+ class State { |
scroggo
2015/06/02 21:17:34
Should this be noncopyable?
The only harm/weirdne
reed1
2015/06/04 13:17:03
Done.
|
+ public: |
+ virtual ~State() {} |
+ |
+ const SkBitmap& lockedBitmap() const { return fLockedBitmap; } |
+ const SkMatrix& invMatrix() const { return fInvMatrix; } |
+ SkFilterQuality quality() const { return fQuality; } |
+ |
+ protected: |
+ SkBitmap fLockedBitmap; |
+ SkMatrix fInvMatrix; |
+ SkFilterQuality fQuality; |
+ |
+ private: |
+ friend class SkBitmapController; |
+ }; |
+ |
+ virtual ~SkBitmapController() {} |
+ |
+ State* requestBitmap(const SkBitmap&, const SkMatrix& inverse, SkFilterQuality, |
scroggo
2015/06/02 21:17:33
This will matter more once it's public:
Add a com
|
+ SkInPlace* = NULL); |
+ |
+protected: |
+ virtual State* onRequestBitmap(const SkBitmap&, const SkMatrix& inverse, SkFilterQuality, |
+ SkInPlace&) = 0; |
+}; |
+ |
+/////////////////////////////////////////////////////////////////////////////////////////////////// |
+ |
+class SkDefaultBitmapController : public SkBitmapController { |
+public: |
+ SkDefaultBitmapController() {} |
+ |
+protected: |
+ State* onRequestBitmap(const SkBitmap&, const SkMatrix& inverse, SkFilterQuality, |
+ SkInPlace&) override; |
+}; |
+ |
+#endif |