81 {
86
88 if (maskFormat == expectedMaskFormat) {
90
92 if (srcRB != dstRB) {
95 memcpy(dst, src,
width * bbp);
96 src = (
const char*) src + srcRB;
97 dst = (
char*) dst + dstRB;
98 }
99 } else {
100 memcpy(dst, src, dstRB *
height);
101 }
102 } else {
103
104 const uint8_t*
bits =
reinterpret_cast<const uint8_t*
>(
src);
105 switch (expectedMaskFormat) {
106 case MaskFormat::kA8: {
107 uint8_t* bytes =
reinterpret_cast<uint8_t*
>(
dst);
109 break;
110 }
111 case MaskFormat::kA565: {
112 uint16_t*
rgb565 =
reinterpret_cast<uint16_t*
>(
dst);
114 break;
115 }
116 default:
118 }
119 }
120 } else if (maskFormat == MaskFormat::kA565 &&
121 expectedMaskFormat == MaskFormat::kARGB) {
122
123
124
125 static constexpr SkMasks masks{
126 {0b1111'1000'0000'0000, 11, 5},
127 {0b0000'0111'1110'0000, 5, 6},
128 {0b0000'0000'0001'1111, 0, 5},
129 {0, 0, 0}
130 };
133 char* dstRow = (char*)dst;
137 uint16_t color565 = 0;
138 memcpy(&color565, src, a565Bpp);
140 masks.getGreen(color565),
141 masks.getBlue(color565),
142 0xFF);
143 memcpy(dst, &colorRGBA, argbBpp);
144 src = (
const char*)src + a565Bpp;
145 dst = (
char*)dst + argbBpp;
146 }
147 dstRow += dstRB;
148 }
149 } else {
151 }
152}
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,...)
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)