Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Truncate glyph positions to whole device pixels #294

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Truncate glyph positions to whole device pixels

This addresses servo/servo#11751: The quad shader rounds rect boundaries to
the nearest pixel.  This can cause glyphs' relative positions to change if one
glyph is shifted left while the next is shifted right.  Using floor() ensures
that all glyphs are shifted in the same direction.
  • Loading branch information
mbrubeck committed Jun 17, 2016
commit b2d751da2d2e21bfa852a3d67112f6d0db29502c
@@ -436,8 +436,8 @@ impl<'a> BatchBuilder<'a> {
glyph_key.index = glyph.index;
let image_info = resource_cache.get_glyph(&glyph_key, frame_id);
if let Some(image_info) = image_info {
let x = glyph.x + image_info.user_data.x0 as f32 / device_pixel_ratio - blur_offset;
let y = glyph.y - image_info.user_data.y0 as f32 / device_pixel_ratio - blur_offset;
let x = glyph.x.floor() + image_info.user_data.x0 as f32 / device_pixel_ratio - blur_offset;
let y = glyph.y.floor() - image_info.user_data.y0 as f32 / device_pixel_ratio - blur_offset;

let width = image_info.requested_rect.size.width as f32 / device_pixel_ratio;
let height = image_info.requested_rect.size.height as f32 / device_pixel_ratio;
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.