From 7444c3c51887e6aa5324b6fc6aa82768d7830389 Mon Sep 17 00:00:00 2001 From: Greg Daniel Date: Sat, 14 Apr 2018 17:29:58 +0000 Subject: Revert "Delete getRenderTargetHandle call on SkSurface." This reverts commit c828109ebd1519134b1c3fa168519ac07a31fe05. Reason for revert: Need to fix flutter Original change's description: > Delete getRenderTargetHandle call on SkSurface. > > All clients and internal code should be switched (once changes land soon) > to the new getBackendRenderTarget call instead. > > Bug: skia: > Change-Id: I6f490b6d26a72f37f97216be04e541483206510d > Reviewed-on: https://skia-review.googlesource.com/121103 > Reviewed-by: Brian Salomon > Commit-Queue: Greg Daniel TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia: Change-Id: I571298f839757fcdedcd8117519e740ac7ef1344 Reviewed-on: https://skia-review.googlesource.com/121480 Reviewed-by: Greg Daniel Commit-Queue: Greg Daniel --- docs/SkSurface_Reference.bmh | 55 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'docs') diff --git a/docs/SkSurface_Reference.bmh b/docs/SkSurface_Reference.bmh index d3fb13529f..e9c520106b 100644 --- a/docs/SkSurface_Reference.bmh +++ b/docs/SkSurface_Reference.bmh @@ -989,7 +989,7 @@ Caller must overwrite the entire back-end object. canvas->drawString(str, 20, y += 20, paint); ## -#SeeAlso getTextureHandle +#SeeAlso getTextureHandle getRenderTargetHandle #Enum ## @@ -1032,7 +1032,58 @@ or when Surface is deleted. } ## -#SeeAlso GrBackendObject BackendHandleAccess +#SeeAlso getRenderTargetHandle GrBackendObject BackendHandleAccess + +#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 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 #Method ## -- cgit v1.2.3