21static const int kSize = 8;
24 auto dContext = ctxInfo.directContext();
26 if (!dContext->supportsProtectedContent()) {
31 for (
bool textureable : {
true,
false }) {
32 for (
bool isProtected : {
true,
false }) {
48 isProtected ?
"protected" :
"unprotected");
59 for (
bool isProtected : {
true,
false }) {
78 for (
bool renderable : {
true,
false }) {
79 for (
bool isProtected : {
true,
false }) {
84 skgpu::Mipmapped::kNo,
104 dContext->deleteBackendTexture(beTex);
113 auto dContext = ctxInfo.directContext();
115 if (!dContext->supportsProtectedContent()) {
120 for (
bool isProtected : {
true,
false }) {
142 bool fCalled =
false;
143 std::unique_ptr<const SkSurface::AsyncReadResult> fResult;
147 auto context =
static_cast<AsyncContext*
>(c);
148 context->fResult = std::move(
result);
149 context->fCalled =
true;
157 auto dContext = ctxInfo.directContext();
159 if (!dContext->supportsProtectedContent()) {
164 for (
bool isProtected : {
true,
false }) {
177 AsyncContext cbContext;
181 SkSurface::RescaleGamma::kSrc,
182 SkSurface::RescaleMode::kNearest,
185 while (!cbContext.fCalled) {
186 dContext->checkAsyncWorkCompletion();
static void readback(const SkBitmap &src, int *result, int resultCount)
skgpu::Protected GrProtected
skgpu::Renderable GrRenderable
@ kTopLeft_GrSurfaceOrigin
static void async_callback(void *c, std::unique_ptr< const SkImage::AsyncReadResult > result)
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
static constexpr bool SkToBool(const T &x)
#define REPORTER_ASSERT(r, cond,...)
#define DEF_GANESH_TEST_FOR_ALL_CONTEXTS(name, reporter, context_info, ctsEnforcement)
void allocPixels(const SkImageInfo &info, size_t rowBytes)
void asyncRescaleAndReadPixels(const SkImageInfo &info, const SkIRect &srcRect, RescaleGamma rescaleGamma, RescaleMode rescaleMode, ReadPixelsCallback callback, ReadPixelsContext context)
static constexpr int kSize
sk_sp< SkSurface > CreateProtectedSkSurface(GrDirectContext *dContext, SkISize size, bool textureable, bool isProtected, const SkSurfaceProps *surfaceProps)
sk_sp< SkImage > CreateProtectedSkImage(GrDirectContext *dContext, SkISize size, SkColor4f color, bool isProtected)
void CheckImageBEProtection(SkImage *image, bool expectingProtected)
constexpr SkColor4f kTransparent
constexpr SkColor4f kBlue
SK_API sk_sp< SkImage > BorrowTextureFrom(GrRecordingContext *context, const GrBackendTexture &backendTexture, GrSurfaceOrigin origin, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
static constexpr SkIRect MakeWH(int32_t w, int32_t h)