dwrite: Use proper pixel format when accessing dib memory directly.

This commit is contained in:
Nikolay Sivov 2015-08-24 12:01:06 +03:00 committed by Alexandre Julliard
parent b9f05239d2
commit f52ef006cd
1 changed files with 6 additions and 0 deletions

View File

@ -299,6 +299,11 @@ static void blit_subpixel_888(struct dib_data *dib, int dib_width, const BYTE *s
} }
} }
static inline DWORD colorref_to_pixel_888(COLORREF color)
{
return (((color >> 16) & 0xff) | (color & 0xff00) | ((color << 16) & 0xff0000));
}
static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *iface, static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *iface,
FLOAT originX, FLOAT originY, DWRITE_MEASURING_MODE measuring_mode, FLOAT originX, FLOAT originY, DWRITE_MEASURING_MODE measuring_mode,
DWRITE_GLYPH_RUN const *run, IDWriteRenderingParams *params, COLORREF color, DWRITE_GLYPH_RUN const *run, IDWriteRenderingParams *params, COLORREF color,
@ -412,6 +417,7 @@ static HRESULT WINAPI rendertarget_DrawGlyphRun(IDWriteBitmapRenderTarget1 *ifac
UINT32 size = (target.right - target.left) * (target.bottom - target.top); UINT32 size = (target.right - target.left) * (target.bottom - target.top);
BYTE *bitmap; BYTE *bitmap;
color = colorref_to_pixel_888(color);
if (texturetype == DWRITE_TEXTURE_CLEARTYPE_3x1) if (texturetype == DWRITE_TEXTURE_CLEARTYPE_3x1)
size *= 3; size *= 3;
bitmap = heap_alloc_zero(size); bitmap = heap_alloc_zero(size);