80 {
85
87 if (maskFormat == expectedMaskFormat) {
89
91 if (srcRB != dstRB) {
95 src = (
const char*)
src + srcRB;
97 }
98 } else {
100 }
101 } else {
102
103 const uint8_t*
bits =
reinterpret_cast<const uint8_t*
>(
src);
104 switch (expectedMaskFormat) {
105 case MaskFormat::kA8: {
106 uint8_t* bytes =
reinterpret_cast<uint8_t*
>(
dst);
108 break;
109 }
110 case MaskFormat::kA565: {
111 uint16_t*
rgb565 =
reinterpret_cast<uint16_t*
>(
dst);
113 break;
114 }
115 default:
117 }
118 }
119 } else if (maskFormat == MaskFormat::kA565 &&
120 expectedMaskFormat == MaskFormat::kARGB) {
121
122
123
124 static constexpr SkMasks masks{
125 {0b1111'1000'0000'0000, 11, 5},
126 {0b0000'0111'1110'0000, 5, 6},
127 {0b0000'0000'0001'1111, 0, 5},
128 {0, 0, 0}
129 };
133 char* dstRow = (
char*)
dst;
137 uint16_t color565 = 0;
138 memcpy(&color565,
src, a565Bpp);
139 uint32_t color8888;
140
141
142 if (kBGRAIsNative) {
144 masks.getGreen(color565),
145 masks.getRed(color565),
146 0xFF);
147 } else {
149 masks.getGreen(color565),
150 masks.getBlue(color565),
151 0xFF);
152 }
153 memcpy(
dst, &color8888, argbBpp);
154 src = (
const char*)
src + a565Bpp;
155 dst = (
char*)
dst + argbBpp;
156 }
157 dstRow += dstRB;
158 }
159 } else {
161 }
162}
static void expand_bits(INT_TYPE *dst, const uint8_t *src, int width, int height, int dstRowBytes, int srcRowBytes)
static GrColor GrColorPackRGBA(unsigned r, unsigned g, unsigned b, unsigned a)
static const uint16_t rgb565[kNumPixels]
#define SK_ABORT(message,...)
@ kBGRA_8888_SkColorType
pixel with 8 bits for blue, green, red, alpha; in 32-bit word
SkMask::Format maskFormat() const
const void * image() const
static skgpu::MaskFormat FormatFromSkGlyph(SkMask::Format format)
constexpr int MaskFormatBytesPerPixel(MaskFormat format)
@ kBW_Format
1bit per pixel mask (e.g. monochrome)