Snap text vertices to pixels in ui painter
This commit is contained in:
parent
ef9e820e90
commit
f15dd26bb9
1 changed files with 11 additions and 4 deletions
|
|
@ -284,10 +284,17 @@ void main()
|
||||||
std::uint32_t const depth = impl().depth++;
|
std::uint32_t const depth = impl().depth++;
|
||||||
std::uint32_t const base = batch.vertices.size();
|
std::uint32_t const base = batch.vertices.size();
|
||||||
|
|
||||||
batch.vertices.push_back({rect.corner(0.f, 0.f), depth, color, tc(0.f, 0.f)});
|
auto round = [](geom::point<float, 2> p)
|
||||||
batch.vertices.push_back({rect.corner(1.f, 0.f), depth, color, tc(1.f, 0.f)});
|
{
|
||||||
batch.vertices.push_back({rect.corner(0.f, 1.f), depth, color, tc(0.f, 1.f)});
|
p[0] = std::round(p[0]);
|
||||||
batch.vertices.push_back({rect.corner(1.f, 1.f), depth, color, tc(1.f, 1.f)});
|
p[1] = std::round(p[1]);
|
||||||
|
return p;
|
||||||
|
};
|
||||||
|
|
||||||
|
batch.vertices.push_back({round(rect.corner(0.f, 0.f)), depth, color, tc(0.f, 0.f)});
|
||||||
|
batch.vertices.push_back({round(rect.corner(1.f, 0.f)), depth, color, tc(1.f, 0.f)});
|
||||||
|
batch.vertices.push_back({round(rect.corner(0.f, 1.f)), depth, color, tc(0.f, 1.f)});
|
||||||
|
batch.vertices.push_back({round(rect.corner(1.f, 1.f)), depth, color, tc(1.f, 1.f)});
|
||||||
|
|
||||||
batch.indices.insert(batch.indices.end(), {base + 0, base + 1, base + 2, base + 2, base + 1, base + 3});
|
batch.indices.insert(batch.indices.end(), {base + 0, base + 1, base + 2, base + 2, base + 1, base + 3});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue