From fdd9896dc5f727f4c659ad6252f1ab36cca77762 Mon Sep 17 00:00:00 2001
From: Héctor Ramón Jiménez <hector@hecrj.dev>
Date: Wed, 10 Apr 2024 19:55:27 +0200
Subject: Track image damage in `iced_tiny_skia`

---
 graphics/src/image.rs | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

(limited to 'graphics')

diff --git a/graphics/src/image.rs b/graphics/src/image.rs
index 47a7b30e..c6135e9e 100644
--- a/graphics/src/image.rs
+++ b/graphics/src/image.rs
@@ -7,7 +7,7 @@ use crate::core::svg;
 use crate::core::{Color, Rectangle};
 
 /// A raster or vector image.
-#[derive(Debug, Clone)]
+#[derive(Debug, Clone, PartialEq)]
 pub enum Image {
     /// A raster image.
     Raster {
@@ -33,6 +33,17 @@ pub enum Image {
     },
 }
 
+impl Image {
+    /// Returns the bounds of the [`Image`].
+    pub fn bounds(&self) -> Rectangle {
+        match self {
+            Image::Raster { bounds, .. } | Image::Vector { bounds, .. } => {
+                *bounds
+            }
+        }
+    }
+}
+
 #[cfg(feature = "image")]
 /// Tries to load an image by its [`Handle`].
 ///
-- 
cgit