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

Unified Diff: src/core/SkSpecialImage.h

Issue 1705113002: Update SkSpecialImage API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add missing files Created 4 years, 10 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 | « no previous file | src/core/SkSpecialImage.cpp » ('j') | src/core/SkSpecialImage.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkSpecialImage.h
diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h
index 38225482fbd5f76d291c76a8609db29e0859f5d5..551824a3bce7448678e369f17857ca78b1b3f46c 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -8,8 +8,13 @@
#ifndef SkSpecialImage_DEFINED
#define SkSpecialImage_DEFINED
+#include "SkNextID.h"
#include "SkRefCnt.h"
+// remove these two when internal_getProxy goes away
+#include "SkImageFilter.h"
+#include "SkDevice.h"
+
class GrTexture;
class SkBitmap;
class SkCanvas;
@@ -18,6 +23,10 @@ struct SkImageInfo;
class SkPaint;
class SkSpecialSurface;
+enum {
+ kNeedNewImageUniqueID_SpecialImage = 0
+};
+
/**
* This is a restricted form of SkImage solely intended for internal use. It
* differs from SkImage in that:
@@ -33,6 +42,9 @@ class SkSpecialImage : public SkRefCnt {
public:
int width() const { return fSubset.width(); }
int height() const { return fSubset.height(); }
+ uint32_t uniqueID() const { return fUniqueID; }
+ virtual bool isOpaque() const { return false; }
+ virtual size_t getSize() const = 0;
/**
* Draw this SpecialImage into the canvas.
@@ -41,15 +53,31 @@ public:
static SkSpecialImage* NewFromImage(const SkIRect& subset, const SkImage*);
static SkSpecialImage* NewFromRaster(const SkIRect& subset, const SkBitmap&);
- static SkSpecialImage* NewFromGpu(const SkIRect& subset, GrTexture*);
+ static SkSpecialImage* NewFromGpu(const SkIRect& subset,
+ uint32_t uniqueID,
Stephen White 2016/02/17 17:00:02 Out of curiosity, are we going to need this unique
robertphillips 2016/02/17 19:10:28 I believe it will go away when there are only SkIm
+ GrTexture*,
+ SkAlphaType at = kPremul_SkAlphaType);
/**
* Create a new surface with a backend that is compatible with this image.
*/
SkSpecialSurface* newSurface(const SkImageInfo&) const;
+ // These three internal methods will go away
+ bool internal_getBM(SkBitmap* result);
+ static SkSpecialImage* internal_fromBM(const SkBitmap&);
+ SkImageFilter::Proxy* internal_getProxy();
+
protected:
- SkSpecialImage(const SkIRect& subset) : fSubset(subset) { }
+ SkSpecialImage(const SkIRect& subset, uint32_t uniqueID)
+ : fSubset(subset)
+ , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID()
+ : uniqueID)
+ , fProxy(nullptr) {
+ }
+ ~SkSpecialImage() override {
+ delete fProxy;
+ }
// The following 3 are for testing and shouldn't be used.
friend class TestingSpecialImageAccess;
@@ -75,7 +103,12 @@ protected:
GrTexture* peekTexture() const;
private:
- const SkIRect fSubset;
+ const SkIRect fSubset;
+ const uint32_t fUniqueID;
+
+ // TODO: remove these two ASAP
+ SkImageFilter::Proxy* fProxy;
+ SkAutoTUnref<SkBaseDevice> fDevice;
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « no previous file | src/core/SkSpecialImage.cpp » ('j') | src/core/SkSpecialImage.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698