Flutter Engine
The Flutter Engine
Functions
GrBackendUtils.h File Reference
#include <cstddef>

Go to the source code of this file.

Functions

SkTextureCompressionType GrBackendFormatToCompressionType (const GrBackendFormat &format)
 
size_t GrBackendFormatBytesPerBlock (const GrBackendFormat &format)
 
size_t GrBackendFormatBytesPerPixel (const GrBackendFormat &format)
 
int GrBackendFormatStencilBits (const GrBackendFormat &format)
 

Function Documentation

◆ GrBackendFormatBytesPerBlock()

size_t GrBackendFormatBytesPerBlock ( const GrBackendFormat format)

Definition at line 52 of file GrBackendUtils.cpp.

52 {
53 switch (format.backend()) {
59#ifdef SK_DIRECT3D
60 DXGI_FORMAT dxgiFormat;
61 SkAssertResult(format.asDxgiFormat(&dxgiFormat));
62 return GrDxgiFormatBytesPerBlock(dxgiFormat);
63#else
64 break;
65#endif
66 }
68 SkTextureCompressionType compression = format.asMockCompressionType();
69 if (compression != SkTextureCompressionType::kNone) {
70 return skgpu::CompressedRowBytes(compression, 1);
71 } else if (format.isMockStencilFormat()) {
72 static constexpr int kMockStencilSize = 4;
73 return kMockStencilSize;
74 }
75 return GrColorTypeBytesPerPixel(format.asMockColorType());
76 }
78 break;
79 }
80 }
81 return 0;
82}
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static constexpr size_t GrDxgiFormatBytesPerBlock(DXGI_FORMAT format)
Definition: GrD3DUtil.h:103
static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct)
Definition: GrTypesPriv.h:896
SkTextureCompressionType
virtual size_t bytesPerBlock() const =0
static const GrBackendFormatData * GetBackendData(const GrBackendFormat &format)
uint32_t uint32_t * format
size_t CompressedRowBytes(SkTextureCompressionType type, int width)
Definition: DataUtils.cpp:179

◆ GrBackendFormatBytesPerPixel()

size_t GrBackendFormatBytesPerPixel ( const GrBackendFormat format)

Definition at line 84 of file GrBackendUtils.cpp.

84 {
86 return 0;
87 }
89}
SkTextureCompressionType GrBackendFormatToCompressionType(const GrBackendFormat &format)
size_t GrBackendFormatBytesPerBlock(const GrBackendFormat &format)

◆ GrBackendFormatStencilBits()

int GrBackendFormatStencilBits ( const GrBackendFormat format)

Definition at line 91 of file GrBackendUtils.cpp.

91 {
92 switch (format.backend()) {
98#ifdef SK_DIRECT3D
99 DXGI_FORMAT dxgiFormat;
100 SkAssertResult(format.asDxgiFormat(&dxgiFormat));
101 return GrDxgiFormatStencilBits(dxgiFormat);
102#else
103 break;
104#endif
105 }
106 case GrBackendApi::kMock: {
107 if (format.isMockStencilFormat()) {
108 static constexpr int kMockStencilBits = 8;
109 return kMockStencilBits;
110 }
111 break;
112 }
114 break;
115 }
116 }
117 return 0;
118}
static constexpr int GrDxgiFormatStencilBits(DXGI_FORMAT format)
Definition: GrD3DUtil.h:127
virtual int stencilBits() const =0

◆ GrBackendFormatToCompressionType()

SkTextureCompressionType GrBackendFormatToCompressionType ( const GrBackendFormat format)

Definition at line 22 of file GrBackendUtils.cpp.

22 {
23 switch (format.backend()) {
29#ifdef SK_DIRECT3D
30 DXGI_FORMAT dxgiFormat;
31 SkAssertResult(format.asDxgiFormat(&dxgiFormat));
32 switch (dxgiFormat) {
33 case DXGI_FORMAT_BC1_UNORM:
35 default:
37 }
38#else
39 break;
40#endif
41 }
43 return format.asMockCompressionType();
44 }
46 break;
47 }
48 }
50}
virtual SkTextureCompressionType compressionType() const =0