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 <bsalomon@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
632de605a3
commit
c828109ebd
@ -989,7 +989,7 @@ Caller must overwrite the entire back-end object.
|
||||
canvas->drawString(str, 20, y += 20, paint);
|
||||
##
|
||||
|
||||
#SeeAlso getTextureHandle getRenderTargetHandle
|
||||
#SeeAlso getTextureHandle
|
||||
|
||||
#Enum ##
|
||||
|
||||
@ -1032,58 +1032,7 @@ or when Surface is deleted.
|
||||
}
|
||||
##
|
||||
|
||||
#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<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
|
||||
#SeeAlso GrBackendObject BackendHandleAccess
|
||||
|
||||
#Method ##
|
||||
|
||||
|
@ -440,25 +440,6 @@ public:
|
||||
@return GPU texture reference
|
||||
*/
|
||||
GrBackendObject getTextureHandle(BackendHandleAccess backendHandleAccess);
|
||||
|
||||
/** Returns true and stores the GPU back-end reference of the render target used
|
||||
by SkSurface in backendObject.
|
||||
|
||||
Return false if SkSurface 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 SkSurface,
|
||||
or when SkSurface 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 SkSurface is backed by GPU texture
|
||||
*/
|
||||
bool getRenderTargetHandle(GrBackendObject* backendObject,
|
||||
BackendHandleAccess backendHandleAccess);
|
||||
#endif
|
||||
|
||||
/** Retrieves the backend texture. If Surface has no backend texture, an invalid
|
||||
|
@ -99,14 +99,6 @@ public:
|
||||
};
|
||||
virtual ResolveType getResolveType() const = 0;
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
/**
|
||||
* Return the native ID or handle to the rendertarget, depending on the
|
||||
* platform. e.g. on OpenGL, return the FBO ID.
|
||||
*/
|
||||
virtual GrBackendObject getRenderTargetHandle() const = 0;
|
||||
#endif
|
||||
|
||||
virtual GrBackendRenderTarget getBackendRenderTarget() const = 0;
|
||||
|
||||
// Checked when this object is asked to attach a stencil buffer.
|
||||
|
@ -61,10 +61,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject getRenderTargetHandle() const override { return fRTFBOID; }
|
||||
#endif
|
||||
|
||||
GrBackendRenderTarget getBackendRenderTarget() const override;
|
||||
|
||||
bool canAttemptStencilAttachment() const override;
|
||||
|
@ -120,12 +120,6 @@ public:
|
||||
return {this->width(), this->height(), this->numColorSamples(), numStencilBits, fInfo};
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject getRenderTargetHandle() const override {
|
||||
return reinterpret_cast<GrBackendObject>(&fInfo);
|
||||
}
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// constructor for subclasses
|
||||
GrMockRenderTarget(GrMockGpu* gpu, const GrSurfaceDesc& desc,
|
||||
@ -160,10 +154,6 @@ public:
|
||||
this->registerWithCacheWrapped();
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject getRenderTargetHandle() const override { return 0; }
|
||||
#endif
|
||||
|
||||
GrTexture* asTexture() override { return this; }
|
||||
GrRenderTarget* asRenderTarget() override { return this; }
|
||||
const GrTexture* asTexture() const override { return this; }
|
||||
|
@ -40,10 +40,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject getRenderTargetHandle() const override;
|
||||
#endif
|
||||
|
||||
GrBackendRenderTarget getBackendRenderTarget() const override {
|
||||
return GrBackendRenderTarget(); // invalid
|
||||
}
|
||||
|
@ -63,13 +63,6 @@ GrMtlGpu* GrMtlRenderTarget::getMtlGpu() const {
|
||||
return static_cast<GrMtlGpu*>(this->getGpu());
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject GrMtlRenderTarget::getRenderTargetHandle() const {
|
||||
void* voidRT = (__bridge_retained void*)fRenderTexture;
|
||||
return (GrBackendObject)voidRT;
|
||||
}
|
||||
#endif
|
||||
|
||||
void GrMtlRenderTarget::onAbandon() {
|
||||
fRenderTexture = nil;
|
||||
fResolveTexture = nil;
|
||||
|
@ -352,15 +352,6 @@ void GrVkRenderTarget::onAbandon() {
|
||||
}
|
||||
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject GrVkRenderTarget::getRenderTargetHandle() const {
|
||||
// If the render target is multisampled, we currently return the ImageInfo for the resolved
|
||||
// image. If we only wrap the msaa target (currently not implemented) we should return a handle
|
||||
// to that instead.
|
||||
return (GrBackendObject)&fInfo;
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendRenderTarget GrVkRenderTarget::getBackendRenderTarget() const {
|
||||
return GrBackendRenderTarget(this->width(), this->height(), this->numColorSamples(),
|
||||
fInfo, this->grVkImageLayout());
|
||||
|
@ -70,10 +70,6 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject getRenderTargetHandle() const override;
|
||||
#endif
|
||||
|
||||
GrBackendRenderTarget getBackendRenderTarget() const override;
|
||||
|
||||
void getAttachmentsDescriptor(GrVkRenderPass::AttachmentsDescriptor* desc,
|
||||
|
@ -222,10 +222,6 @@ void SkSurface::writePixels(const SkBitmap& src, int x, int y) {
|
||||
GrBackendObject SkSurface::getTextureHandle(BackendHandleAccess access) {
|
||||
return asSB(this)->onGetTextureHandle(access);
|
||||
}
|
||||
|
||||
bool SkSurface::getRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) {
|
||||
return asSB(this)->onGetRenderTargetHandle(obj, access);
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendTexture SkSurface::getBackendTexture(BackendHandleAccess access) {
|
||||
|
@ -23,10 +23,6 @@ public:
|
||||
virtual GrBackendObject onGetTextureHandle(BackendHandleAccess) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
virtual GrBackendTexture onGetBackendTexture(BackendHandleAccess);
|
||||
|
@ -63,15 +63,6 @@ GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) {
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SkSurface_Gpu::onGetRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) {
|
||||
GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
|
||||
if (!rt) {
|
||||
return false;
|
||||
}
|
||||
*obj = rt->getRenderTargetHandle();
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
GrBackendTexture SkSurface_Gpu::onGetBackendTexture(BackendHandleAccess access) {
|
||||
|
@ -25,7 +25,6 @@ public:
|
||||
|
||||
#ifdef SK_SUPPORT_LEGACY_BACKEND_OBJECTS
|
||||
GrBackendObject onGetTextureHandle(BackendHandleAccess) override;
|
||||
bool onGetRenderTargetHandle(GrBackendObject*, BackendHandleAccess) override;
|
||||
#endif
|
||||
|
||||
GrBackendTexture onGetBackendTexture(BackendHandleAccess) override;
|
||||
|
Loading…
Reference in New Issue
Block a user