Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 1745fc3

Browse files
[[ ImageFilterUpdate ]] Tweaks to get libgraphics to compile on Windows with the updated version of libskia.
1 parent ebd0f26 commit 1745fc3

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

libgraphics/src/w32text.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ static bool w32_draw_text_using_mask_to_context_at_device_location(MCGContextRef
266266
t_has_opaque = w32_draw_text_process_transparent_buffer(p_context -> state -> fill_color, t_nearest_white, p_bounds . height, t_rgb_pxls, p_bounds . width, t_context_pxls, t_context_width);
267267

268268
// Blend the bitmap into the background (we definitely have transparent pixels).
269-
t_bitmap . setIsOpaque(false);
269+
t_bitmap . setAlphaType(kPremul_SkAlphaType);
270270
p_context -> layer -> canvas -> drawSprite(t_bitmap, p_bounds . x + p_location . x, p_bounds . y + p_location . y, &t_paint);
271271

272272
// If there are any opaque pixels, process those.
@@ -283,7 +283,7 @@ static bool w32_draw_text_using_mask_to_context_at_device_location(MCGContextRef
283283

284284
// Blend the bitmap into the background (we definitely have transparent pixels since
285285
// we've set some so!).
286-
t_bitmap . setIsOpaque(false);
286+
t_bitmap . setAlphaType(kPremul_SkAlphaType);
287287
p_context -> layer -> canvas -> drawSprite(t_bitmap, p_bounds . x + p_location . x, p_bounds . y + p_location . y, &t_paint);
288288
}
289289
}
@@ -300,7 +300,10 @@ static bool w32_draw_text_using_mask_to_context_at_device_location(MCGContextRef
300300
t_has_transparent = w32_draw_text_process_opaque_buffer(p_context -> state -> fill_color, p_bounds . height, t_rgb_pxls, p_bounds . width, t_context_pxls, t_context_width);
301301

302302
// Blend the bitmap into the background (we may have transparent pixels).
303-
t_bitmap . setIsOpaque(!t_has_transparent);
303+
if (t_has_transparent)
304+
t_bitmap . setAlphaType(kPremul_SkAlphaType);
305+
else
306+
t_bitmap . setAlphaType(kOpaque_SkAlphaType);
304307
p_context -> layer -> canvas -> drawSprite(t_bitmap, p_bounds . x + p_location . x, p_bounds . y + p_location . y, &t_paint);
305308

306309
// If there are any transparent pixels, process those.
@@ -314,7 +317,7 @@ static bool w32_draw_text_using_mask_to_context_at_device_location(MCGContextRef
314317
w32_draw_text_process_transparent_buffer(p_context -> state -> fill_color, t_nearest_white, p_bounds . height, t_rgb_pxls, p_bounds . width, t_context_pxls, t_context_width);
315318

316319
// Blend the bitmap into the background (we definitely have transparent pixels).
317-
t_bitmap . setIsOpaque(false);
320+
t_bitmap . setAlphaType(kPremul_SkAlphaType);
318321
p_context -> layer -> canvas -> drawSprite(t_bitmap, p_bounds . x + p_location . x, p_bounds . y + p_location . y, &t_paint);
319322
}
320323
}

0 commit comments

Comments
 (0)