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

Commit 1ce8237

Browse files
committed
Merge branch 'bugfix-19675' of https://github.com/livecodeian/livecode into feature-skia_directwrite
2 parents 3774a6f + 6c069da commit 1ce8237

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

libgraphics/include/graphics.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,9 @@ uint32_t MCGContextGetHeight(MCGContextRef context);
885885
// invalid and all further operations will be no-ops.
886886
bool MCGContextIsValid(MCGContextRef context);
887887

888+
// Returns whether the current context layer is fully opaque or contains a transparency channel.
889+
bool MCGContextIsLayerOpaque(MCGContextRef context);
890+
888891
// Graphics state operations
889892
void MCGContextSave(MCGContextRef context);
890893
void MCGContextRestore(MCGContextRef context);

libgraphics/src/context.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,11 @@ bool MCGContextIsValid(MCGContextRef self)
570570
return self != NULL && self -> is_valid;
571571
}
572572

573+
bool MCGContextIsLayerOpaque(MCGContextRef self)
574+
{
575+
return SkAlphaTypeIsOpaque(self->layer->canvas->imageInfo().alphaType());
576+
}
577+
573578
////////////////////////////////////////////////////////////////////////////////
574579
// Graphics state operations
575580

libgraphics/src/directwrite-skia.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,10 @@ void MCGContextDrawPlatformText(MCGContextRef self, const unichar_t *p_text, uin
385385
t_paint.setColor(MCGColorToSkColor(self->state->fill_color));
386386
t_paint.setBlendMode(MCGBlendModeToSkBlendMode(self->state->blend_mode));
387387

388+
// disable LCD rendering when backing layer may be transparent
389+
if (!MCGContextIsLayerOpaque(self))
390+
t_paint.setLCDRenderText(false);
391+
388392
// Force anti-aliasing on so that we get nicely-rendered text
389393
t_paint.setAntiAlias(true);
390394

0 commit comments

Comments
 (0)