getting the canvasframe set up for text

This commit is contained in:
2019-10-07 23:34:11 -07:00
parent e4a9170515
commit 86eb27f86d
5 changed files with 79 additions and 81 deletions

View File

@@ -51,45 +51,3 @@ impl CanvasImage {
}
}
#[derive(Clone)]
pub struct CanvasTextCache {
//pub(crate) handle: Arc<CanvasTextCacheHandle>,
pub(crate) buffer: Arc<CpuAccessibleBuffer<u8>>,
pub(crate) size: (u32, u32),
}
impl CanvasTextCache {
pub fn get_descriptor_set(&self,
pipeline: Arc<dyn GraphicsPipelineAbstract + Sync + Send>,
sampler: Arc<Sampler>) -> Box<dyn DescriptorSet + Send + Sync> {
let o: Box<dyn DescriptorSet + Send + Sync> = Box::new(
PersistentDescriptorSet::start(
pipeline.clone(), 0,
)
.add_buffer(self.buffer.clone()).unwrap()
.build().unwrap());
o
}
}
#[derive(Clone)]
pub struct CanvasText {
pub(crate) handle: Arc<CanvasFontHandle>,
pub(crate) buffer: Arc<ImmutableImage<R8Unorm>>,
pub(crate) size: (u32, u32),
}
impl CanvasText {
pub fn get_descriptor_set(&self,
pipeline: Arc<dyn GraphicsPipelineAbstract + Sync + Send>,
sampler: Arc<Sampler>) -> Box<dyn DescriptorSet + Send + Sync> {
let o: Box<dyn DescriptorSet + Send + Sync> = Box::new(
PersistentDescriptorSet::start(
pipeline.clone(), 0,
)
.add_sampled_image(self.buffer.clone(), sampler.clone()).unwrap()
.build().unwrap());
o
}
}