summaryrefslogtreecommitdiffstats
path: root/tiny_skia/src/backend.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector@hecrj.dev>2023-12-02 16:10:42 +0100
committerLibravatar GitHub <noreply@github.com>2023-12-02 16:10:42 +0100
commit8727b3fc50ec251d9c117c51ca1289be5ba9b117 (patch)
tree802fef9f0b54b6f9cbbeedff14d7f57169db7d6b /tiny_skia/src/backend.rs
parent7f8b17604a31e00becc43130ec516c1a53552c88 (diff)
parentb526ce4958b28208395276dd4078ffe0d780e1d7 (diff)
downloadiced-8727b3fc50ec251d9c117c51ca1289be5ba9b117.tar.gz
iced-8727b3fc50ec251d9c117c51ca1289be5ba9b117.tar.bz2
iced-8727b3fc50ec251d9c117c51ca1289be5ba9b117.zip
Merge pull request #2154 from iced-rs/fix/text-clipping
Fix text clipping
Diffstat (limited to 'tiny_skia/src/backend.rs')
-rw-r--r--tiny_skia/src/backend.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/tiny_skia/src/backend.rs b/tiny_skia/src/backend.rs
index f2905b00..3e9bd2a5 100644
--- a/tiny_skia/src/backend.rs
+++ b/tiny_skia/src/backend.rs
@@ -1,6 +1,6 @@
use crate::core::{Background, Color, Gradient, Rectangle, Vector};
use crate::graphics::backend;
-use crate::graphics::{Damage, Viewport};
+use crate::graphics::Viewport;
use crate::primitive::{self, Primitive};
use std::borrow::Cow;
@@ -361,11 +361,10 @@ impl Backend {
paragraph,
position,
color,
+ clip_bounds: text_clip_bounds,
} => {
let physical_bounds =
- (Rectangle::new(*position, paragraph.min_bounds)
- + translation)
- * scale_factor;
+ (*text_clip_bounds + translation) * scale_factor;
if !clip_bounds.intersects(&physical_bounds) {
return;
@@ -387,10 +386,10 @@ impl Backend {
editor,
position,
color,
+ clip_bounds: text_clip_bounds,
} => {
let physical_bounds =
- (Rectangle::new(*position, editor.bounds) + translation)
- * scale_factor;
+ (*text_clip_bounds + translation) * scale_factor;
if !clip_bounds.intersects(&physical_bounds) {
return;
@@ -418,9 +417,10 @@ impl Backend {
horizontal_alignment,
vertical_alignment,
shaping,
+ clip_bounds: text_clip_bounds,
} => {
let physical_bounds =
- (primitive.bounds() + translation) * scale_factor;
+ (*text_clip_bounds + translation) * scale_factor;
if !clip_bounds.intersects(&physical_bounds) {
return;