Flutter Engine
The Flutter Engine
TextureUtils.h
Go to the documentation of this file.
1/*
2 * Copyright 2022 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
8#ifndef skgpu_graphite_TextureUtils_DEFINED
9#define skgpu_graphite_TextureUtils_DEFINED
10
16
17#include <functional>
18#include <tuple>
19#include <utility>
20
21class SkBitmap;
22enum SkColorType : int;
23class SkImage;
24struct SkImageInfo;
26
27namespace skgpu {
28 class RefCntedCallback;
29}
30
31namespace skgpu::graphite {
32
33class Caps;
34class Context;
35class Image;
36class Recorder;
37class TextureProxyView;
38
39// Create TextureProxyView and SkColorType pair using pixel data in SkBitmap,
40// adding any necessary copy commands to Recorder
41std::tuple<TextureProxyView, SkColorType> MakeBitmapProxyView(Recorder*,
42 const SkBitmap&,
46 std::string_view label);
47
49 SkISize dimensions,
56 std::string_view label);
57
59 const SkColorInfo&,
60 const SkBitmap&,
64 std::string_view label);
65
66size_t ComputeSize(SkISize dimensions, const TextureInfo&);
67
69 const SkImage* image,
70 const SkIRect& subset,
71 const SkColorInfo& dstColorInfo,
75 std::string_view label);
76
78 const SkImage* srcImage,
79 SkIRect srcIRect,
80 const SkImageInfo& dstInfo,
81 SkImage::RescaleGamma rescaleGamma,
82 SkImage::RescaleMode rescaleMode);
83
85
86// Returns the underlying TextureProxyView if it's a non-YUVA Graphite-backed image.
89
90std::pair<sk_sp<SkImage>, SkSamplingOptions> GetGraphiteBacked(Recorder*,
91 const SkImage*,
93
94// Return the color format used for coverage mask textures that are rendered by a GPU
95// compute program.
97
98} // namespace skgpu::graphite
99
100namespace skif {
101
102class Backend;
103
105 const SkSurfaceProps&,
107
108} // namespace skif
109
110#endif // skgpu_graphite_TextureUtils_DEFINED
SkBackingFit
Definition: SkBackingFit.h:16
SkColorType
Definition: SkColorType.h:19
RescaleMode
Definition: SkImage.h:587
RescaleGamma
Definition: SkImage.h:585
T * get() const
Definition: SkRefCnt.h:303
void * GraphitePromiseTextureFulfillContext
Definition: Image.h:41
std::tuple< skgpu::graphite::BackendTexture, GraphitePromiseTextureReleaseContext >(*)(GraphitePromiseTextureFulfillContext) GraphitePromiseTextureFulfillProc
Definition: Image.h:47
void(*)(GraphitePromiseTextureReleaseContext) GraphitePromiseTextureReleaseProc
Definition: Image.h:49
sk_sp< const SkImage > image
Definition: SkRecords.h:269
CanvasImage Image
Definition: dart_ui.cc:55
bool GenerateMipmaps(Recorder *recorder, sk_sp< TextureProxy > texture, const SkColorInfo &colorInfo)
SkColorType ComputeShaderCoverageMaskTargetFormat(const Caps *caps)
sk_sp< SkImage > RescaleImage(Recorder *recorder, const SkImage *srcImage, SkIRect srcIRect, const SkImageInfo &dstInfo, SkImage::RescaleGamma rescaleGamma, SkImage::RescaleMode rescaleMode)
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::pair< sk_sp< SkImage >, SkSamplingOptions > GetGraphiteBacked(Recorder *recorder, const SkImage *imageIn, SkSamplingOptions sampling)
size_t ComputeSize(SkISize dimensions, const TextureInfo &info)
std::tuple< TextureProxyView, SkColorType > MakeBitmapProxyView(Recorder *recorder, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmapsIn, Mipmapped mipmapped, Budgeted budgeted, std::string_view label)
TextureProxyView AsView(const SkImage *image)
sk_sp< Image > CopyAsDraw(Recorder *recorder, const SkImage *image, const SkIRect &subset, const SkColorInfo &dstColorInfo, Budgeted budgeted, Mipmapped mipmapped, SkBackingFit backingFit, std::string_view label)
Definition: GpuTools.h:21
Budgeted
Definition: GpuTypes.h:35
Mipmapped
Definition: GpuTypes.h:53
Definition: SkDevice.h:63
sk_sp< Backend > MakeGraphiteBackend(skgpu::graphite::Recorder *recorder, const SkSurfaceProps &surfaceProps, SkColorType colorType)
Definition: SkRect.h:32
Definition: SkSize.h:16