Skip to content

Commit 1b3b105

Browse files
committed
[[ Bug 11415 ]] Uninitialized value in measurment cache key causing strange text layout problems.
1 parent 332c9a8 commit 1b3b105

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

docs/notes/bugfix-11415.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Random issues with text layout and alignment.

libgraphics/src/cachetable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static hash_t MCGHashBytes(const void *p_bytes, size_t length)
2727
{
2828
// 32-bit FNV-1a hash algorithm
2929
const uint32_t t_prime = 16777619;
30-
const uint32_t t_bias = 2166136261;
30+
const uint32_t t_bias = 2166136261U;
3131

3232
const uint8_t *t_data = (const uint8_t*)p_bytes;
3333
uint32_t t_hash = t_bias;

libgraphics/src/context.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2682,8 +2682,10 @@ MCGFloat MCGContextMeasurePlatformText(MCGContextRef self, const unichar_t *p_te
26822682

26832683
// MW-2013-11-07: [[ Bug 11393 ]] Make sure we take into account the 'ideal' flag
26842684
// when looking up metrics.
2685+
// MW-2013-11-12: [[ Bug 11415 ]] Make sure we use p_font.size and not t_size if not
2686+
// ideal - otherwise uninitialized values abound...
26852687
int16_t t_size;
2686-
t_size = p_font . ideal ? -p_font . size : t_size;
2688+
t_size = p_font . ideal ? -p_font . size : p_font . size;
26872689
MCMemoryCopy(t_key_ptr, &t_size, sizeof(p_font . size));
26882690
t_key_ptr += sizeof(p_font . size);
26892691

0 commit comments

Comments
 (0)