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

Unified Diff: src/core/SkImagePriv.h

Issue 2241353002: pin as texture api (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comments Created 4 years, 4 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/gpu/GrImageIDTextureAdjuster.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImagePriv.h
diff --git a/src/core/SkImagePriv.h b/src/core/SkImagePriv.h
index 3077f343677d034994846cdb897812258bc0364c..0377762def66f3a8ce2fba54c1b6e010a801b1fc 100644
--- a/src/core/SkImagePriv.h
+++ b/src/core/SkImagePriv.h
@@ -77,4 +77,29 @@ extern void SkTextureImageSetTexture(SkImage* image, GrTexture* texture);
GrTexture* GrDeepCopyTexture(GrTexture* src, SkBudgeted);
+/**
+ * Will attempt to upload and lock the contents of the image as a texture, so that subsequent
+ * draws to a gpu-target will come from that texture (and not by looking at the original image
+ * src). In particular this is intended to use the texture even if the image's original content
+ * changes subsequent to this call (i.e. the src is mutable!).
+ *
+ * This must be balanced by an equal number of calls to SkImage_unpinAsTexture() -- calls can be
+ * nested.
+ *
+ * Once in this "pinned" state, the image has all of the same thread restrictions that exist
+ * for a natively created gpu image (e.g. SkImage::MakeFromTexture)
+ * - all drawing, pinning, unpinning must happen in the same thread as the GrContext.
+ */
+void SkImage_pinAsTexture(const SkImage*, GrContext*);
+
+/**
+ * The balancing call to SkImage_pinAsTexture. When a balanced number of calls have been made, then
+ * the "pinned" texture is free to be purged, etc. This also means that a subsequent "pin" call
+ * will look at the original content again, and if its uniqueID/generationID has changed, then
+ * a newer texture will be uploaded/pinned.
+ *
+ * The context passed to unpin must match the one passed to pin.
+ */
+void SkImage_unpinAsTexture(const SkImage*, GrContext*);
+
#endif
« no previous file with comments | « no previous file | src/gpu/GrImageIDTextureAdjuster.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698