Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(156)

Unified Diff: src/core/SkBitmapController.h

Issue 1340223003: create SkBitmapProvider to abstract images and bitmaps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove obsolete comments Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmapCache.cpp ('k') | src/core/SkBitmapController.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapController.h
diff --git a/src/core/SkBitmapController.h b/src/core/SkBitmapController.h
index aa663e85f71b92fa06032bfb7345c025786e89ca..435d9e72aff83456f76e6d7511ed0462cb3124c3 100644
--- a/src/core/SkBitmapController.h
+++ b/src/core/SkBitmapController.h
@@ -9,9 +9,36 @@
#define SkBitmapController_DEFINED
#include "SkBitmap.h"
+#include "SkBitmapCache.h"
#include "SkFilterQuality.h"
+#include "SkImage.h"
#include "SkMatrix.h"
+class SkBitmapProvider {
+public:
+ SkBitmapProvider(const SkBitmap& bm) : fBitmap(bm) {}
+ SkBitmapProvider(const SkImage* img) : fImage(SkRef(img)) {}
+
+ int width() const;
+ int height() const;
+ uint32_t getID() const;
+
+ bool validForDrawing() const;
+ SkImageInfo info() const;
+
+ SkBitmapCacheDesc makeCacheDesc(int w, int h) const;
+ SkBitmapCacheDesc makeCacheDesc() const;
+ void notifyAddedToCache() const;
+
+ // Only call this if you're sure you need the bits, since it make be expensive
+ // ... cause a decode and cache, or gpu-readback
+ bool asBitmap(SkBitmap*) const;
+
+private:
+ SkBitmap fBitmap;
+ SkAutoTUnref<const SkImage> fImage;
+};
+
/**
* Handles request to scale, filter, and lock a bitmap to be rasterized.
*/
@@ -36,15 +63,15 @@ public:
virtual ~SkBitmapController() {}
- State* requestBitmap(const SkBitmap&, const SkMatrix& inverse, SkFilterQuality,
+ State* requestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFilterQuality,
void* storage, size_t storageSize);
- State* requestBitmap(const SkBitmap& bm, const SkMatrix& inverse, SkFilterQuality quality) {
- return this->requestBitmap(bm, inverse, quality, nullptr, 0);
+ State* requestBitmap(const SkBitmapProvider& bp, const SkMatrix& inv, SkFilterQuality quality) {
+ return this->requestBitmap(bp, inv, quality, nullptr, 0);
}
protected:
- virtual State* onRequestBitmap(const SkBitmap&, const SkMatrix& inverse, SkFilterQuality,
+ virtual State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inv, SkFilterQuality,
void* storage, size_t storageSize) = 0;
};
@@ -55,7 +82,7 @@ public:
SkDefaultBitmapController() {}
protected:
- State* onRequestBitmap(const SkBitmap&, const SkMatrix& inverse, SkFilterQuality,
+ State* onRequestBitmap(const SkBitmapProvider&, const SkMatrix& inverse, SkFilterQuality,
void* storage, size_t storageSize) override;
};
« no previous file with comments | « src/core/SkBitmapCache.cpp ('k') | src/core/SkBitmapController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698