Experimental Software Renderer: fix texture offset for partial draws when hwaccel

This commit is contained in:
Sam Cristall 2025-03-26 13:59:16 -06:00 committed by Simon Hausmann
parent 7a25256050
commit c4a4913ce5

View file

@ -1179,6 +1179,11 @@ impl<B: target_pixel_buffer::TargetPixelBuffer> RenderToBuffer<'_, B> {
fn process_texture_impl(&mut self, geometry: PhysicalRect, texture: SceneTexture<'_>) {
self.foreach_region(&geometry, |buffer, rect, extra_left_clip, extra_right_clip| {
let tex_src_off_x = (texture.extra.off_x + Fixed::from_integer(extra_left_clip as u16))
* texture.extra.dx.truncate();
let tex_src_off_y = (texture.extra.off_y
+ Fixed::from_integer((rect.origin.y - geometry.origin.y) as u16))
* texture.extra.dy.truncate();
if !buffer.draw_texture(
rect.origin.x,
rect.origin.y,
@ -1192,8 +1197,8 @@ impl<B: target_pixel_buffer::TargetPixelBuffer> RenderToBuffer<'_, B> {
height: texture.source_size().height as u16,
delta_x: texture.extra.dx.0,
delta_y: texture.extra.dy.0,
source_offset_x: texture.extra.off_x.0,
source_offset_y: texture.extra.off_y.0,
source_offset_x: tex_src_off_x.0,
source_offset_y: tex_src_off_y.0,
},
texture.extra.colorize.as_argb_encoded(),
texture.extra.alpha,