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

Unified Diff: src/core/SkSpecialImage.h

Issue 1705113002: Update SkSpecialImage API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix no-gpu build 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') | no next file with comments »
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..8dd4a92e1cc37a5adfd232f8d18cb26fd643cc63 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -8,8 +8,12 @@
#ifndef SkSpecialImage_DEFINED
#define SkSpecialImage_DEFINED
+#include "SkNextID.h"
#include "SkRefCnt.h"
+// remove this when internal_getProxy goes away (see skbug.com/4965)
+#include "SkImageFilter.h"
+
class GrTexture;
class SkBitmap;
class SkCanvas;
@@ -18,6 +22,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 +41,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.
@@ -40,18 +51,34 @@ public:
void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const;
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* NewFromRaster(SkImageFilter::Proxy*,
+ const SkIRect& subset,
+ const SkBitmap&);
+ static SkSpecialImage* NewFromGpu(SkImageFilter::Proxy*,
+ const SkIRect& subset,
+ uint32_t uniqueID,
+ 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 (see skbug.com/4965)
+ bool internal_getBM(SkBitmap* result);
+ static SkSpecialImage* internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&);
+ SkImageFilter::Proxy* internal_getProxy();
+
protected:
- SkSpecialImage(const SkIRect& subset) : fSubset(subset) { }
+ SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID)
+ : fSubset(subset)
+ , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID()
+ : uniqueID)
+ , fProxy(proxy) {
+ }
- // The following 3 are for testing and shouldn't be used.
+ // The following 3 are for testing and shouldn't be used. (see skbug.com/4965)
friend class TestingSpecialImageAccess;
friend class TestingSpecialSurfaceAccess;
const SkIRect& subset() const { return fSubset; }
@@ -74,8 +101,15 @@ protected:
*/
GrTexture* peekTexture() const;
+ // TODO: remove this ASAP (see skbug.com/4965)
+ SkImageFilter::Proxy* proxy() const { return fProxy; }
+
private:
- const SkIRect fSubset;
+ const SkIRect fSubset;
+ const uint32_t fUniqueID;
+
+ // TODO: remove this ASAP (see skbug.com/4965)
+ SkImageFilter::Proxy* fProxy;
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « no previous file | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698