Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a005071

Browse files
committed
Offset half texel correctly
1 parent 24c239c commit a005071

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

impeller/entity/contents/texture_contents.cc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,14 @@ bool TextureContents::Render(const ContentContext& renderer,
115115
return true; // Nothing to render.
116116
}
117117

118-
auto half_texel_size =
119-
Size(0.5 / texture_->GetSize().width, 0.5 / texture_->GetSize().height);
120118
auto texture_coords =
121119
Rect::MakeSize(texture_->GetSize()).Project(source_rect_);
120+
121+
// Expand the texture coordinates
122+
auto half_texel_size =
123+
Size(0.5 / texture_->GetSize().width, 0.5 / texture_->GetSize().height);
122124
texture_coords =
123-
texture_coords.Expand(-half_texel_size.width, -half_texel_size.height,
125+
texture_coords.Expand(half_texel_size.width, half_texel_size.height,
124126
half_texel_size.width, half_texel_size.height);
125127

126128
// Expand the destination rect by one pixel towards the bottom right. Map the

0 commit comments

Comments
 (0)