summaryrefslogtreecommitdiffstats
path: root/tiny_skia
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-04 05:37:11 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-03-04 05:37:11 +0100
commit3a0d34c0240f4421737a6a08761f99d6f8140d02 (patch)
treec9a4a6b8e9c1db1b8fcd05bc98e3f131d5ef4bd5 /tiny_skia
parentc54409d1711e1f615c7ea4b02c082954e340632a (diff)
downloadiced-3a0d34c0240f4421737a6a08761f99d6f8140d02.tar.gz
iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.tar.bz2
iced-3a0d34c0240f4421737a6a08761f99d6f8140d02.zip
Create `iced_widget` subcrate and re-organize the whole codebase
Diffstat (limited to 'tiny_skia')
-rw-r--r--tiny_skia/src/backend.rs18
-rw-r--r--tiny_skia/src/geometry.rs12
-rw-r--r--tiny_skia/src/lib.rs11
-rw-r--r--tiny_skia/src/settings.rs2
-rw-r--r--tiny_skia/src/text.rs11
-rw-r--r--tiny_skia/src/window/compositor.rs9
6 files changed, 29 insertions, 34 deletions
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs
index 050c6c75..d364e36a 100644
--- a/tiny_skia/src/backend.rs
+++ b/tiny_skia/src/backend.rs
@@ -1,9 +1,9 @@
-use crate::{Color, Font, Primitive, Settings, Size, Viewport};
-
-use iced_graphics::alignment;
-use iced_graphics::backend;
-use iced_graphics::text;
-use iced_graphics::{Background, Rectangle, Vector};
+use crate::core::alignment;
+use crate::core::text;
+use crate::core::{Background, Color, Font, Point, Rectangle, Size, Vector};
+use crate::graphics::backend;
+use crate::graphics::{Primitive, Viewport};
+use crate::Settings;
use std::borrow::Cow;
@@ -470,7 +470,7 @@ impl backend::Text for Backend {
size: f32,
font: Font,
bounds: Size,
- point: iced_native::Point,
+ point: Point,
nearest_only: bool,
) -> Option<text::Hit> {
self.text_pipeline.hit_test(
@@ -490,7 +490,7 @@ impl backend::Text for Backend {
#[cfg(feature = "image")]
impl backend::Image for Backend {
- fn dimensions(&self, _handle: &iced_native::image::Handle) -> Size<u32> {
+ fn dimensions(&self, _handle: &crate::core::image::Handle) -> Size<u32> {
// TODO
Size::new(0, 0)
}
@@ -500,7 +500,7 @@ impl backend::Image for Backend {
impl backend::Svg for Backend {
fn viewport_dimensions(
&self,
- _handle: &iced_native::svg::Handle,
+ _handle: &crate::core::svg::Handle,
) -> Size<u32> {
// TODO
Size::new(0, 0)
diff --git a/tiny_skia/src/geometry.rs b/tiny_skia/src/geometry.rs
index 73fc1ebd..c66621dd 100644
--- a/tiny_skia/src/geometry.rs
+++ b/tiny_skia/src/geometry.rs
@@ -1,9 +1,9 @@
-use crate::{Point, Primitive, Rectangle, Size, Vector};
-
-use iced_graphics::geometry::fill::{self, Fill};
-use iced_graphics::geometry::stroke::{self, Stroke};
-use iced_graphics::geometry::{Path, Style, Text};
-use iced_graphics::Gradient;
+use crate::core::Gradient;
+use crate::core::{Point, Rectangle, Size, Vector};
+use crate::graphics::geometry::fill::{self, Fill};
+use crate::graphics::geometry::stroke::{self, Stroke};
+use crate::graphics::geometry::{Path, Style, Text};
+use crate::graphics::Primitive;
pub struct Frame {
size: Size,
diff --git a/tiny_skia/src/lib.rs b/tiny_skia/src/lib.rs
index ef5c6b1d..bf83e400 100644
--- a/tiny_skia/src/lib.rs
+++ b/tiny_skia/src/lib.rs
@@ -7,19 +7,14 @@ mod text;
#[cfg(feature = "geometry")]
pub mod geometry;
-pub use iced_graphics::primitive;
+pub use iced_graphics as graphics;
+pub use iced_graphics::core;
pub use backend::Backend;
-pub use primitive::Primitive;
pub use settings::Settings;
-pub use iced_graphics::{
- Color, Error, Font, Point, Rectangle, Size, Vector, Viewport,
-};
-
/// A [`tiny-skia`] graphics renderer for [`iced`].
///
/// [`tiny-skia`]: https://github.com/RazrFalcon/tiny-skia
/// [`iced`]: https://github.com/iced-rs/iced
-pub type Renderer<Theme = iced_native::Theme> =
- iced_graphics::Renderer<Backend, Theme>;
+pub type Renderer<Theme> = iced_graphics::Renderer<Backend, Theme>;
diff --git a/tiny_skia/src/settings.rs b/tiny_skia/src/settings.rs
index 88098345..9e4be0c4 100644
--- a/tiny_skia/src/settings.rs
+++ b/tiny_skia/src/settings.rs
@@ -1,4 +1,4 @@
-use crate::Font;
+use crate::core::Font;
/// The settings of a [`Backend`].
///
diff --git a/tiny_skia/src/text.rs b/tiny_skia/src/text.rs
index da3a06bf..7a5034c2 100644
--- a/tiny_skia/src/text.rs
+++ b/tiny_skia/src/text.rs
@@ -1,7 +1,6 @@
-pub use iced_native::text::Hit;
-
-use iced_native::alignment;
-use iced_native::{Color, Font, Rectangle, Size};
+use crate::core::alignment;
+use crate::core::text::Hit;
+use crate::core::{Color, Font, Point, Rectangle, Size};
use rustc_hash::{FxHashMap, FxHashSet};
use std::borrow::Cow;
@@ -189,8 +188,8 @@ impl Pipeline {
content: &str,
size: f32,
font: iced_native::Font,
- bounds: iced_native::Size,
- point: iced_native::Point,
+ bounds: Size,
+ point: Point,
_nearest_only: bool,
) -> Option<Hit> {
self.system.as_ref().unwrap().with(|fields| {
diff --git a/tiny_skia/src/window/compositor.rs b/tiny_skia/src/window/compositor.rs
index 76f371e1..cea1cabf 100644
--- a/tiny_skia/src/window/compositor.rs
+++ b/tiny_skia/src/window/compositor.rs
@@ -1,6 +1,7 @@
-use crate::{Backend, Color, Error, Primitive, Renderer, Settings, Viewport};
-
-use iced_graphics::window::compositor::{self, Information, SurfaceError};
+use crate::core::Color;
+use crate::graphics::compositor::{self, Information, SurfaceError};
+use crate::graphics::{Error, Primitive, Viewport};
+use crate::{Backend, Renderer, Settings};
use raw_window_handle::{HasRawDisplayHandle, HasRawWindowHandle};
use std::marker::PhantomData;
@@ -15,7 +16,7 @@ pub struct Surface {
buffer: Vec<u32>,
}
-impl<Theme> iced_graphics::window::Compositor for Compositor<Theme> {
+impl<Theme> crate::graphics::Compositor for Compositor<Theme> {
type Settings = Settings;
type Renderer = Renderer<Theme>;
type Surface = Surface;