Flutter Engine
The Flutter Engine
GrYUVATextureProxies.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 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 GrYUVATextureProxies_DEFINED
9#define GrYUVATextureProxies_DEFINED
10
15
17
19public:
21
22 /** Assumes all planes are sampled with a default "rgba" swizzle. */
26
27 /**
28 * When uploading pixmaps to textures it is important that we account for how the original
29 * pixmaps' channels are swizzled into the texture during upload. This will compute a swizzle
30 * for each texture based on the original color types and the views' swizzles. The views must
31 * all have the same origin or the result will be an invalid GrYUVATextureProxies.
32 */
36
39
42
43 const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; }
44
45 int numPlanes() const { return fYUVAInfo.numPlanes(); }
46
47 GrSurfaceOrigin textureOrigin() const { return fTextureOrigin; }
48
49 // Overall set of YUVA proxies is mip mapped if each plane is mip mapped.
50 skgpu::Mipmapped mipmapped() const { return fMipmapped; }
51
52 GrSurfaceProxy* proxy(int i) const { return fProxies[i].get(); }
53
54 const std::array<sk_sp<GrSurfaceProxy>, SkYUVAInfo::kMaxPlanes>& proxies() const {
55 return fProxies;
56 }
57
58 sk_sp<GrSurfaceProxy> refProxy(int i) const { return fProxies[i]; }
59
61 return {fProxies[i], fTextureOrigin, skgpu::Swizzle::RGBA()};
62 }
63
64 bool isValid() const { return fYUVAInfo.isValid(); }
65
66 const SkYUVAInfo::YUVALocations& yuvaLocations() const { return fYUVALocations; }
67
68private:
69 std::array<sk_sp<GrSurfaceProxy>, SkYUVAInfo::kMaxPlanes> fProxies;
70 SkYUVAInfo fYUVAInfo;
73 SkYUVAInfo::YUVALocations fYUVALocations = {};
74};
75
76#endif
GrColorType
Definition: GrTypesPriv.h:540
GrSurfaceOrigin
Definition: GrTypes.h:147
@ kTopLeft_GrSurfaceOrigin
Definition: GrTypes.h:148
GrYUVATextureProxies(GrYUVATextureProxies &&)=default
GrSurfaceProxy * proxy(int i) const
GrYUVATextureProxies & operator=(GrYUVATextureProxies &&)=default
const SkYUVAInfo & yuvaInfo() const
const std::array< sk_sp< GrSurfaceProxy >, SkYUVAInfo::kMaxPlanes > & proxies() const
skgpu::Mipmapped mipmapped() const
GrYUVATextureProxies & operator=(const GrYUVATextureProxies &)=default
GrYUVATextureProxies(const GrYUVATextureProxies &)=default
GrSurfaceProxyView makeView(int i) const
sk_sp< GrSurfaceProxy > refProxy(int i) const
const SkYUVAInfo::YUVALocations & yuvaLocations() const
GrYUVATextureProxies()=default
GrSurfaceOrigin textureOrigin() const
int numPlanes() const
Definition: SkYUVAInfo.h:204
static constexpr int kMaxPlanes
Definition: SkYUVAInfo.h:98
std::array< YUVALocation, kYUVAChannelCount > YUVALocations
Definition: SkYUVAInfo.h:32
bool isValid() const
Definition: SkYUVAInfo.h:233
static constexpr Swizzle RGBA()
Definition: Swizzle.h:66
Mipmapped
Definition: GpuTypes.h:53