Skip to content

Commit

Permalink
Restore as_ref method
Browse files Browse the repository at this point in the history
  • Loading branch information
longmathemagician committed Aug 19, 2022
1 parent eb77c9a commit 3edab42
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions piet-coregraphics/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,12 @@ impl CoreGraphicsImage {
false => CoreGraphicsImage::YUp(image),
}
}
fn as_ref(&self) -> Option<&CGImage> {
match self {
CoreGraphicsImage::Empty => None,
CoreGraphicsImage::YUp(image) | CoreGraphicsImage::YDown(image) => Some(image),
}
}
pub fn copy_image(&self) -> Option<CGImage> {
if let CoreGraphicsImage::YUp(image) | CoreGraphicsImage::YDown(image) = self {
Some(image.clone())
Expand Down

0 comments on commit 3edab42

Please sign in to comment.