mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-12-23 10:11:54 +00:00
Make texture size not 1x1
This commit is contained in:
parent
4a9fb5162b
commit
de8bdc7209
1 changed files with 9 additions and 11 deletions
|
|
@ -22,7 +22,7 @@ impl<'i> Convert<Table<Raster<GPU>>, &'i WgpuExecutor> for Table<Vector> {
|
|||
log::debug!("rasterizing vector data with footprint {footprint:?}");
|
||||
|
||||
let vector = &self;
|
||||
log::debug!("{:?}", vector);
|
||||
log::debug!("{vector:?}");
|
||||
|
||||
// Create a Vello scene for this vector
|
||||
let mut scene = vello::Scene::new();
|
||||
|
|
@ -33,18 +33,14 @@ impl<'i> Convert<Table<Raster<GPU>>, &'i WgpuExecutor> for Table<Vector> {
|
|||
|
||||
// Render the scene to a GPU texture
|
||||
let resolution = footprint.resolution;
|
||||
let background = core_types::Color::BLACK;
|
||||
let background = core_types::Color::TRANSPARENT;
|
||||
|
||||
// Use async rendering to get the texture
|
||||
let texture = async {
|
||||
executor
|
||||
.render_vello_scene_to_texture(&scene, resolution, &context, background)
|
||||
.await
|
||||
.expect("Failed to render Vello scene to texture")
|
||||
};
|
||||
let texture = executor
|
||||
.render_vello_scene_to_texture(&scene, resolution, &context, background)
|
||||
.await
|
||||
.expect("Failed to render Vello scene to texture");
|
||||
|
||||
// Block on the texture creation (we're in an async context)
|
||||
let texture = futures::executor::block_on(texture);
|
||||
let device = &executor.context.device;
|
||||
let queue = &executor.context.queue;
|
||||
let mut encoder = device.create_command_encoder(&CommandEncoderDescriptor::default());
|
||||
|
|
@ -70,6 +66,8 @@ impl<'i> Convert<Table<Raster<GPU>>, &'i WgpuExecutor> for Table<Vector> {
|
|||
let command_buffer = encoder.finish();
|
||||
queue.submit([command_buffer]);
|
||||
|
||||
Table::new_from_element(Raster::new_gpu(new_texture))
|
||||
let mut table = Table::new_from_element(Raster::new_gpu(new_texture));
|
||||
*(table.get_mut(0).as_mut().unwrap().transform) = DAffine2::from_scale((texture.width() as f64, texture.height() as f64).into());
|
||||
table
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue