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 /docs | |
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>
Diffstat (limited to 'docs')
-rw-r--r-- | docs/SkImage_Reference.bmh | 67 | ||||
-rw-r--r-- | docs/SkSurface_Reference.bmh | 91 |
2 files changed, 7 insertions, 151 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 |