Skip to content

Commit

Permalink
Fix motion-predicted texts looking corrupted/positioned wrong due to …
Browse files Browse the repository at this point in the history
…ID collisions.
  • Loading branch information
bolrog committed May 26, 2021
1 parent 18cfd5c commit d74130e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/d2dx/D2DXContext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1288,7 +1288,13 @@ Offset D2DXContext::BeginDrawText(

if (IsFeatureEnabled(Feature::TextMotionPrediction))
{
const uint64_t textId = ((uint64_t)returnAddress << 32ULL) | (uint64_t)(uintptr_t)str;
auto hash = fnv_32a_buf((void*)str, wcslen(str), FNV1_32A_INIT);

const uint64_t textId =
(((uint64_t)(returnAddress & 0xFFFFFF) << 40ULL) |
((uint64_t)((uintptr_t)str & 0xFFFFFF) << 16ULL)) ^
(uint64_t)hash;

offset = _textMotionPredictor.GetOffset(textId, pos);
}

Expand Down

0 comments on commit d74130e

Please sign in to comment.