Skip to content

Commit

Permalink
wmf: add equals() and hashCode() to ColoredTexture so caching works
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosame committed Dec 18, 2024
1 parent 6a1b9db commit 01e6f61
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.awt.image.BufferedImage;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;

import io.sf.carte.echosvg.transcoder.wmf.WMFConstants;

Expand Down Expand Up @@ -196,5 +197,25 @@ private static class ColoredTexture {
this.foreground = foreground;
this.background = background;
}

@Override
public int hashCode() {
return Objects.hash(background, foreground, textureId);
}

@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null || getClass() != obj.getClass()) {
return false;
}
ColoredTexture other = (ColoredTexture) obj;
return textureId == other.textureId && Objects.equals(background, other.background)
&& Objects.equals(foreground, other.foreground);
}

}

}
17 changes: 6 additions & 11 deletions test-references/io/sf/carte/echosvg/transcoder/wmf/testChart.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 01e6f61

Please sign in to comment.