diff options
author | Brian Salomon <bsalomon@google.com> | 2018-03-19 14:01:21 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-19 18:43:25 +0000 |
commit | cb88470d82d646972a7e83d04bb19444d87dd840 (patch) | |
tree | d034fc09d11662ec1e81adf4ade799e9ae41548d | |
parent | be5947c2f38a79b7c709accfb1047d8fd06a0227 (diff) |
Remove SkSurface::MakeFromBackendTextureAsRenderTarget variant that doesn't take SkColorType
Bug: skia:6718
Change-Id: I3fabe2050394bfbd8ad2fa600d07323838308ae5
Reviewed-on: https://skia-review.googlesource.com/115087
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
-rw-r--r-- | docs/SkSurface_Reference.bmh | 53 | ||||
-rw-r--r-- | include/core/SkSurface.h | 24 | ||||
-rw-r--r-- | src/image/SkSurface.cpp | 9 | ||||
-rw-r--r-- | src/image/SkSurface_Gpu.cpp | 37 |
4 files changed, 11 insertions, 112 deletions
diff --git a/docs/SkSurface_Reference.bmh b/docs/SkSurface_Reference.bmh index 32562c61e2..41c1b79697 100644 --- a/docs/SkSurface_Reference.bmh +++ b/docs/SkSurface_Reference.bmh @@ -578,59 +578,6 @@ If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. const GrBackendTexture& backendTexture, GrSurfaceOrigin origin, int sampleCnt, - sk_sp<SkColorSpace> colorSpace, - const SkSurfaceProps* surfaceProps) -#In Constructor -#Line # creates Surface from GPU-backed texture ## - -Used to wrap a GPU-backed texture as a SkSurface. Skia will treat the texture as -a rendering target only, but unlike NewFromBackendRenderTarget, Skia will manage and own -the associated render target objects (but not the provided texture). Skia will not assume -ownership of the texture and the client must ensure the texture is valid for the lifetime -of the SkSurface. - -If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. - -#Param context GPU_Context ## -#Param backendTexture texture residing on GPU ## -#Param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin ## -#Param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing ## -#Param colorSpace range of colors ## -#Param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr -## - -#Return Surface if all parameters are valid; otherwise, nullptr ## - -#Example -#Platform !fiddle gpu - SkPaint paint; - paint.setTextSize(32); - GrContext* context = canvas->getGrContext(); - if (!context) { - canvas->drawString("GPU only!", 20, 40, paint); - return; - } - sk_sp<SkSurface> gpuSurface = SkSurface::MakeFromBackendTextureAsRenderTarget( - context, backEndTextureRenderTarget, kTopLeft_GrSurfaceOrigin, 0, - nullptr, nullptr); - auto surfaceCanvas = gpuSurface->getCanvas(); - surfaceCanvas->clear(SK_ColorWHITE); - surfaceCanvas->drawString("GPU rocks!", 20, 40, paint); - sk_sp<SkImage> image(gpuSurface->makeImageSnapshot()); - canvas->drawImage(image, 0, 0); -## - -#SeeAlso MakeFromBackendRenderTarget MakeRenderTarget - -#Method ## - -# ------------------------------------------------------------------------------ - -#Method static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin origin, - int sampleCnt, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* surfaceProps) diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 5a3887ef02..456ee362f2 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -286,30 +286,6 @@ public: @param backendTexture texture residing on GPU @param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin @param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing - @param colorSpace range of colors - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin origin, - int sampleCnt, - sk_sp<SkColorSpace> colorSpace, - const SkSurfaceProps* surfaceProps); - - /** Used to wrap a GPU-backed texture as a SkSurface. Skia will treat the texture as - a rendering target only, but unlike NewFromBackendRenderTarget, Skia will manage and own - the associated render target objects (but not the provided texture). Skia will not assume - ownership of the texture and the client must ensure the texture is valid for the lifetime - of the SkSurface. - - If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. - - @param context GPU context - @param backendTexture texture residing on GPU - @param origin one of: kBottomLeft_GrSurfaceOrigin, kTopLeft_GrSurfaceOrigin - @param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing @param colorType one of: kUnknown_SkColorType, kAlpha_8_SkColorType, kRGB_565_SkColorType, kARGB_4444_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType, diff --git a/src/image/SkSurface.cpp b/src/image/SkSurface.cpp index 26ee40e9fb..3ff7128014 100644 --- a/src/image/SkSurface.cpp +++ b/src/image/SkSurface.cpp @@ -311,15 +311,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext*, const GrBackendTexture&, GrSurfaceOrigin origin, int sampleCnt, - sk_sp<SkColorSpace>, - const SkSurfaceProps*) { - return nullptr; -} - -sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext*, - const GrBackendTexture&, - GrSurfaceOrigin origin, - int sampleCnt, SkColorType, sk_sp<SkColorSpace>, const SkSurfaceProps*) { diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp index 527c35b16a..c4479a2d24 100644 --- a/src/image/SkSurface_Gpu.cpp +++ b/src/image/SkSurface_Gpu.cpp @@ -465,6 +465,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont const GrBackendTexture& tex, GrSurfaceOrigin origin, int sampleCnt, + SkColorType colorType, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* props) { if (!context) { @@ -474,14 +475,19 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont return nullptr; } sampleCnt = SkTMax(1, sampleCnt); + GrBackendTexture texCopy = tex; + if (!validate_backend_texture(context, texCopy, &texCopy.fConfig, + sampleCnt, colorType, colorSpace, false)) { + return nullptr; + } sk_sp<GrRenderTargetContext> rtc( context->contextPriv().makeBackendTextureAsRenderTargetRenderTargetContext( - tex, - origin, - sampleCnt, - std::move(colorSpace), - props)); + texCopy, + origin, + sampleCnt, + std::move(colorSpace), + props)); if (!rtc) { return nullptr; } @@ -494,25 +500,4 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont return sk_make_sp<SkSurface_Gpu>(std::move(device)); } -sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context, - const GrBackendTexture& tex, - GrSurfaceOrigin origin, - int sampleCnt, - SkColorType colorType, - sk_sp<SkColorSpace> colorSpace, - const SkSurfaceProps* props) { - if (!context) { - return nullptr; - } - sampleCnt = SkTMax(1, sampleCnt); - GrBackendTexture texCopy = tex; - if (!validate_backend_texture(context, texCopy, &texCopy.fConfig, - sampleCnt, colorType, colorSpace, false)) { - return nullptr; - } - - return MakeFromBackendTextureAsRenderTarget(context, texCopy, origin, sampleCnt, colorSpace, - props); -} - #endif |