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

Unified Diff: src/core/SkSpecialImage.h

Issue 1812023002: Switch SkSpecialImage & SkSpecialSurface classes over to smart pointers (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix build Created 4 years, 9 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/SkImageFilter.cpp ('k') | 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 b1b6a28d6a846ee046092b376ab6b24fd08a5cc8..1a01a5abc7a8a285955df101aa67ac759ab73775 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -39,6 +39,9 @@ enum {
*/
class SkSpecialImage : public SkRefCnt {
public:
+ typedef void* ReleaseContext;
+ typedef void(*RasterReleaseProc)(void* pixels, ReleaseContext);
+
int width() const { return fSubset.width(); }
int height() const { return fSubset.height(); }
const SkIRect& subset() const { return fSubset; }
@@ -52,37 +55,37 @@ public:
*/
void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const;
- static SkSpecialImage* NewFromImage(SkImageFilter::Proxy*,
- const SkIRect& subset,
- const SkImage*);
- 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);
- static SkSpecialImage* NewFromPixmap(SkImageFilter::Proxy*,
- const SkIRect& subset,
- const SkPixmap&,
- void (*releaseProc)(void* addr, void* context),
- void* context);
+ static sk_sp<SkSpecialImage> MakeFromImage(SkImageFilter::Proxy*,
+ const SkIRect& subset,
+ sk_sp<SkImage>);
+ static sk_sp<SkSpecialImage> MakeFromRaster(SkImageFilter::Proxy*,
+ const SkIRect& subset,
+ const SkBitmap&);
+ static sk_sp<SkSpecialImage> MakeFromGpu(SkImageFilter::Proxy*,
+ const SkIRect& subset,
+ uint32_t uniqueID,
+ GrTexture*,
+ SkAlphaType at = kPremul_SkAlphaType);
+ static sk_sp<SkSpecialImage> MakeFromPixmap(SkImageFilter::Proxy*,
+ const SkIRect& subset,
+ const SkPixmap&,
+ RasterReleaseProc,
+ ReleaseContext);
/**
* Create a new surface with a backend that is compatible with this image.
*/
- SkSpecialSurface* newSurface(const SkImageInfo&) const;
+ sk_sp<SkSpecialSurface> makeSurface(const SkImageInfo&) const;
/**
* Extract a subset of this special image and return it as a special image.
* It may or may not point to the same backing memory.
*/
- SkSpecialImage* extractSubset(const SkIRect& subset) const;
+ sk_sp<SkSpecialImage> makeSubset(const SkIRect& subset) 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&);
+ static sk_sp<SkSpecialImage> internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&);
SkImageFilter::Proxy* internal_getProxy() const;
// TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
« no previous file with comments | « src/core/SkImageFilter.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698