Fix colors incorrect when rendering directly to buf

This commit is contained in:
Kovid Goyal
2017-12-11 10:43:32 +05:30
parent 98d8ab2953
commit 0999ce159e

View File

@@ -301,6 +301,12 @@ coretext_render_color_glyph(CTFontRef font, uint8_t *buf, int glyph_id, unsigned
CTFontDrawGlyphs(font, &glyph, &CGPointZero, 1, ctx);
CGContextRelease(ctx);
CGColorSpaceRelease(color_space);
for (size_t r = 0; r < width; r++) {
for (size_t c = 0; c < height; c++, buf += 4) {
uint32_t px = (buf[0] << 24) | (buf[1] << 16) | (buf[2] << 8) | buf[3];
*((pixel*)buf) = px;
}
}
}