mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 05:15:00 +00:00
Start on Scene::push_surface
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
d473b52f5a
commit
e12eaf8c58
3 changed files with 18 additions and 1 deletions
|
@ -13,6 +13,7 @@ use cocoa::base::{BOOL, NO, YES};
|
||||||
pub use dispatcher::Dispatcher;
|
pub use dispatcher::Dispatcher;
|
||||||
pub use fonts::FontSystem;
|
pub use fonts::FontSystem;
|
||||||
use platform::{MacForegroundPlatform, MacPlatform};
|
use platform::{MacForegroundPlatform, MacPlatform};
|
||||||
|
pub use renderer::Surface;
|
||||||
use std::{rc::Rc, sync::Arc};
|
use std::{rc::Rc, sync::Arc};
|
||||||
use window::Window;
|
use window::Window;
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,10 @@ struct PathSprite {
|
||||||
shader_data: shaders::GPUISprite,
|
shader_data: shaders::GPUISprite,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub struct Surface {
|
||||||
|
pub bounds: RectF,
|
||||||
|
}
|
||||||
|
|
||||||
impl Renderer {
|
impl Renderer {
|
||||||
pub fn new(
|
pub fn new(
|
||||||
device: metal::Device,
|
device: metal::Device,
|
||||||
|
|
|
@ -10,7 +10,7 @@ use crate::{
|
||||||
fonts::{FontId, GlyphId},
|
fonts::{FontId, GlyphId},
|
||||||
geometry::{rect::RectF, vector::Vector2F},
|
geometry::{rect::RectF, vector::Vector2F},
|
||||||
json::ToJson,
|
json::ToJson,
|
||||||
platform::CursorStyle,
|
platform::{current::Surface, CursorStyle},
|
||||||
ImageData,
|
ImageData,
|
||||||
};
|
};
|
||||||
pub use mouse_region::*;
|
pub use mouse_region::*;
|
||||||
|
@ -34,6 +34,7 @@ pub struct Layer {
|
||||||
quads: Vec<Quad>,
|
quads: Vec<Quad>,
|
||||||
underlines: Vec<Underline>,
|
underlines: Vec<Underline>,
|
||||||
images: Vec<Image>,
|
images: Vec<Image>,
|
||||||
|
surfaces: Vec<Surface>,
|
||||||
shadows: Vec<Shadow>,
|
shadows: Vec<Shadow>,
|
||||||
glyphs: Vec<Glyph>,
|
glyphs: Vec<Glyph>,
|
||||||
image_glyphs: Vec<ImageGlyph>,
|
image_glyphs: Vec<ImageGlyph>,
|
||||||
|
@ -249,6 +250,10 @@ impl Scene {
|
||||||
self.active_layer().push_image(image)
|
self.active_layer().push_image(image)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn push_surface(&mut self, surface: Surface) {
|
||||||
|
self.active_layer().push_surface(surface)
|
||||||
|
}
|
||||||
|
|
||||||
pub fn push_underline(&mut self, underline: Underline) {
|
pub fn push_underline(&mut self, underline: Underline) {
|
||||||
self.active_layer().push_underline(underline)
|
self.active_layer().push_underline(underline)
|
||||||
}
|
}
|
||||||
|
@ -329,6 +334,7 @@ impl Layer {
|
||||||
quads: Default::default(),
|
quads: Default::default(),
|
||||||
underlines: Default::default(),
|
underlines: Default::default(),
|
||||||
images: Default::default(),
|
images: Default::default(),
|
||||||
|
surfaces: Default::default(),
|
||||||
shadows: Default::default(),
|
shadows: Default::default(),
|
||||||
image_glyphs: Default::default(),
|
image_glyphs: Default::default(),
|
||||||
glyphs: Default::default(),
|
glyphs: Default::default(),
|
||||||
|
@ -391,6 +397,12 @@ impl Layer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn push_surface(&mut self, surface: Surface) {
|
||||||
|
if can_draw(surface.bounds) {
|
||||||
|
self.surfaces.push(surface);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pub fn images(&self) -> &[Image] {
|
pub fn images(&self) -> &[Image] {
|
||||||
self.images.as_slice()
|
self.images.as_slice()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue