}\r
\r
public void setRegion (float u, float v, float u2, float v2) {\r
+ int texWidth = texture.getWidth(), texHeight = texture.getHeight();\r
+ regionWidth = Math.round(Math.abs(u2 - u) * texWidth);\r
+ regionHeight = Math.round(Math.abs(v2 - v) * texHeight);\r
+\r
+ // For a 1x1 region, adjust UVs to pixel center to avoid filtering artifacts on AMD GPUs when drawing stretched.\r
+ if (regionWidth == 1 && regionHeight == 1) {\r
+ u += 0.5f / texWidth;\r
+ u2 = u;\r
+ v += 0.5f / texHeight;\r
+ v2 = v;\r
+ }\r
+\r
this.u = u;\r
this.v = v;\r
this.u2 = u2;\r
this.v2 = v2;\r
- regionWidth = Math.round(Math.abs(u2 - u) * texture.getWidth());\r
- regionHeight = Math.round(Math.abs(v2 - v) * texture.getHeight());\r
}\r
\r
/** Sets the texture and coordinates to the specified region. */\r