summaryrefslogtreecommitdiffstats
path: root/tiny_skia
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-04 04:33:30 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-08-04 04:33:30 +0200
commit8708101c892540ffc966cf7ee9d66ca5cd2e8ca6 (patch)
tree7d2eb03566e27a2a23316d2fffee682d5740622b /tiny_skia
parent3904f0b83af2fd3cd0d841d34d0d9c6193eeb845 (diff)
downloadiced-8708101c892540ffc966cf7ee9d66ca5cd2e8ca6.tar.gz
iced-8708101c892540ffc966cf7ee9d66ca5cd2e8ca6.tar.bz2
iced-8708101c892540ffc966cf7ee9d66ca5cd2e8ca6.zip
Simplify types in `tiny_skia::layer`
Diffstat (limited to 'tiny_skia')
-rw-r--r--tiny_skia/src/layer.rs28
1 files changed, 12 insertions, 16 deletions
diff --git a/tiny_skia/src/layer.rs b/tiny_skia/src/layer.rs
index 33df0a86..5d3cb07b 100644
--- a/tiny_skia/src/layer.rs
+++ b/tiny_skia/src/layer.rs
@@ -1,12 +1,12 @@
use crate::core::renderer::Quad;
use crate::core::svg;
use crate::core::{
- Background, Color, Image, Point, Radians, Rectangle, Transformation,
+ self, Background, Color, Point, Radians, Rectangle, Transformation,
};
-use crate::graphics;
use crate::graphics::damage;
use crate::graphics::layer;
use crate::graphics::text::{Editor, Paragraph, Text};
+use crate::graphics::{self, Image};
use crate::Primitive;
use std::rc::Rc;
@@ -19,7 +19,7 @@ pub struct Layer {
pub quads: Vec<(Quad, Background)>,
pub primitives: Vec<Item<Primitive>>,
pub text: Vec<Item<Text>>,
- pub images: Vec<graphics::Image>,
+ pub images: Vec<Image>,
}
impl Layer {
@@ -73,7 +73,7 @@ impl Layer {
pub fn draw_text(
&mut self,
- text: crate::core::Text,
+ text: core::Text,
position: Point,
color: Color,
clip_bounds: Rectangle,
@@ -116,16 +116,12 @@ impl Layer {
.push(Item::Cached(text, clip_bounds, transformation));
}
- pub fn draw_image(
- &mut self,
- image: graphics::Image,
- transformation: Transformation,
- ) {
+ pub fn draw_image(&mut self, image: Image, transformation: Transformation) {
match image {
- graphics::Image::Raster(raster, bounds) => {
+ Image::Raster(raster, bounds) => {
self.draw_raster(raster.clone(), bounds, transformation);
}
- graphics::Image::Vector {
+ Image::Vector {
handle,
color,
bounds,
@@ -146,11 +142,11 @@ impl Layer {
pub fn draw_raster(
&mut self,
- image: Image,
+ image: core::Image,
bounds: Rectangle,
transformation: Transformation,
) {
- let image = graphics::Image::Raster(image, bounds * transformation);
+ let image = Image::Raster(image, bounds * transformation);
self.images.push(image);
}
@@ -164,7 +160,7 @@ impl Layer {
rotation: Radians,
opacity: f32,
) {
- let svg = graphics::Image::Vector {
+ let svg = Image::Vector {
handle,
color,
bounds: bounds * transformation,
@@ -281,7 +277,7 @@ impl Layer {
&previous.images,
&current.images,
|image| vec![image.bounds().expand(1.0)],
- graphics::Image::eq,
+ Image::eq,
);
damage.extend(text);
@@ -313,7 +309,7 @@ impl graphics::Layer for Layer {
fn flush(&mut self) {}
- fn resize(&mut self, bounds: graphics::core::Rectangle) {
+ fn resize(&mut self, bounds: Rectangle) {
self.bounds = bounds;
}