Fix image pattern texture atlas logic.

This commit is contained in:
Patrick Walton 2020-03-30 16:19:03 -07:00
parent a1f0ae097a
commit cf78ac4569
1 changed files with 9 additions and 7 deletions

View File

@ -448,16 +448,18 @@ impl State {
} }
fn resolve_paint<'a>(&self, paint: &'a Paint) -> Cow<'a, Paint> { fn resolve_paint<'a>(&self, paint: &'a Paint) -> Cow<'a, Paint> {
if self.transform.is_identity() { let mut must_copy = !self.transform.is_identity();
return Cow::Borrowed(paint); if !must_copy {
} if let Paint::Pattern(ref pattern) = *paint {
if let Paint::Pattern(ref pattern) = *paint { must_copy = !self.image_smoothing_enabled !=
if !self.image_smoothing_enabled == pattern.flags.contains(PatternFlags::NO_SMOOTHING);
pattern.flags.contains(PatternFlags::NO_SMOOTHING) {
return Cow::Borrowed(paint)
} }
} }
if !must_copy {
return Cow::Borrowed(paint);
}
let mut paint = (*paint).clone(); let mut paint = (*paint).clone();
paint.apply_transform(&self.transform); paint.apply_transform(&self.transform);
if let Paint::Pattern(ref mut pattern) = paint { if let Paint::Pattern(ref mut pattern) = paint {