Remove SkSurface::MakeFromBackendTextureAsRenderTarget from public API

Still some more work to do to remove internal usage.


Bug: skia:9832
Change-Id: Id0403d92debc26af2002630a4dfcf960c9343260
Docs-Preview: https://skia.org/?cl=292719
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292719
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
This commit is contained in:
Brian Salomon 2020-05-28 17:44:05 -04:00 committed by Skia Commit-Bot
parent 19ef693adc
commit c0d88a12d1
9 changed files with 11 additions and 71 deletions

View File

@ -9,6 +9,12 @@ Milestone 85
* <insert new release notes here>
* Remove SkSurface::MakeFromBackendTextureAsRenderTarget.
This factory existed to work around issues with GL_TEXTURE_RECTANGLE that existed
in Chrome's command buffer. Those issues have since been resolved. Use
SkSurface::MakeFromBackendTexutre or SkSurface::MakeFromBackendRenderTarget instead.
https://review.skia.org/292719
* Adds submittedProc callback to GrFlushInfo which will be called when the work
from the flush call is submitted to the GPU. This is specifically useful for knowing
when semahpores sent with the flush have been submitted and can be waiting on.

View File

@ -1,24 +0,0 @@
#if 0 // Disabled until updated to use current API.
// Copyright 2019 Google LLC.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#include "tools/fiddle/examples.h"
// HASH=5e87093b9cbe95124ae14cbe77091eb7
REG_FIDDLE(Surface_MakeFromBackendTextureAsRenderTarget, 256, 256, false, 3) {
void draw(SkCanvas* canvas) {
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, backEndTexture, kTopLeft_GrSurfaceOrigin, 0,
kRGBA_8888_SkColorType, nullptr, nullptr);
auto surfaceCanvas = gpuSurface->getCanvas();
surfaceCanvas->drawString("GPU rocks!", 20, 40, paint);
sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());
canvas->drawImage(image, 0, 0);
}
} // END FIDDLE
#endif // Disabled until updated to use current API.

View File

@ -234,29 +234,8 @@ public:
RenderTargetReleaseProc releaseProc = nullptr,
ReleaseContext releaseContext = nullptr);
/** Wraps a GPU-backed texture into SkSurface. Caller must ensure backendTexture is
valid for the lifetime of returned SkSurface. If sampleCnt greater than zero,
creates an intermediate MSAA SkSurface which is used for drawing backendTexture.
SkSurface is returned if all parameters are valid. backendTexture is valid if
its pixel configuration agrees with colorSpace and context; for instance, if
backendTexture has an sRGB configuration, then context must support sRGB,
and colorSpace must be present. Further, backendTexture width and height must
not exceed context capabilities.
Returned SkSurface is available only for drawing into, and cannot generate an
SkImage.
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 sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing
@param colorSpace range of colors; may be nullptr
@param surfaceProps LCD striping orientation and setting for device independent
fonts; may be nullptr
@return SkSurface if all parameters are valid; otherwise, nullptr
*/
#if GR_TEST_UTILS
// TODO: Remove this.
static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context,
const GrBackendTexture& backendTexture,
GrSurfaceOrigin origin,
@ -264,6 +243,7 @@ public:
SkColorType colorType,
sk_sp<SkColorSpace> colorSpace,
const SkSurfaceProps* surfaceProps);
#endif
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
/** Private.

View File

@ -9119,14 +9119,6 @@
"hash": "d3aec071998f871809f515e58abb1b0e",
"file": "SkSurface_Reference",
"name": "SkSurface::MakeFromBackendTexture"
},
"SkSurface_MakeFromBackendTextureAsRenderTarget": {
"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::MakeFromBackendTextureAsRenderTarget(\n context, 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,
"height": 256,
"hash": "5e87093b9cbe95124ae14cbe77091eb7",
"file": "SkSurface_Reference",
"name": "SkSurface::MakeFromBackendTextureAsRenderTarget"
},
"SkSurface_MakeRenderTarget": {
"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 SkImageInfo info = SkImageInfo::MakeN32(256, 64, kOpaque_SkAlphaType);\n for (auto surfaceOrigin : { kTopLeft_GrSurfaceOrigin, kBottomLeft_GrSurfaceOrigin } ) {\n auto gpuSurface(SkSurface::MakeRenderTarget(context, SkBudgeted::kNo, info, 0,\n surfaceOrigin, nullptr));\n auto surfaceCanvas = gpuSurface->getCanvas();\n surfaceCanvas->clear(SK_ColorWHITE);\n surfaceCanvas->drawString(\"GPU rocks!\", 20, 40, paint);\n sk_sp<SkImage> image(gpuSurface->makeImageSnapshot());\n canvas->drawImage(image, 0, 0);\n canvas->translate(0, 128);\n }\n}",

View File

@ -523,16 +523,6 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext*,
return nullptr;
}
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext*,
const GrBackendTexture&,
GrSurfaceOrigin origin,
int sampleCnt,
SkColorType,
sk_sp<SkColorSpace>,
const SkSurfaceProps*) {
return nullptr;
}
void SkSurface::flushAndSubmit() {
this->flush(BackendSurfaceAccess::kNoAccess, GrFlushInfo());
}

View File

@ -635,6 +635,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendRenderTarget(GrContext* context,
return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
#if GR_TEST_UTILS
sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* context,
const GrBackendTexture& tex,
GrSurfaceOrigin origin,
@ -668,6 +669,7 @@ sk_sp<SkSurface> SkSurface::MakeFromBackendTextureAsRenderTarget(GrContext* cont
}
return sk_make_sp<SkSurface_Gpu>(std::move(device));
}
#endif
#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26
sk_sp<SkSurface> SkSurface::MakeFromAHardwareBuffer(GrContext* context,

View File

@ -1039,7 +1039,6 @@
#include "../../docs/examples/State_Stack_b.cpp"
#include "../../docs/examples/Stroke_Width.cpp"
#include "../../docs/examples/Surface_MakeFromBackendTexture.cpp"
#include "../../docs/examples/Surface_MakeFromBackendTextureAsRenderTarget.cpp"
#include "../../docs/examples/Surface_MakeNull.cpp"
#include "../../docs/examples/Surface_MakeRaster.cpp"
#include "../../docs/examples/Surface_MakeRasterDirect.cpp"

View File

@ -174,7 +174,6 @@ docs/examples/Region_op_6.cpp
docs/examples/Region_setPath.cpp
docs/examples/Region_writeToMemory.cpp
docs/examples/Surface_MakeFromBackendTexture.cpp
docs/examples/Surface_MakeFromBackendTextureAsRenderTarget.cpp
docs/examples/Surface_MakeRenderTarget.cpp
docs/examples/Surface_MakeRenderTarget_2.cpp
docs/examples/Surface_MakeRenderTarget_3.cpp

View File

@ -3906,10 +3906,6 @@ SkRegion
SkSurface
static sk_sp<SkSurface> MakeFromBackendTexture(GrContext* context, const GrBackendTexture& backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* surfaceProps);
[Surface_MakeFromBackendTextureAsRenderTarget]
SkSurface
static sk_sp<SkSurface> MakeFromBackendTextureAsRenderTarget(GrContext* context, const GrBackendTexture& backendTexture, GrSurfaceOrigin origin, int sampleCnt, SkColorType colorType, sk_sp<SkColorSpace> colorSpace, const SkSurfaceProps* surfaceProps);
[Surface_MakeNull]
SkSurface
static sk_sp<SkSurface> MakeNull(int width, int height);