Flutter Engine
The Flutter Engine
ImageFactories.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
41
42#include <string>
43
44namespace SkImages {
45
46using namespace skgpu::graphite;
47
50 const SkColorInfo& info) {
51 if (!texture.isValid() || texture.dimensions().width() <= 0 ||
52 texture.dimensions().height() <= 0) {
53 return false;
54 }
55
57 return false;
58 }
59
60 if (!caps->isTexturable(texture.info())) {
61 return false;
62 }
63
64 return caps->areColorTypeAndTextureInfoCompatible(info.colorType(), texture.info());
65}
66
68 const BackendTexture& backendTex,
69 SkColorType ct,
70 SkAlphaType at,
72 skgpu::Origin origin,
73 GenerateMipmapsFromBase genMipmaps,
74 TextureReleaseProc releaseP,
75 ReleaseContext releaseC,
76 std::string_view label) {
77 auto releaseHelper = skgpu::RefCntedCallback::Make(releaseP, releaseC);
78
79 if (!recorder) {
80 return nullptr;
81 }
82
83 const Caps* caps = recorder->priv().caps();
84
85 SkColorInfo info(ct, at, std::move(cs));
86
87 if (!validate_backend_texture(caps, backendTex, info)) {
88 return nullptr;
89 }
90
91 if (label.empty()) {
92 label = "WrappedImage";
93 }
94
96 recorder->priv().resourceProvider()->createWrappedTexture(backendTex, std::move(label));
97 if (!texture) {
98 SKGPU_LOG_W("Texture creation failed");
99 return nullptr;
100 }
101 texture->setReleaseCallback(std::move(releaseHelper));
102
104 SkASSERT(proxy);
105
106 skgpu::Swizzle swizzle = caps->getReadSwizzle(ct, backendTex.info());
107 TextureProxyView view(std::move(proxy), swizzle, origin);
108
109 if (genMipmaps == GenerateMipmapsFromBase::kYes) {
110 if (view.proxy()->mipmapped() == skgpu::Mipmapped::kNo) {
111 SKGPU_LOG_W("Failed SkImage:::WrapTexture because asked to generate mipmaps for "
112 "nonmipmapped texture");
113 return nullptr;
114 }
115 if (!GenerateMipmaps(recorder, view.refProxy(), info)) {
116 SKGPU_LOG_W("Failed SkImage::WrapTexture. Could not generate mipmaps.");
117 return nullptr;
118 }
119 }
120
121 return sk_make_sp<skgpu::graphite::Image>(view, info);
122}
123
125 const BackendTexture& backendTex,
126 SkColorType ct,
127 SkAlphaType at,
129 skgpu::Origin origin,
130 TextureReleaseProc releaseP,
131 ReleaseContext releaseC,
132 std::string_view label) {
133 return WrapTexture(recorder,
134 backendTex,
135 ct,
136 at,
137 std::move(cs),
138 origin,
140 releaseP,
141 releaseC,
142 std::move(label));
143}
144
146 const BackendTexture& backendTex,
147 SkColorType ct,
148 SkAlphaType at,
150 TextureReleaseProc releaseP,
151 ReleaseContext releaseC,
152 std::string_view label) {
153 return WrapTexture(recorder,
154 backendTex,
155 ct,
156 at,
157 std::move(cs),
160 releaseP,
161 releaseC,
162 std::move(label));
163}
164
166 SkISize dimensions,
167 const TextureInfo& textureInfo,
168 const SkColorInfo& colorInfo,
169 skgpu::Origin origin,
170 Volatile isVolatile,
172 GraphitePromiseImageReleaseProc imageReleaseProc,
173 GraphitePromiseTextureReleaseProc textureReleaseProc,
174 GraphitePromiseImageContext imageContext,
175 std::string_view label) {
176 // Our contract is that we will always call the _image_ release proc even on failure.
177 // We use the helper to convey the imageContext, so we need to ensure Make doesn't fail.
178 imageReleaseProc = imageReleaseProc ? imageReleaseProc : [](void*) {};
179 auto releaseHelper = skgpu::RefCntedCallback::Make(imageReleaseProc, imageContext);
180
181 if (!recorder) {
182 SKGPU_LOG_W("Null Recorder");
183 return nullptr;
184 }
185
186 const Caps* caps = recorder->priv().caps();
187
188 SkImageInfo info = SkImageInfo::Make(dimensions, colorInfo);
189 if (!SkImageInfoIsValid(info)) {
190 SKGPU_LOG_W("Invalid SkImageInfo");
191 return nullptr;
192 }
193
194 if (!caps->areColorTypeAndTextureInfoCompatible(colorInfo.colorType(), textureInfo)) {
195 SKGPU_LOG_W("Incompatible SkColorType and TextureInfo");
196 return nullptr;
197 }
198
199 // Non-YUVA promise images use the 'imageContext' for both the release proc and fulfill proc.
201 dimensions,
202 textureInfo,
203 isVolatile,
204 std::move(releaseHelper),
205 fulfillProc,
206 imageContext,
207 textureReleaseProc,
208 std::move(label));
209 if (!proxy) {
210 return nullptr;
211 }
212
213 skgpu::Swizzle swizzle = caps->getReadSwizzle(colorInfo.colorType(), textureInfo);
214 TextureProxyView view(std::move(proxy), swizzle, origin);
215 return sk_make_sp<Image>(view, colorInfo);
216}
217
219 SkISize dimensions,
220 const TextureInfo& textureInfo,
221 const SkColorInfo& colorInfo,
222 Volatile isVolatile,
224 GraphitePromiseImageReleaseProc imageReleaseProc,
225 GraphitePromiseTextureReleaseProc textureReleaseProc,
226 GraphitePromiseImageContext imageContext) {
227 return PromiseTextureFrom(recorder,
228 dimensions,
229 textureInfo,
230 colorInfo,
232 isVolatile,
233 fulfillProc,
234 imageReleaseProc,
235 textureReleaseProc,
236 imageContext);
237}
238
240 const YUVABackendTextureInfo& backendTextureInfo,
241 sk_sp<SkColorSpace> imageColorSpace,
242 skgpu::graphite::Volatile isVolatile,
244 GraphitePromiseImageReleaseProc imageReleaseProc,
245 GraphitePromiseTextureReleaseProc textureReleaseProc,
246 GraphitePromiseImageContext imageContext,
248 std::string_view label) {
249 // Our contract is that we will always call the _image_ release proc even on failure.
250 // We use the helper to convey the imageContext, so we need to ensure Make doesn't fail.
251 auto releaseHelper = skgpu::RefCntedCallback::Make(imageReleaseProc, imageContext);
252 if (!recorder) {
253 return nullptr;
254 }
255 // Precompute the dimensions for all promise texture planes
256 SkISize planeDimensions[SkYUVAInfo::kMaxPlanes];
257 if (!backendTextureInfo.yuvaInfo().planeDimensions(planeDimensions)) {
258 return nullptr;
259 }
260
261 std::string labelStr(label);
262 if (labelStr.empty()) {
263 labelStr = "Wrapped_PromiseYUVPlane";
264 } else {
265 labelStr += "_PromiseYUVPlane";
266 }
267
269 for (int i = 0; i < backendTextureInfo.numPlanes(); ++i) {
271 recorder->priv().caps(),
272 planeDimensions[i],
273 backendTextureInfo.planeTextureInfo(i),
274 isVolatile,
275 releaseHelper,
276 fulfillProc,
277 planeContexts[i],
278 textureReleaseProc,
279 labelStr);
280 // Promise YUVA images assume the default rgba swizzle.
281 planes[i] = TextureProxyView(std::move(lazyProxy));
282 }
283 return Image_YUVA::Make(recorder->priv().caps(), backendTextureInfo.yuvaInfo(),
284 SkSpan(planes), std::move(imageColorSpace));
285}
286
288 const SkImage* img,
289 const SkIRect& subset,
291 if (!recorder || !img) {
292 return nullptr;
293 }
294 auto subsetImg = img->makeSubset(recorder, subset, props);
295 return SkImages::TextureFromImage(recorder, subsetImg, props);
296}
297
300 const SkImageFilter* filter,
301 const SkIRect& subset,
302 const SkIRect& clipBounds,
303 SkIRect* outSubset,
304 SkIPoint* offset) {
305 if (!recorder || !src || !filter) {
306 return nullptr;
307 }
308
309 sk_sp<skif::Backend> backend = skif::MakeGraphiteBackend(recorder, {}, src->colorType());
310 return as_IFB(filter)->makeImageWithFilter(std::move(backend),
311 std::move(src),
312 subset,
313 clipBounds,
314 outSubset,
315 offset);
316}
317
319 const SkImage_Picture* img,
320 const SkImageInfo& info,
321 SkImage::RequiredProperties requiredProps) {
322 auto mm = requiredProps.fMipmapped ? skgpu::Mipmapped::kYes : skgpu::Mipmapped::kNo;
323 // Use a non-budgeted surface since the image wrapping the surface's texture will be owned by
324 // the client.
326 info,
327 "LazySkImagePictureTexture",
329 mm,
331 img->props());
332
333 if (!surface) {
334 SKGPU_LOG_E("Failed to create Surface");
335 return nullptr;
336 }
337
338 img->replay(surface->getCanvas());
339 // If the surface was created with mipmaps, they will be automatically generated when flushing
340 // the tasks when 'surface' goes out of scope.
341 return surface->asImage();
342}
343
344/*
345 * We only have 2 ways to create a Graphite-backed image.
346 *
347 * 1. Ask the generator to natively create one
348 * 2. Ask the generator to return RGB(A) data, which the GPU can convert
349 */
351 const SkImage_Lazy* img,
352 SkImage::RequiredProperties requiredProps) {
353 // 1. Ask the generator to natively create one.
354 {
356 sk_sp<SkImage> newImage =
358 static_cast<const SkImage_Picture*>(img),
359 img->imageInfo(),
360 requiredProps);
361 if (newImage) {
362 SkASSERT(as_IB(newImage)->isGraphiteBacked());
363 return newImage;
364 }
365 }
366 // There is not an analog to GrTextureGenerator for Graphite yet, but if there was,
367 // we would want to call it here.
368 }
369
370 // 2. Ask the generator to return a bitmap, which the GPU can convert.
371 {
373 if (img->getROPixels(nullptr, &bitmap, SkImage_Lazy::CachingHint::kDisallow_CachingHint)) {
374 return skgpu::graphite::MakeFromBitmap(recorder,
375 img->imageInfo().colorInfo(),
376 bitmap,
377 nullptr,
379 requiredProps,
380 "LazySkImageBitmapTexture");
381 }
382 }
383
384 return nullptr;
385}
386
388 const SkImage* image,
389 SkImage::RequiredProperties requiredProps) {
390 if (!recorder || !image) {
391 return nullptr;
392 }
393 if (image->dimensions().area() <= 1) {
394 requiredProps.fMipmapped = false;
395 }
396
397 auto ib = as_IB(image);
398 SkASSERT(!ib->isGaneshBacked());
399
400 if (ib->isRasterBacked()) {
401 auto raster = static_cast<const SkImage_Raster*>(ib);
402 return skgpu::graphite::MakeFromBitmap(recorder,
403 raster->imageInfo().colorInfo(),
404 raster->bitmap(),
405 raster->refMips(),
407 requiredProps,
408 "RasterBitmapTexture");
409 }
410 if (ib->isLazyGenerated()) {
412 recorder, static_cast<const SkImage_Lazy*>(ib), requiredProps);
413 }
414 SkASSERT(ib->isGraphiteBacked());
415 return ib->makeSubset(recorder, ib->bounds(), requiredProps);
416}
417
419 const SkYUVAPixmaps& pixmaps,
420 SkImage::RequiredProperties requiredProps,
421 bool limitToMaxTextureSize,
422 sk_sp<SkColorSpace> imageColorSpace,
423 std::string_view label) {
424 if (!recorder) {
425 return nullptr;
426 }
427
428 // Determine if we have to resize the pixmaps
429 const int maxTextureSize = recorder->priv().caps()->maxTextureSize();
430 const int maxDim = std::max(pixmaps.yuvaInfo().width(), pixmaps.yuvaInfo().height());
431
432 SkYUVAPixmapInfo finalInfo = pixmaps.pixmapsInfo();
433 if (maxDim > maxTextureSize) {
434 if (!limitToMaxTextureSize) {
435 return nullptr;
436 }
437 float scale = static_cast<float>(maxTextureSize) / maxDim;
438 SkISize newDimensions = {
439 std::min(static_cast<int>(pixmaps.yuvaInfo().width() * scale), maxTextureSize),
440 std::min(static_cast<int>(pixmaps.yuvaInfo().height() * scale), maxTextureSize)};
441 finalInfo = SkYUVAPixmapInfo(pixmaps.yuvaInfo().makeDimensions(newDimensions),
442 pixmaps.dataType(),
443 /*rowBytes=*/nullptr);
444 }
445
446 std::string labelStr(label);
447 if (labelStr.empty()) {
448 labelStr = "YUVRasterBitmapPlane";
449 } else {
450 labelStr += "_YUVBitmapPlane";
451 }
452
453 auto mipmapped = requiredProps.fMipmapped ? skgpu::Mipmapped::kYes : skgpu::Mipmapped::kNo;
455 for (int i = 0; i < finalInfo.yuvaInfo().numPlanes(); ++i) {
456 SkBitmap bmp;
457 if (maxDim > maxTextureSize) {
458 // Rescale the data before uploading
459 if (!bmp.tryAllocPixels(finalInfo.planeInfo(i)) ||
460 !pixmaps.plane(i).scalePixels(bmp.pixmap(), SkFilterMode::kLinear)) {
461 return nullptr;
462 }
463 } else {
464 // Use original data to upload
465 if (!bmp.installPixels(pixmaps.plane(i))) {
466 return nullptr;
467 }
468 }
469
470 auto [view, _] = MakeBitmapProxyView(recorder, bmp, /*mipmapsIn=*/nullptr,
471 mipmapped, skgpu::Budgeted::kNo,
472 labelStr);
473 planes[i] = std::move(view);
474 }
475 return Image_YUVA::Make(recorder->priv().caps(), finalInfo.yuvaInfo(),
476 SkSpan(planes), std::move(imageColorSpace));
477}
478
480 const YUVABackendTextures& yuvaTextures,
481 sk_sp<SkColorSpace> imageColorSpace,
482 TextureReleaseProc releaseP,
483 ReleaseContext releaseC,
484 std::string_view label) {
485 auto releaseHelper = skgpu::RefCntedCallback::Make(releaseP, releaseC);
486 if (!recorder) {
487 return nullptr;
488 }
489
490 std::string labelStr(label);
491 if (labelStr.empty()) {
492 labelStr = "Wrapped_YUVPlane";
493 } else {
494 labelStr += "_YUVPlane";
495 }
496
498 for (int i = 0; i < yuvaTextures.yuvaInfo().numPlanes(); ++i) {
500 yuvaTextures.planeTexture(i), labelStr);
501 if (!texture) {
502 SKGPU_LOG_W("Failed to wrap backend texture for YUVA plane %d", i);
503 return nullptr;
504 }
505 texture->setReleaseCallback(releaseHelper);
506 planes[i] = TextureProxyView(TextureProxy::Wrap(std::move(texture)));
507 }
508
509 return Image_YUVA::Make(recorder->priv().caps(), yuvaTextures.yuvaInfo(),
510 SkSpan(planes), std::move(imageColorSpace));
511}
512
514 const SkYUVAInfo& yuvaInfo,
516 sk_sp<SkColorSpace> imageColorSpace) {
517 // This factory is just a view of the images, so does not actually trigger any work on the
518 // recorder. It is just used to provide the Caps.
519 return Image_YUVA::WrapImages(recorder->priv().caps(), yuvaInfo, images, imageColorSpace);
520}
521
522} // namespace SkImages
const char * backend
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
#define SKGPU_LOG_E(fmt,...)
Definition: Log.h:38
#define SKGPU_LOG_W(fmt,...)
Definition: Log.h:40
SkAlphaType
Definition: SkAlphaType.h:26
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkColorType
Definition: SkColorType.h:19
static SkImageFilter_Base * as_IFB(SkImageFilter *filter)
static bool SkColorInfoIsValid(const SkColorInfo &info)
static bool SkImageInfoIsValid(const SkImageInfo &info)
static SkImage_Base * as_IB(SkImage *image)
Definition: SkImage_Base.h:201
bool installPixels(const SkImageInfo &info, void *pixels, size_t rowBytes, void(*releaseProc)(void *addr, void *context), void *context)
Definition: SkBitmap.cpp:323
const SkPixmap & pixmap() const
Definition: SkBitmap.h:133
bool tryAllocPixels(const SkImageInfo &info, size_t rowBytes)
Definition: SkBitmap.cpp:271
SkColorType colorType() const
Definition: SkImageInfo.h:140
sk_sp< SkImage > makeImageWithFilter(sk_sp< skif::Backend > backend, sk_sp< SkImage > src, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset) const
bool getROPixels(GrDirectContext *, SkBitmap *, CachingHint) const override
SkImage_Base::Type type() const override
Definition: SkImage_Lazy.h:73
const SkSurfaceProps * props() const
void replay(SkCanvas *) const
const SkImageInfo & imageInfo() const
Definition: SkImage.h:279
SkISize dimensions() const
Definition: SkImage.h:297
virtual sk_sp< SkImage > makeSubset(GrDirectContext *direct, const SkIRect &subset) const =0
bool scalePixels(const SkPixmap &dst, const SkSamplingOptions &) const
int width() const
Definition: SkYUVAInfo.h:172
static constexpr int kMaxPlanes
Definition: SkYUVAInfo.h:98
SkYUVAInfo makeDimensions(SkISize) const
Definition: SkYUVAInfo.cpp:366
int height() const
Definition: SkYUVAInfo.h:173
int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const
Definition: SkYUVAInfo.h:192
const SkYUVAInfo & yuvaInfo() const
const SkImageInfo & planeInfo(int i) const
DataType dataType() const
const SkYUVAInfo & yuvaInfo() const
SkYUVAPixmapInfo pixmapsInfo() const
const SkPixmap & plane(int i) const
static sk_sp< RefCntedCallback > Make(Callback proc, Context ctx)
const TextureInfo & info() const
skgpu::Swizzle getReadSwizzle(SkColorType, const TextureInfo &) const
Definition: Caps.cpp:129
bool isTexturable(const TextureInfo &) const
Definition: Caps.cpp:66
bool areColorTypeAndTextureInfoCompatible(SkColorType, const TextureInfo &) const
Definition: Caps.cpp:85
int maxTextureSize() const
Definition: Caps.h:141
static sk_sp< Image_YUVA > Make(const Caps *caps, const SkYUVAInfo &yuvaInfo, SkSpan< TextureProxyView > planes, sk_sp< SkColorSpace > imageColorSpace)
static sk_sp< Image_YUVA > WrapImages(const Caps *caps, const SkYUVAInfo &yuvaInfo, SkSpan< const sk_sp< SkImage > > images, sk_sp< SkColorSpace > imageColorSpace)
const Caps * caps() const
Definition: RecorderPriv.h:31
ResourceProvider * resourceProvider()
Definition: RecorderPriv.h:33
sk_sp< Texture > createWrappedTexture(const BackendTexture &, std::string_view label)
static sk_sp< Surface > Make(Recorder *recorder, const SkImageInfo &info, std::string_view label, Budgeted budgeted, Mipmapped mipmapped=Mipmapped::kNo, SkBackingFit backingFit=SkBackingFit::kExact, const SkSurfaceProps *props=nullptr)
sk_sp< TextureProxy > refProxy() const
static sk_sp< TextureProxy > Wrap(sk_sp< Texture >)
Mipmapped mipmapped() const
Definition: TextureProxy.h:35
const TextureInfo & planeTextureInfo(int i) const
BackendTexture planeTexture(int i) const
VkSurfaceKHR surface
Definition: main.cc:49
static float max(float r, float g, float b)
Definition: hsl.cpp:49
static float min(float r, float g, float b)
Definition: hsl.cpp:48
FlTexture * texture
std::array< MockImage, 3 > images
Definition: mock_vulkan.cc:41
void * GraphitePromiseTextureFulfillContext
Definition: Image.h:41
SK_API sk_sp< SkImage > TextureFromYUVAPixmaps(GrRecordingContext *context, const SkYUVAPixmaps &pixmaps, skgpu::Mipmapped buildMips, bool limitToMaxTextureSize, sk_sp< SkColorSpace > imageColorSpace)
SK_API sk_sp< SkImage > PromiseTextureFrom(skgpu::graphite::Recorder *, SkISize dimensions, const skgpu::graphite::TextureInfo &, const SkColorInfo &, skgpu::Origin origin, skgpu::graphite::Volatile, GraphitePromiseTextureFulfillProc, GraphitePromiseImageReleaseProc, GraphitePromiseTextureReleaseProc, GraphitePromiseImageContext, std::string_view label={})
SK_API sk_sp< SkImage > WrapTexture(skgpu::graphite::Recorder *, const skgpu::graphite::BackendTexture &, SkColorType colorType, SkAlphaType alphaType, sk_sp< SkColorSpace > colorSpace, skgpu::Origin origin, GenerateMipmapsFromBase generateMipmapsFromBase, TextureReleaseProc=nullptr, ReleaseContext=nullptr, std::string_view label={})
void(*)(GraphitePromiseImageContext) GraphitePromiseImageReleaseProc
Definition: Image.h:48
void * GraphitePromiseImageContext
Definition: Image.h:38
static bool validate_backend_texture(const skgpu::graphite::Caps *caps, const skgpu::graphite::BackendTexture &texture, const SkColorInfo &info)
SK_API sk_sp< SkImage > TextureFromImage(GrDirectContext *, const SkImage *, skgpu::Mipmapped=skgpu::Mipmapped::kNo, skgpu::Budgeted=skgpu::Budgeted::kYes)
SK_API sk_sp< SkImage > SubsetTextureFrom(GrDirectContext *context, const SkImage *img, const SkIRect &subset)
SK_API sk_sp< SkImage > PromiseTextureFromYUVA(skgpu::graphite::Recorder *, const skgpu::graphite::YUVABackendTextureInfo &, sk_sp< SkColorSpace > imageColorSpace, skgpu::graphite::Volatile, GraphitePromiseTextureFulfillProc, GraphitePromiseImageReleaseProc, GraphitePromiseTextureReleaseProc, GraphitePromiseImageContext imageContext, GraphitePromiseTextureFulfillContext planeContexts[], std::string_view label={})
std::tuple< skgpu::graphite::BackendTexture, GraphitePromiseTextureReleaseContext >(*)(GraphitePromiseTextureFulfillContext) GraphitePromiseTextureFulfillProc
Definition: Image.h:47
SK_API sk_sp< SkImage > TextureFromYUVATextures(GrRecordingContext *context, const GrYUVABackendTextures &yuvaTextures, sk_sp< SkColorSpace > imageColorSpace, TextureReleaseProc textureReleaseProc=nullptr, ReleaseContext releaseContext=nullptr)
void * ReleaseContext
Definition: SkImage.h:50
static sk_sp< SkImage > generate_picture_texture(skgpu::graphite::Recorder *recorder, const SkImage_Picture *img, const SkImageInfo &info, SkImage::RequiredProperties requiredProps)
SK_API sk_sp< SkImage > MakeWithFilter(sk_sp< SkImage > src, const SkImageFilter *filter, const SkIRect &subset, const SkIRect &clipBounds, SkIRect *outSubset, SkIPoint *offset)
SK_API sk_sp< SkImage > TextureFromYUVAImages(skgpu::graphite::Recorder *recorder, const SkYUVAInfo &yuvaInfo, SkSpan< const sk_sp< SkImage > > images, sk_sp< SkColorSpace > imageColorSpace)
void(*)(GraphitePromiseTextureReleaseContext) GraphitePromiseTextureReleaseProc
Definition: Image.h:49
GenerateMipmapsFromBase
Definition: Image.h:33
static sk_sp< SkImage > make_texture_image_from_lazy(skgpu::graphite::Recorder *recorder, const SkImage_Lazy *img, SkImage::RequiredProperties requiredProps)
void(*)(ReleaseContext) TextureReleaseProc
Definition: SkImageGanesh.h:45
sk_sp< const SkImage > image
Definition: SkRecords.h:269
Definition: bitmap.py:1
bool GenerateMipmaps(Recorder *recorder, sk_sp< TextureProxy > texture, const SkColorInfo &colorInfo)
sk_sp< TextureProxy > MakePromiseImageLazyProxy(const Caps *caps, SkISize dimensions, TextureInfo textureInfo, Volatile isVolatile, sk_sp< RefCntedCallback > releaseHelper, GraphitePromiseTextureFulfillProc fulfillProc, GraphitePromiseTextureFulfillContext fulfillContext, GraphitePromiseTextureReleaseProc textureReleaseProc, std::string_view label)
sk_sp< SkImage > MakeFromBitmap(Recorder *recorder, const SkColorInfo &colorInfo, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmaps, Budgeted budgeted, SkImage::RequiredProperties requiredProps, std::string_view label)
std::tuple< TextureProxyView, SkColorType > MakeBitmapProxyView(Recorder *recorder, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmapsIn, Mipmapped mipmapped, Budgeted budgeted, std::string_view label)
Origin
Definition: GpuTypes.h:77
sk_sp< Backend > MakeGraphiteBackend(skgpu::graphite::Recorder *recorder, const SkSurfaceProps &surfaceProps, SkColorType colorType)
const Scalar scale
SeparatedVector2 offset
Definition: SkRect.h:32
Definition: SkSize.h:16
constexpr int64_t area() const
Definition: SkSize.h:39
const SkColorInfo & colorInfo() const
Definition: SkImageInfo.h:404
static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at)