Replace Rc with Arc in tiny_skia renderer
This commit is contained in:
parent
b70355cdf7
commit
ced4276a5e
2 changed files with 12 additions and 12 deletions
|
|
@ -7,7 +7,7 @@ use crate::graphics::geometry::stroke::{self, Stroke};
|
||||||
use crate::graphics::geometry::{self, Path, Style};
|
use crate::graphics::geometry::{self, Path, Style};
|
||||||
use crate::graphics::{self, Gradient, Image, Text};
|
use crate::graphics::{self, Gradient, Image, Text};
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Geometry {
|
pub enum Geometry {
|
||||||
|
|
@ -22,9 +22,9 @@ pub enum Geometry {
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Cache {
|
pub struct Cache {
|
||||||
pub text: Rc<[Text]>,
|
pub text: Arc<[Text]>,
|
||||||
pub images: Rc<[graphics::Image]>,
|
pub images: Arc<[graphics::Image]>,
|
||||||
pub primitives: Rc<[Primitive]>,
|
pub primitives: Arc<[Primitive]>,
|
||||||
pub clip_bounds: Rectangle,
|
pub clip_bounds: Rectangle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,9 +43,9 @@ impl Cached for Geometry {
|
||||||
text,
|
text,
|
||||||
clip_bounds,
|
clip_bounds,
|
||||||
} => Cache {
|
} => Cache {
|
||||||
primitives: Rc::from(primitives),
|
primitives: Arc::from(primitives),
|
||||||
images: Rc::from(images),
|
images: Arc::from(images),
|
||||||
text: Rc::from(text),
|
text: Arc::from(text),
|
||||||
clip_bounds,
|
clip_bounds,
|
||||||
},
|
},
|
||||||
Self::Cache(cache) => cache,
|
Self::Cache(cache) => cache,
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ use crate::graphics::layer;
|
||||||
use crate::graphics::text::{Editor, Paragraph, Text};
|
use crate::graphics::text::{Editor, Paragraph, Text};
|
||||||
use crate::graphics::{self, Image};
|
use crate::graphics::{self, Image};
|
||||||
|
|
||||||
use std::rc::Rc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
pub type Stack = layer::Stack<Layer>;
|
pub type Stack = layer::Stack<Layer>;
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ impl Layer {
|
||||||
|
|
||||||
pub fn draw_text_cache(
|
pub fn draw_text_cache(
|
||||||
&mut self,
|
&mut self,
|
||||||
text: Rc<[Text]>,
|
text: Arc<[Text]>,
|
||||||
clip_bounds: Rectangle,
|
clip_bounds: Rectangle,
|
||||||
transformation: Transformation,
|
transformation: Transformation,
|
||||||
) {
|
) {
|
||||||
|
|
@ -163,7 +163,7 @@ impl Layer {
|
||||||
|
|
||||||
pub fn draw_primitive_cache(
|
pub fn draw_primitive_cache(
|
||||||
&mut self,
|
&mut self,
|
||||||
primitives: Rc<[Primitive]>,
|
primitives: Arc<[Primitive]>,
|
||||||
clip_bounds: Rectangle,
|
clip_bounds: Rectangle,
|
||||||
transformation: Transformation,
|
transformation: Transformation,
|
||||||
) {
|
) {
|
||||||
|
|
@ -242,7 +242,7 @@ impl Layer {
|
||||||
Item::Cached(cache_a, bounds_a, transformation_a),
|
Item::Cached(cache_a, bounds_a, transformation_a),
|
||||||
Item::Cached(cache_b, bounds_b, transformation_b),
|
Item::Cached(cache_b, bounds_b, transformation_b),
|
||||||
) => {
|
) => {
|
||||||
Rc::ptr_eq(cache_a, cache_b)
|
Arc::ptr_eq(cache_a, cache_b)
|
||||||
&& bounds_a == bounds_b
|
&& bounds_a == bounds_b
|
||||||
&& transformation_a == transformation_b
|
&& transformation_a == transformation_b
|
||||||
}
|
}
|
||||||
|
|
@ -304,7 +304,7 @@ impl graphics::Layer for Layer {
|
||||||
pub enum Item<T> {
|
pub enum Item<T> {
|
||||||
Live(T),
|
Live(T),
|
||||||
Group(Vec<T>, Rectangle, Transformation),
|
Group(Vec<T>, Rectangle, Transformation),
|
||||||
Cached(Rc<[T]>, Rectangle, Transformation),
|
Cached(Arc<[T]>, Rectangle, Transformation),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T> Item<T> {
|
impl<T> Item<T> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue