Fix standalone compilation of iced_widget crate
This commit is contained in:
parent
1f13a91361
commit
4f2f40c68b
6 changed files with 81 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
//! Write your own renderer.
|
//! Write your own renderer.
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
mod null;
|
mod null;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::alignment;
|
use crate::alignment;
|
||||||
use crate::image;
|
use crate::image;
|
||||||
use crate::renderer::{self, Renderer};
|
use crate::renderer::{self, Renderer};
|
||||||
|
use crate::svg;
|
||||||
use crate::text::{self, Text};
|
use crate::text::{self, Text};
|
||||||
use crate::{
|
use crate::{
|
||||||
Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
|
Background, Color, Font, Pixels, Point, Rectangle, Size, Transformation,
|
||||||
|
|
@ -177,3 +178,17 @@ impl image::Renderer for () {
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl svg::Renderer for () {
|
||||||
|
fn measure_svg(&self, _handle: &svg::Handle) -> Size<u32> {
|
||||||
|
Size::default()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn draw_svg(
|
||||||
|
&mut self,
|
||||||
|
_handle: svg::Handle,
|
||||||
|
_color: Option<Color>,
|
||||||
|
_bounds: Rectangle,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,3 +31,12 @@ impl<T> Cached for Primitive<T> {
|
||||||
Arc::new(self)
|
Arc::new(self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
impl Cached for () {
|
||||||
|
type Cache = ();
|
||||||
|
|
||||||
|
fn load(_cache: &Self::Cache) -> Self {}
|
||||||
|
|
||||||
|
fn cache(self) -> Self::Cache {}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,3 +44,13 @@ pub trait Backend {
|
||||||
/// Creates a new [`Self::Frame`].
|
/// Creates a new [`Self::Frame`].
|
||||||
fn new_frame(&self, size: Size) -> Self::Frame;
|
fn new_frame(&self, size: Size) -> Self::Frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
impl Renderer for () {
|
||||||
|
type Geometry = ();
|
||||||
|
type Frame = ();
|
||||||
|
|
||||||
|
fn new_frame(&self, _size: Size) -> Self::Frame {}
|
||||||
|
|
||||||
|
fn draw_geometry(&mut self, _geometry: Self::Geometry) {}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -203,3 +203,49 @@ pub trait Backend: Sized {
|
||||||
|
|
||||||
fn into_geometry(self) -> Self::Geometry;
|
fn into_geometry(self) -> Self::Geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
impl Backend for () {
|
||||||
|
type Geometry = ();
|
||||||
|
|
||||||
|
fn width(&self) -> f32 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn height(&self) -> f32 {
|
||||||
|
0.0
|
||||||
|
}
|
||||||
|
|
||||||
|
fn size(&self) -> Size {
|
||||||
|
Size::ZERO
|
||||||
|
}
|
||||||
|
|
||||||
|
fn center(&self) -> Point {
|
||||||
|
Point::ORIGIN
|
||||||
|
}
|
||||||
|
|
||||||
|
fn push_transform(&mut self) {}
|
||||||
|
fn pop_transform(&mut self) {}
|
||||||
|
|
||||||
|
fn translate(&mut self, _translation: Vector) {}
|
||||||
|
fn rotate(&mut self, _angle: impl Into<Radians>) {}
|
||||||
|
fn scale(&mut self, _scale: impl Into<f32>) {}
|
||||||
|
fn scale_nonuniform(&mut self, _scale: impl Into<Vector>) {}
|
||||||
|
|
||||||
|
fn draft(&mut self, _size: Size) -> Self {}
|
||||||
|
fn paste(&mut self, _frame: Self, _at: Point) {}
|
||||||
|
|
||||||
|
fn stroke<'a>(&mut self, _path: &Path, _stroke: impl Into<Stroke<'a>>) {}
|
||||||
|
|
||||||
|
fn fill(&mut self, _path: &Path, _fill: impl Into<Fill>) {}
|
||||||
|
fn fill_text(&mut self, _text: impl Into<Text>) {}
|
||||||
|
fn fill_rectangle(
|
||||||
|
&mut self,
|
||||||
|
_top_left: Point,
|
||||||
|
_size: Size,
|
||||||
|
_fill: impl Into<Fill>,
|
||||||
|
) {
|
||||||
|
}
|
||||||
|
|
||||||
|
fn into_geometry(self) -> Self::Geometry {}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -992,7 +992,6 @@ fn rounded_box_sdf(
|
||||||
|
|
||||||
impl iced_graphics::Backend for Backend {
|
impl iced_graphics::Backend for Backend {
|
||||||
type Compositor = window::Compositor;
|
type Compositor = window::Compositor;
|
||||||
|
|
||||||
type Primitive = primitive::Custom;
|
type Primitive = primitive::Custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue