diff options
author | Cary Clark <caryclark@skia.org> | 2018-04-26 10:59:57 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-26 21:11:53 +0000 |
commit | 36122e74c1d34983b60ca9dcf8cb4bed6bde7d40 (patch) | |
tree | 81e0ad58f7e779fb44002b0d5516a3a05d2c77c9 | |
parent | 7ddad479e464a3d481d106415c9c1b8cc8496848 (diff) |
remove GrBackendObject from example fiddles
R=robertphillips@google.com
Docs-Preview: https://skia.org/?cl=123930
Bug: skia:6898
Change-Id: If579d0e0c0323a86d6ab86056b36f8660cbbde6f
Reviewed-on: https://skia-review.googlesource.com/123930
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
-rw-r--r-- | docs/SkImage_Reference.bmh | 67 | ||||
-rw-r--r-- | docs/SkSurface_Reference.bmh | 91 | ||||
-rw-r--r-- | site/user/api/SkImage_Reference.md | 33 | ||||
-rw-r--r-- | site/user/api/SkSurface_Reference.md | 69 | ||||
-rw-r--r-- | site/user/api/catalog.htm | 40 |
5 files changed, 8 insertions, 292 deletions
diff --git a/docs/SkImage_Reference.bmh b/docs/SkImage_Reference.bmh index 32ddbe3397..9cf69d7adb 100644 --- a/docs/SkImage_Reference.bmh +++ b/docs/SkImage_Reference.bmh @@ -1324,72 +1324,7 @@ drawImage(textureImage, "backEndTexture"); #Method GrBackendObject getTextureHandle(bool flushPendingGrContextIO, GrSurfaceOrigin* origin = nullptr) const -#In Property -#Line # returns GPU reference to Image as texture ## - -Retrieves the back-end API handle of texture. If flushPendingGrContextIO is true, -complete deferred I/O operations. - -If origin is not nullptr, copies location of content drawn into Image. - -#Param flushPendingGrContextIO flag to flush outstanding requests ## -#Param origin storage for one of: kTopLeft_GrSurfaceOrigin, - kBottomLeft_GrSurfaceOrigin; or nullptr -## - -#Return back-end API texture handle, or nullptr ## - -#Example -#Image 4 -#Platform gpu -GrContext* context = canvas->getGrContext(); -if (!context) { - return; -} -SkPaint paint; -paint.setAntiAlias(true); -SkString str; -int y = -10; -for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) { - sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context, - backEndTexture, origin, kN32_SkColorType, kPremul_SkAlphaType, nullptr)); - GrSurfaceOrigin readBackOrigin; - GrBackendObject readBackHandle = srcImage->getTextureHandle(false, &readBackOrigin); - str.printf("readBackHandle: 0x%lx", readBackHandle); - canvas->drawString(str, 5, y += 30, paint); - canvas->drawImage(srcImage, 80, y += 10); - str.printf("origin: k%s_GrSurfaceOrigin", readBackOrigin ? "BottomLeft" : "TopLeft"); - canvas->drawString(str, 5, y += srcImage->height() + 10, paint); -} -## - -#Example -#Image 5 -#Platform gpu - auto drawImage = [=](sk_sp<SkImage> image, const char* label) -> void { - if (nullptr == image) { - return; - } - SkPaint paint; - paint.setAntiAlias(true); - paint.setTextAlign(SkPaint::kCenter_Align); - canvas->drawImage(image, 0, image->height() / 4); - canvas->drawString(label, image->width() / 2, image->height() / 8, paint); - GrSurfaceOrigin readBackOrigin; - GrBackendObject readBackHandle = image->getTextureHandle(false, &readBackOrigin); - canvas->drawString(readBackHandle ? "has readBackHandle" : "no readBackHandle", - image->width() / 2, image->height() * 11 / 8, paint); - }; - drawImage(image, "image"); - canvas->translate(image->width(), 0); - sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture, - kTopLeft_GrSurfaceOrigin, kN32_SkColorType, kOpaque_SkAlphaType, - nullptr)); - drawImage(textureImage, "backEndTexture"); -## - -#SeeAlso MakeFromTexture isTextureBacked - +#Deprecated #Method ## # ------------------------------------------------------------------------------ diff --git a/docs/SkSurface_Reference.bmh b/docs/SkSurface_Reference.bmh index e9c520106b..0c4b43483b 100644 --- a/docs/SkSurface_Reference.bmh +++ b/docs/SkSurface_Reference.bmh @@ -960,7 +960,8 @@ Caller must overwrite the entire back-end object. #Deprecated ## -#Example +#NoExample +// todo: need to update example to use GrBackendTexture instead of GrBackendObject #Platform gpu SkPaint paint; paint.setTextSize(32); @@ -989,102 +990,21 @@ Caller must overwrite the entire back-end object. canvas->drawString(str, 20, y += 20, paint); ## -#SeeAlso getTextureHandle getRenderTargetHandle +#SeeAlso getBackendTexture getBackendRenderTarget #Enum ## # ------------------------------------------------------------------------------ #Method GrBackendObject getTextureHandle(BackendHandleAccess backendHandleAccess) -#In Property -#Line # returns the GPU reference to texture ## -Returns the GPU back-end reference of the texture used by Surface, or zero -if Surface is not backed by a GPU texture. - -The returned texture handle is only valid until the next draw into Surface, -or when Surface is deleted. - -#Param backendHandleAccess one of: kFlushRead_BackendHandleAccess, - kFlushWrite_BackendHandleAccess, kDiscardWrite_BackendHandleAccess -## - -#Return GPU texture reference ## - -#Example -#Platform gpu -#Height 64 - SkPaint paint; - paint.setTextSize(32); - GrContext* context = canvas->getGrContext(); - if (!context) { - canvas->drawString("GPU only!", 20, 40, paint); - return; - } - sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget( - context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10)); - GrBackendObject backendObject = gpuSurface->getTextureHandle( - SkSurface::kFlushRead_BackendHandleAccess); - if (backendObject) { - SkString str; - str.printf("backendObject=%08lx", backendObject); - paint.setTextSize(16); - canvas->drawString(str, 20, 40, paint); - } -## - -#SeeAlso getRenderTargetHandle GrBackendObject BackendHandleAccess - +#Deprecated #Method ## # ------------------------------------------------------------------------------ #Method bool getRenderTargetHandle(GrBackendObject* backendObject, BackendHandleAccess backendHandleAccess) -#In Property -#Line # returns the GPU reference to render target ## - -Returns true and stores the GPU back-end reference of the render target used -by Surface in backendObject. - -Return false if Surface is not backed by a GPU render target, and leaves -backendObject unchanged. - -The returned render target handle is only valid until the next draw into Surface, -or when Surface is deleted. - -In OpenGL this returns the frame buffer object ID. - -#Param backendObject GPU intermediate memory buffer ## -#Param backendHandleAccess one of: kFlushRead_BackendHandleAccess, - kFlushWrite_BackendHandleAccess, kDiscardWrite_BackendHandleAccess -## - -#Return true if Surface is backed by GPU texture ## - -#Example -#Platform gpu -#Height 64 - SkPaint paint; - paint.setTextSize(32); - GrContext* context = canvas->getGrContext(); - if (!context) { - canvas->drawString("GPU only!", 20, 40, paint); - return; - } - sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget( - context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10)); - GrBackendObject backendObject; - if (gpuSurface->getRenderTargetHandle(&backendObject, - SkSurface::kFlushRead_BackendHandleAccess)) { - SkString str; - str.printf("backendObject=%ld", backendObject); - paint.setTextSize(16); - canvas->drawString(str, 20, 40, paint); - } -## - -#SeeAlso getTextureHandle GrBackendObject BackendHandleAccess - +#Deprecated #Method ## # ------------------------------------------------------------------------------ @@ -1656,6 +1576,7 @@ and the client will still own the semaphores. #NoExample #ToDo this is copy and paste silliness masquerading as an example. Probably need gpu globals and definitely need gpu expertise to make a real example out of this + also, note need to replace GrBackendObject with GrBackendTexture ## #Platform gpu #Height 64 diff --git a/site/user/api/SkImage_Reference.md b/site/user/api/SkImage_Reference.md index ecd59f5bbf..2f491b01a1 100644 --- a/site/user/api/SkImage_Reference.md +++ b/site/user/api/SkImage_Reference.md @@ -125,7 +125,6 @@ drawing. | <a href="#SkImage_dimensions">dimensions</a> | returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> | | <a href="#SkImage_encodeToData">encodeToData</a> | returns encoded <a href="#Image">Image</a> as <a href="undocumented#SkData">SkData</a> | | <a href="#SkImage_getBackendTexture">getBackendTexture</a> | returns GPU reference to <a href="#Image">Image</a> as texture | -| <a href="#SkImage_getTextureHandle">getTextureHandle</a> | returns GPU reference to <a href="#Image">Image</a> as texture | | <a href="#SkImage_height">height</a> | returns pixel row count | | <a href="#SkImage_isAlphaOnly">isAlphaOnly</a> | returns if pixels represent a transparency mask | | <a href="#SkImage_isLazyGenerated">isLazyGenerated</a> | returns if <a href="#Image">Image</a> is created as needed | @@ -897,7 +896,6 @@ created <a href="#Image">Image</a>, or nullptr | <a href="#SkImage_colorType">colorType</a> | returns <a href="SkImageInfo_Reference#Color_Type">Color Type</a> | | <a href="#SkImage_dimensions">dimensions</a> | returns <a href="#SkImage_width">width</a> and <a href="#SkImage_height">height</a> | | <a href="#SkImage_getBackendTexture">getBackendTexture</a> | returns GPU reference to <a href="#Image">Image</a> as texture | -| <a href="#SkImage_getTextureHandle">getTextureHandle</a> | returns GPU reference to <a href="#Image">Image</a> as texture | | <a href="#SkImage_height">height</a> | returns pixel row count | | <a href="#SkImage_isAlphaOnly">isAlphaOnly</a> | returns if pixels represent a transparency mask | | <a href="#SkImage_isLazyGenerated">isLazyGenerated</a> | returns if <a href="#Image">Image</a> is created as needed | @@ -1411,37 +1409,6 @@ true if <a href="#Image">Image</a> can be drawn GrBackendObject getTextureHandle(bool flushPendingGrContextIO, GrSurfaceOrigin* origin = nullptr) const </pre> -Retrieves the back-end API handle of texture. If <a href="#SkImage_getTextureHandle_flushPendingGrContextIO">flushPendingGrContextIO</a> is true, -complete deferred I/O operations. - -If <a href="#SkImage_getTextureHandle_origin">origin</a> is not nullptr, copies location of content drawn into <a href="#Image">Image</a>. - -### Parameters - -<table> <tr> <td><a name="SkImage_getTextureHandle_flushPendingGrContextIO"> <code><strong>flushPendingGrContextIO </strong></code> </a></td> <td> -flag to flush outstanding requests</td> - </tr> <tr> <td><a name="SkImage_getTextureHandle_origin"> <code><strong>origin </strong></code> </a></td> <td> -storage for one of: <a href="undocumented#kTopLeft_GrSurfaceOrigin">kTopLeft GrSurfaceOrigin</a>, -<a href="undocumented#kBottomLeft_GrSurfaceOrigin">kBottomLeft GrSurfaceOrigin</a>; or nullptr</td> - </tr> -</table> - -### Return Value - -back-end API texture handle, or nullptr - -### Example - -<div><fiddle-embed name="c321079049b0363c3b53bb76991768d4" gpu="true"></fiddle-embed></div> - -### Example - -<div><fiddle-embed name="7161810a96a75540c55af0021a1e5bb9" gpu="true"></fiddle-embed></div> - -### See Also - -<a href="#SkImage_MakeFromTexture">MakeFromTexture</a><sup><a href="#SkImage_MakeFromTexture_2">[2]</a></sup> <a href="#SkImage_isTextureBacked">isTextureBacked</a> - --- <a name="SkImage_getBackendTexture"></a> diff --git a/site/user/api/SkSurface_Reference.md b/site/user/api/SkSurface_Reference.md index cf9493f8a4..9d81ab2949 100644 --- a/site/user/api/SkSurface_Reference.md +++ b/site/user/api/SkSurface_Reference.md @@ -52,8 +52,6 @@ of the requested dimensions are zero, then nullptr will be returned. | <a href="#SkSurface_getBackendRenderTarget">getBackendRenderTarget</a> | returns the GPU reference to render target | | <a href="#SkSurface_getBackendTexture">getBackendTexture</a> | returns the GPU reference to texture | | <a href="#SkSurface_getCanvas">getCanvas</a> | returns <a href="SkCanvas_Reference#Canvas">Canvas</a> that draws into <a href="#Surface">Surface</a> | -| <a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> | returns the GPU reference to render target | -| <a href="#SkSurface_getTextureHandle">getTextureHandle</a> | returns the GPU reference to texture | | <a href="#SkSurface_height">height</a> | returns pixel row count | | <a href="#SkSurface_makeImageSnapshot">makeImageSnapshot</a> | creates <a href="SkImage_Reference#Image">Image</a> capturing <a href="#Surface">Surface</a> contents | | <a href="#SkSurface_makeSurface">makeSurface</a> | creates a compatible <a href="#Surface">Surface</a> | @@ -808,8 +806,6 @@ surf->makeImageSnapshot() == nullptr | <a href="#SkSurface_getBackendRenderTarget">getBackendRenderTarget</a> | returns the GPU reference to render target | | <a href="#SkSurface_getBackendTexture">getBackendTexture</a> | returns the GPU reference to texture | | <a href="#SkSurface_getCanvas">getCanvas</a> | returns <a href="SkCanvas_Reference#Canvas">Canvas</a> that draws into <a href="#Surface">Surface</a> | -| <a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> | returns the GPU reference to render target | -| <a href="#SkSurface_getTextureHandle">getTextureHandle</a> | returns the GPU reference to texture | | <a href="#SkSurface_height">height</a> | returns pixel row count | | <a href="#SkSurface_props">props</a> | returns <a href="undocumented#Surface_Properties">Surface Properties</a> | | <a href="#SkSurface_width">width</a> | returns pixel column count | @@ -1019,13 +1015,9 @@ one of: <a href="#SkSurface_kDiscard_ContentChangeMode">kDiscard ContentChangeMo </tr> </table> -### Example - -<div><fiddle-embed name="260a5ba014b00eeb5a74b3c6b8d31be4" gpu="true"></fiddle-embed></div> - ### See Also -<a href="#SkSurface_getTextureHandle">getTextureHandle</a> <a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> +<a href="#SkSurface_getBackendTexture">getBackendTexture</a> <a href="#SkSurface_getBackendRenderTarget">getBackendRenderTarget</a> @@ -1036,32 +1028,6 @@ one of: <a href="#SkSurface_kDiscard_ContentChangeMode">kDiscard ContentChangeMo GrBackendObject getTextureHandle(BackendHandleAccess backendHandleAccess) </pre> -Returns the GPU back-end reference of the texture used by <a href="#Surface">Surface</a>, or zero -if <a href="#Surface">Surface</a> is not backed by a GPU texture. - -The returned texture handle is only valid until the next draw into <a href="#Surface">Surface</a>, -or when <a href="#Surface">Surface</a> is deleted. - -### Parameters - -<table> <tr> <td><a name="SkSurface_getTextureHandle_backendHandleAccess"> <code><strong>backendHandleAccess </strong></code> </a></td> <td> -one of: <a href="#SkSurface_kFlushRead_BackendHandleAccess">kFlushRead BackendHandleAccess</a>, -<a href="#SkSurface_kFlushWrite_BackendHandleAccess">kFlushWrite BackendHandleAccess</a>, <a href="#SkSurface_kDiscardWrite_BackendHandleAccess">kDiscardWrite BackendHandleAccess</a></td> - </tr> -</table> - -### Return Value - -GPU texture reference - -### Example - -<div><fiddle-embed name="f7558a62985f70f2286307993db4b3bc" gpu="true"></fiddle-embed></div> - -### See Also - -<a href="#SkSurface_getRenderTargetHandle">getRenderTargetHandle</a> <a href="undocumented#GrBackendObject">GrBackendObject</a> <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> - --- <a name="SkSurface_getRenderTargetHandle"></a> @@ -1071,39 +1037,6 @@ GPU texture reference bool getRenderTargetHandle(GrBackendObject* backendObject, BackendHandleAccess backendHandleAccess) </pre> -Returns true and stores the GPU back-end reference of the render target used -by <a href="#Surface">Surface</a> in <a href="#SkSurface_getRenderTargetHandle_backendObject">backendObject</a>. - -Return false if <a href="#Surface">Surface</a> is not backed by a GPU render target, and leaves -<a href="#SkSurface_getRenderTargetHandle_backendObject">backendObject</a> unchanged. - -The returned render target handle is only valid until the next draw into <a href="#Surface">Surface</a>, -or when <a href="#Surface">Surface</a> is deleted. - -In OpenGL this returns the frame buffer object ID. - -### Parameters - -<table> <tr> <td><a name="SkSurface_getRenderTargetHandle_backendObject"> <code><strong>backendObject </strong></code> </a></td> <td> -GPU intermediate memory buffer</td> - </tr> <tr> <td><a name="SkSurface_getRenderTargetHandle_backendHandleAccess"> <code><strong>backendHandleAccess </strong></code> </a></td> <td> -one of: <a href="#SkSurface_kFlushRead_BackendHandleAccess">kFlushRead BackendHandleAccess</a>, -<a href="#SkSurface_kFlushWrite_BackendHandleAccess">kFlushWrite BackendHandleAccess</a>, <a href="#SkSurface_kDiscardWrite_BackendHandleAccess">kDiscardWrite BackendHandleAccess</a></td> - </tr> -</table> - -### Return Value - -true if <a href="#Surface">Surface</a> is backed by GPU texture - -### Example - -<div><fiddle-embed name="dbc6c0e01a177ba03c87c00c32a43148" gpu="true"></fiddle-embed></div> - -### See Also - -<a href="#SkSurface_getTextureHandle">getTextureHandle</a> <a href="undocumented#GrBackendObject">GrBackendObject</a> <a href="#SkSurface_BackendHandleAccess">BackendHandleAccess</a> - --- <a name="SkSurface_getBackendTexture"></a> diff --git a/site/user/api/catalog.htm b/site/user/api/catalog.htm index 7f05b27c14..6c132e054d 100644 --- a/site/user/api/catalog.htm +++ b/site/user/api/catalog.htm @@ -5475,22 +5475,6 @@ "file": "SkImage_Reference", "name": "SkImage::getBackendTexture" }, - "SkImage_getTextureHandle": { - "code": "void draw(SkCanvas* canvas) {\n GrContext* context = canvas->getGrContext();\n if (!context) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n SkString str;\n int y = -10;\n for (auto origin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {\n sk_sp<SkImage> srcImage(SkImage::MakeFromTexture(context,\n backEndTexture, origin, kN32_SkColorType, kPremul_SkAlphaType, nullptr));\n GrSurfaceOrigin readBackOrigin;\n GrBackendObject readBackHandle = srcImage->getTextureHandle(false, &readBackOrigin);\n str.printf(\"readBackHandle: 0x%lx\", readBackHandle);\n canvas->drawString(str, 5, y += 30, paint);\n canvas->drawImage(srcImage, 80, y += 10);\n str.printf(\"origin: k%s_GrSurfaceOrigin\", readBackOrigin ? \"BottomLeft\" : \"TopLeft\");\n canvas->drawString(str, 5, y += srcImage->height() + 10, paint);\n }\n}", - "width": 256, - "height": 256, - "hash": "c321079049b0363c3b53bb76991768d4", - "file": "SkImage_Reference", - "name": "SkImage::getTextureHandle" -}, - "SkImage_getTextureHandle_a": { - "code": "void draw(SkCanvas* canvas) {\n auto drawImage = [=](sk_sp<SkImage> image, const char* label) -> void {\n if (nullptr == image) {\n return;\n }\n SkPaint paint;\n paint.setAntiAlias(true);\n paint.setTextAlign(SkPaint::kCenter_Align);\n canvas->drawImage(image, 0, image->height() / 4);\n canvas->drawString(label, image->width() / 2, image->height() / 8, paint);\n GrSurfaceOrigin readBackOrigin;\n GrBackendObject readBackHandle = image->getTextureHandle(false, &readBackOrigin);\n canvas->drawString(readBackHandle ? \"has readBackHandle\" : \"no readBackHandle\",\n image->width() / 2, image->height() * 11 / 8, paint);\n };\n drawImage(image, \"image\");\n canvas->translate(image->width(), 0);\n sk_sp<SkImage> textureImage(SkImage::MakeFromTexture(canvas->getGrContext(), backEndTexture,\n kTopLeft_GrSurfaceOrigin, kN32_SkColorType, kOpaque_SkAlphaType,\n nullptr));\n drawImage(textureImage, \"backEndTexture\");\n}", - "width": 256, - "height": 256, - "hash": "7161810a96a75540c55af0021a1e5bb9", - "file": "SkImage_Reference", - "name": "SkImage::getTextureHandle_2" -}, "SkImage_height": { "code": "void draw(SkCanvas* canvas) {\n canvas->translate(10, 10);\n canvas->drawImage(image, 0, 0);\n canvas->translate(image->width(), 0);\n SkPaint paint;\n paint.setTextAlign(SkPaint::kCenter_Align);\n paint.setVerticalText(true);\n canvas->drawLine(10, 0, 10, image->height(), paint);\n canvas->drawString(\"height\", 25, image->height() / 2, paint);\n}", "width": 256, @@ -7267,14 +7251,6 @@ "file": "SkColor_Reference", "name": "SkRGBToHSV" }, - "SkSurface_BackendHandleAccess": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n int y = 20;\n SkString str;\n paint.setTextSize(16);\n for (auto access : { SkSurface::kFlushRead_BackendHandleAccess, \n SkSurface::kFlushWrite_BackendHandleAccess,\n SkSurface::kDiscardWrite_BackendHandleAccess } ) {\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n str.printf(\"uniqueID=%d\", image->uniqueID());\n canvas->drawString(str, 20, y += 20, paint);\n GrBackendObject backendObject = gpuSurface->getTextureHandle(access);\n str.printf(\"backendObject %c= 0\", backendObject != 0 ? '!' : '=');\n canvas->drawString(str, 20, y += 20, paint);\n }\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n str.printf(\"final image uniqueID=%d\", image->uniqueID());\n canvas->drawString(str, 20, y += 20, paint);\n}", - "width": 256, - "height": 256, - "hash": "260a5ba014b00eeb5a74b3c6b8d31be4", - "file": "SkSurface_Reference", - "name": "SkSurface::BackendHandleAccess" -}, "SkSurface_MakeFromBackendTexture": { "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeFromBackendTexture(context,\n backEndTexture, kTopLeft_GrSurfaceOrigin, 0,\n kRGBA_8888_SkColorType, nullptr, nullptr);\n auto surfaceCanvas = gpuSurface->getCanvas();\n surfaceCanvas->drawString(\"GPU rocks!\", 20, 40, paint);\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n canvas->drawImage(image, 0, 0);\n}", "width": 256, @@ -7347,22 +7323,6 @@ "file": "SkSurface_Reference", "name": "SkSurface::getCanvas" }, - "SkSurface_getRenderTargetHandle": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject;\n if (gpuSurface->getRenderTargetHandle(&backendObject, \n SkSurface::kFlushRead_BackendHandleAccess)) {\n SkString str;\n str.printf(\"backendObject=%ld\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}", - "width": 256, - "height": 64, - "hash": "dbc6c0e01a177ba03c87c00c32a43148", - "file": "SkSurface_Reference", - "name": "SkSurface::getRenderTargetHandle" -}, - "SkSurface_getTextureHandle": { - "code": "void draw(SkCanvas* canvas) {\n SkPaint paint;\n paint.setTextSize(32);\n GrContext* context = canvas->getGrContext();\n if (!context) {\n canvas->drawString(\"GPU only!\", 20, 40, paint);\n return;\n }\n sk_sp<SkSurface> gpuSurface = SkSurface::MakeRenderTarget(\n context, SkBudgeted::kYes, SkImageInfo::MakeN32Premul(10, 10));\n GrBackendObject backendObject = gpuSurface->getTextureHandle(\n SkSurface::kFlushRead_BackendHandleAccess);\n if (backendObject) {\n SkString str;\n str.printf(\"backendObject=%08lx\", backendObject);\n paint.setTextSize(16);\n canvas->drawString(str, 20, 40, paint);\n }\n}", - "width": 256, - "height": 64, - "hash": "f7558a62985f70f2286307993db4b3bc", - "file": "SkSurface_Reference", - "name": "SkSurface::getTextureHandle" -}, "SkSurface_makeImageSnapshot": { "code": "void draw(SkCanvas* canvas) {\n sk_sp<SkSurface> big(SkSurface::MakeRasterN32Premul(64, 64));\n sk_sp<SkSurface> lil(big->makeSurface(SkImageInfo::MakeN32(32, 32, kPremul_SkAlphaType)));\n big->getCanvas()->clear(SK_ColorRED);\n lil->getCanvas()->clear(SK_ColorBLACK);\n sk_sp<SkImage> early(big->makeImageSnapshot());\n lil->draw(big->getCanvas(), 16, 16, nullptr);\n sk_sp<SkImage> later(big->makeImageSnapshot());\n canvas->drawImage(early, 0, 0);\n canvas->drawImage(later, 128, 0);\n}", "width": 256, |