Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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 Recorder;
36class TextureProxyView;
37
38// Create TextureProxyView and SkColorType pair using pixel data in SkBitmap,
39// adding any necessary copy commands to Recorder
40std::tuple<TextureProxyView, SkColorType> MakeBitmapProxyView(Recorder*,
41 const SkBitmap&,
45
47 SkISize dimensions,
54
56 const SkColorInfo&,
57 const SkBitmap&,
61
62size_t ComputeSize(SkISize dimensions, const TextureInfo&);
63
65 const SkImage* srcImage,
66 SkIRect srcIRect,
67 const SkImageInfo& dstInfo,
68 SkImage::RescaleGamma rescaleGamma,
69 SkImage::RescaleMode rescaleMode);
70
72
73// Returns the underlying TextureProxyView if it's a non-YUVA Graphite-backed image.
76
77std::pair<sk_sp<SkImage>, SkSamplingOptions> GetGraphiteBacked(Recorder*,
78 const SkImage*,
80
81// Return the color format used for coverage mask textures that are rendered by a GPU
82// compute program.
84
85} // namespace skgpu::graphite
86
87namespace skif {
88
89class Backend;
90
91sk_sp<Backend> MakeGraphiteBackend(skgpu::graphite::Recorder* recorder,
92 const SkSurfaceProps&,
94
95} // namespace skif
96
97#endif // skgpu_graphite_TextureUtils_DEFINED
SkColorType
Definition SkColorType.h:19
Type::kYUV Type::kRGBA() int(0.7 *637)
RescaleMode
Definition SkImage.h:587
RescaleGamma
Definition SkImage.h:585
T * get() const
Definition SkRefCnt.h:303
sk_sp< SkImage > image
Definition examples.cpp:29
void * GraphitePromiseTextureFulfillContext
Definition Image.h:39
std::tuple< skgpu::graphite::BackendTexture, GraphitePromiseTextureReleaseContext >(*)(GraphitePromiseTextureFulfillContext) GraphitePromiseTextureFulfillProc
Definition Image.h:45
void(*)(GraphitePromiseTextureReleaseContext) GraphitePromiseTextureReleaseProc
Definition Image.h:47
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)
std::tuple< TextureProxyView, SkColorType > MakeBitmapProxyView(Recorder *recorder, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmapsIn, Mipmapped mipmapped, Budgeted budgeted)
sk_sp< SkImage > MakeFromBitmap(Recorder *recorder, const SkColorInfo &colorInfo, const SkBitmap &bitmap, sk_sp< SkMipmap > mipmaps, Budgeted budgeted, SkImage::RequiredProperties requiredProps)
sk_sp< TextureProxy > MakePromiseImageLazyProxy(const Caps *caps, SkISize dimensions, TextureInfo textureInfo, Volatile isVolatile, sk_sp< RefCntedCallback > releaseHelper, GraphitePromiseTextureFulfillProc fulfillProc, GraphitePromiseTextureFulfillContext fulfillContext, GraphitePromiseTextureReleaseProc textureReleaseProc)
std::pair< sk_sp< SkImage >, SkSamplingOptions > GetGraphiteBacked(Recorder *recorder, const SkImage *imageIn, SkSamplingOptions sampling)
size_t ComputeSize(SkISize dimensions, const TextureInfo &info)
TextureProxyView AsView(const SkImage *image)
Budgeted
Definition GpuTypes.h:35
Mipmapped
Definition GpuTypes.h:53