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

Unified Diff: src/core/SkSpecialImage.h

Issue 1787883002: Add SkSpecialImage::extractSubset & NewFromPixmap (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT 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/SkScalerContext.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 e90de097fb8d185275c13dd6fcf9a6d5656dd5ae..b1b6a28d6a846ee046092b376ab6b24fd08a5cc8 100644
--- a/src/core/SkSpecialImage.h
+++ b/src/core/SkSpecialImage.h
@@ -63,16 +63,27 @@ public:
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);
/**
* Create a new surface with a backend that is compatible with this image.
*/
SkSpecialSurface* newSurface(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;
+
// 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();
+ SkImageFilter::Proxy* internal_getProxy() const;
// TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063)
/**
@@ -81,6 +92,20 @@ public:
*/
GrTexture* peekTexture() const;
+ // TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063)
+ /**
+ * If the SpecialImage is backed by cpu pixels, return the const address
+ * of those pixels and, if not null, the ImageInfo, rowBytes, and, if present,
+ * the color table. The returned address(es) is/are only valid while the image object
+ * is in scope.
+ *
+ * The returned ImageInfo represents the backing memory. Use 'subset'
+ * to get the active portion's dimensions.
+ *
+ * On failure, return false and ignore the pixmap parameter.
+ */
+ bool peekPixels(SkPixmap*) const;
+
protected:
SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID)
: fSubset(subset)
@@ -93,18 +118,6 @@ protected:
friend class TestingSpecialImageAccess;
friend class TestingSpecialSurfaceAccess;
- /**
- * If the SpecialImage is backed by cpu pixels, return the const address
- * of those pixels and, if not null, return the ImageInfo and rowBytes.
- * The returned address is only valid while the image object is in scope.
- *
- * The returned ImageInfo represents the backing memory. Use 'subset'
- * to get the active portion's dimensions.
- *
- * On failure, return false and ignore the pixmap parameter.
- */
- bool testingOnlyPeekPixels(SkPixmap*) const;
-
// This entry point is for testing only. It does a readback from VRAM for
// GPU-backed special images.
bool testingOnlyGetROPixels(SkBitmap*) const;
« no previous file with comments | « src/core/SkScalerContext.cpp ('k') | src/core/SkSpecialImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698