mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Remove some condition in CanvasData::write_image
The surface creation should never fail.
This commit is contained in:
parent
6c469b90b1
commit
2bf4fcd9bd
1 changed files with 15 additions and 15 deletions
|
@ -639,23 +639,23 @@ fn write_image(
|
|||
} else {
|
||||
Filter::Point
|
||||
};
|
||||
// azure_hl operates with integers. We need to cast the image size
|
||||
let image_size = image_size.to_i32();
|
||||
|
||||
if let Some(source_surface) =
|
||||
draw_target.create_source_surface_from_data(&image_data,
|
||||
image_size,
|
||||
image_size.width * 4,
|
||||
SurfaceFormat::B8G8R8A8) {
|
||||
let draw_surface_options = DrawSurfaceOptions::new(filter, true);
|
||||
let draw_options = DrawOptions::new(global_alpha, composition_op, AntialiasMode::None);
|
||||
|
||||
draw_target.draw_surface(source_surface,
|
||||
dest_rect.to_azure_style(),
|
||||
image_rect.to_azure_style(),
|
||||
draw_surface_options,
|
||||
draw_options);
|
||||
}
|
||||
let source_surface = draw_target.create_source_surface_from_data(
|
||||
&image_data,
|
||||
image_size,
|
||||
image_size.width * 4,
|
||||
SurfaceFormat::B8G8R8A8,
|
||||
).unwrap();
|
||||
let draw_surface_options = DrawSurfaceOptions::new(filter, true);
|
||||
let draw_options = DrawOptions::new(global_alpha, composition_op, AntialiasMode::None);
|
||||
draw_target.draw_surface(
|
||||
source_surface,
|
||||
dest_rect.to_azure_style(),
|
||||
image_rect.to_azure_style(),
|
||||
draw_surface_options,
|
||||
draw_options,
|
||||
);
|
||||
}
|
||||
|
||||
pub trait PointToi32 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue