mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Add draw_texture/process_texture and use accelerated fill_rectangle for background draw
This commit is contained in:
parent
fbee7f9566
commit
3855cf6b9c
3 changed files with 214 additions and 28 deletions
|
@ -384,6 +384,25 @@ mod software_renderer {
|
|||
u8,
|
||||
u8,
|
||||
) -> bool,
|
||||
draw_texture: unsafe extern "C" fn(
|
||||
CppTargetPixelBufferUserData,
|
||||
i16,
|
||||
i16,
|
||||
i16,
|
||||
i16,
|
||||
*const u8,
|
||||
u16,
|
||||
i16,
|
||||
i16,
|
||||
u8,
|
||||
u16,
|
||||
u16,
|
||||
u16,
|
||||
u16,
|
||||
u32,
|
||||
u8,
|
||||
u8,
|
||||
) -> bool,
|
||||
}
|
||||
|
||||
impl TargetPixelBuffer for CppRgb8TargetPixelBuffer {
|
||||
|
@ -424,6 +443,48 @@ mod software_renderer {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_texture(
|
||||
&mut self,
|
||||
x: i16,
|
||||
y: i16,
|
||||
width: i16,
|
||||
height: i16,
|
||||
src: *const u8,
|
||||
src_stride: u16,
|
||||
src_width: i16,
|
||||
src_height: i16,
|
||||
src_pixel_format: u8,
|
||||
dx: u16,
|
||||
dy: u16,
|
||||
off_x: u16,
|
||||
off_y: u16,
|
||||
colorize: u32,
|
||||
alpha: u8,
|
||||
rotation: u8,
|
||||
) -> bool {
|
||||
unsafe {
|
||||
(self.draw_texture)(
|
||||
self.user_data,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
src,
|
||||
src_stride,
|
||||
src_width,
|
||||
src_height,
|
||||
src_pixel_format,
|
||||
dx,
|
||||
dy,
|
||||
off_x,
|
||||
off_y,
|
||||
colorize,
|
||||
alpha,
|
||||
rotation,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
|
@ -447,6 +508,25 @@ mod software_renderer {
|
|||
u8,
|
||||
u8,
|
||||
) -> bool,
|
||||
draw_texture: unsafe extern "C" fn(
|
||||
CppTargetPixelBufferUserData,
|
||||
i16,
|
||||
i16,
|
||||
i16,
|
||||
i16,
|
||||
*const u8,
|
||||
u16,
|
||||
i16,
|
||||
i16,
|
||||
u8,
|
||||
u16,
|
||||
u16,
|
||||
u16,
|
||||
u16,
|
||||
u32,
|
||||
u8,
|
||||
u8,
|
||||
) -> bool,
|
||||
}
|
||||
|
||||
impl TargetPixelBuffer for CppRgb565TargetPixelBuffer {
|
||||
|
@ -487,6 +567,48 @@ mod software_renderer {
|
|||
)
|
||||
}
|
||||
}
|
||||
|
||||
fn draw_texture(
|
||||
&mut self,
|
||||
x: i16,
|
||||
y: i16,
|
||||
width: i16,
|
||||
height: i16,
|
||||
src: *const u8,
|
||||
src_stride: u16,
|
||||
src_width: i16,
|
||||
src_height: i16,
|
||||
src_pixel_format: u8,
|
||||
dx: u16,
|
||||
dy: u16,
|
||||
off_x: u16,
|
||||
off_y: u16,
|
||||
colorize: u32,
|
||||
alpha: u8,
|
||||
rotation: u8,
|
||||
) -> bool {
|
||||
unsafe {
|
||||
(self.draw_texture)(
|
||||
self.user_data,
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
height,
|
||||
src,
|
||||
src_stride,
|
||||
src_width,
|
||||
src_height,
|
||||
src_pixel_format,
|
||||
dx,
|
||||
dy,
|
||||
off_x,
|
||||
off_y,
|
||||
colorize,
|
||||
alpha,
|
||||
rotation,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue