Nikolay Sivov : dwrite: Use D3DCOLORVALUE equivalent to avoid nameless unions.

Alexandre Julliard julliard at winehq.org
Tue Mar 23 16:54:32 CDT 2021


Module: wine
Branch: master
Commit: 183394cd862b47461475fa90dad190f8233dccbe
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=183394cd862b47461475fa90dad190f8233dccbe

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Mar 23 19:07:12 2021 +0300

dwrite: Use D3DCOLORVALUE equivalent to avoid nameless unions.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dwrite/Makefile.in |  1 -
 dlls/dwrite/opentype.c  | 18 +++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/dlls/dwrite/Makefile.in b/dlls/dwrite/Makefile.in
index e975812eae5..8b612989386 100644
--- a/dlls/dwrite/Makefile.in
+++ b/dlls/dwrite/Makefile.in
@@ -2,7 +2,6 @@ MODULE    = dwrite.dll
 IMPORTLIB = dwrite
 IMPORTS   = user32 gdi32 advapi32
 EXTRAINCL = $(FREETYPE_CFLAGS)
-EXTRADEFS = -DWINE_NO_NAMELESS_EXTENSION
 
 C_SRCS = \
 	analyzer.c \
diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c
index 6e5624c622a..8d6133545a2 100644
--- a/dlls/dwrite/opentype.c
+++ b/dlls/dwrite/opentype.c
@@ -2858,6 +2858,13 @@ HRESULT opentype_get_cpal_entries(const struct dwrite_fonttable *cpal, unsigned
     unsigned int num_palettes, num_palette_entries, i;
     const struct cpal_color_record *records;
     const struct cpal_header_0 *header;
+    struct d3d_color
+    {
+        float r;
+        float g;
+        float b;
+        float a;
+    } *colors = (void *)entries;
 
     header = table_read_ensure(cpal, 0, sizeof(*header));
 
@@ -2883,11 +2890,12 @@ HRESULT opentype_get_cpal_entries(const struct dwrite_fonttable *cpal, unsigned
 
     first_entry_index += GET_BE_WORD(header->color_record_indices[palette]);
 
-    for (i = 0; i < entry_count; i++) {
-        entries[i].u1.r = records[first_entry_index + i].red   / 255.0f;
-        entries[i].u2.g = records[first_entry_index + i].green / 255.0f;
-        entries[i].u3.b = records[first_entry_index + i].blue  / 255.0f;
-        entries[i].u4.a = records[first_entry_index + i].alpha / 255.0f;
+    for (i = 0; i < entry_count; ++i)
+    {
+        colors[i].r = records[first_entry_index + i].red   / 255.0f;
+        colors[i].g = records[first_entry_index + i].green / 255.0f;
+        colors[i].b = records[first_entry_index + i].blue  / 255.0f;
+        colors[i].a = records[first_entry_index + i].alpha / 255.0f;
     }
 
     return S_OK;




More information about the wine-cvs mailing list