200 {
201 using namespace skgpu;
202
206
207
208 if (!
test.fGpuCanMakeSurfaces) {
211 }
212
214 return;
215 }
216
218
220 nativeExpected.
alloc(nativeII);
222
223 for (bool fullInit : { false, true }) {
225
226 bool finishedBECreate = false;
227 auto markFinished = [](void* context) {
228 *(bool*)context = true;
229 };
230 if (fullInit) {
232 GrRenderable::kNo, isProtected,
233 markFinished, &finishedBECreate);
234 } else {
239 Mipmapped::kNo,
240 GrRenderable::kNo,
241 isProtected,
242 markFinished,
243 &finishedBECreate);
244 }
247 while (backendTex.
isValid() && !finishedBECreate) {
249 }
250
252 backendTex,
256 nullptr);
258
259 {
261 nativeActual.
alloc(nativeII);
263
264 if (img->readPixels(dContext, nativeActual, 0, 0)) {
266 test.fColorType,
"SkImage::readPixels to native CT");
267 }
268
269
270
274
275 {
278 }
279
282
284 test.fColorType,
"SkSurface::readPixels to native CT");
285 }
286 }
287
288 {
290 f32Expected.
alloc(f32Unpremul);
292
293
294 {
296 f32Actual.
alloc(f32Unpremul);
298 if (img->readPixels(dContext, f32Actual, 0, 0)) {
300 test.fColorType,
"SkImage::readPixels to F32");
301 }
302 }
303
304
305
306 {
310
313
314 {
317 }
318
320 f32Actual.
alloc(f32Unpremul);
323
325 test.fColorType,
"SkSurface::drawn to RGBA8888");
326 }
327 }
328
329 img.reset();
332 }
333}
static constexpr int kSize
static SkColor4f get_opaque_white_expected_color(SkColorChannelFlag channels)
static void compare_pixmaps(skiatest::Reporter *reporter, const SkPixmap &expected, const SkPixmap &actual, SkColorType ct, const char *label)
@ kTopLeft_GrSurfaceOrigin
skgpu::Protected Protected
@ kPremul_SkAlphaType
pixel components are premultiplied by alpha
@ kRGBA_8888_SkColorType
pixel with 8 bits for red, green, blue, alpha; in 32-bit word
@ kRGBA_F32_SkColorType
pixel using C float for red, green, blue, alpha; in 128-bit word
static constexpr bool SkToBool(const T &x)
#define REPORTER_ASSERT(r, cond,...)
const GrCaps * caps() const
bool supportsProtectedContent() const
SK_API bool colorTypeSupportedAsSurface(SkColorType colorType) const
void checkAsyncWorkCompletion()
SK_API bool colorTypeSupportedAsImage(SkColorType) const
bool submit(GrSyncCpu sync=GrSyncCpu::kNo)
void flushAndSubmit(GrSyncCpu sync=GrSyncCpu::kNo)
void deleteBackendTexture(const GrBackendTexture &)
GrBackendTexture createBackendTexture(int width, int height, const GrBackendFormat &, skgpu::Mipmapped, GrRenderable, GrProtected=GrProtected::kNo, std::string_view label={})
GrDirectContextPriv priv()
void alloc(const SkImageInfo &)
void drawImage(const SkImage *image, SkScalar left, SkScalar top)
bool erase(SkColor color, const SkIRect &subset) const
constexpr SkColor4f kWhite
constexpr SkColor4f kTransparent
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)
SK_API sk_sp< SkSurface > RenderTarget(GrRecordingContext *context, skgpu::Budgeted budgeted, const SkImageInfo &imageInfo, int sampleCount, GrSurfaceOrigin surfaceOrigin, const SkSurfaceProps *surfaceProps, bool shouldCreateWithMips=false, bool isProtected=false)
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)