Revision: 2934
http://sourceforge.net/p/swingme/code/2934
Author: yuranet
Date: 2025-11-23 02:44:49 +0000 (Sun, 23 Nov 2025)
Log Message:
-----------
fix setMatrix not working on api-21
Modified Paths:
--------------
AndroidME/src_MIDP/javax/microedition/lcdui/Canvas.java
AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java
Modified: AndroidME/src_MIDP/javax/microedition/lcdui/Canvas.java
===================================================================
--- AndroidME/src_MIDP/javax/microedition/lcdui/Canvas.java 2025-11-22 21:56:59 UTC (rev 2933)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Canvas.java 2025-11-23 02:44:49 UTC (rev 2934)
@@ -824,6 +824,8 @@
dist.right = src.right;
// but just to be sure we do it anyway, as we ALWAYS want them to be the same size, or the image is stretched
+ // we HAVE to translate the Graphics and NOT the Canvas! (or call save() after the translate)
+ // if we translate the Canvas it will be lost when setClip is called, as that relies on save/restore
graphics.translate(getPaddingLeft(), getPaddingTop());
paint(graphics);
Modified: AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java
===================================================================
--- AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java 2025-11-22 21:56:59 UTC (rev 2933)
+++ AndroidME/src_MIDP/javax/microedition/lcdui/Graphics.java 2025-11-23 02:44:49 UTC (rev 2934)
@@ -241,11 +241,13 @@
public void setClip(int x, int y, int w, int h) {
// the only way to get rid of the current clip is with restore()
- // but we do not want to lose our current matrix, so we will reset it
- canvas.getMatrix(matrix);
+ // but we do not want to lose our current matrix.
+ // unfortunately this method is broken on android, maybe fixed in API-28
+ // but as its broken on most versions we can not do this, so we can only hope we have nothing in the matrix
+ //canvas.getMatrix(matrix);
canvas.restore();
canvas.save();
- canvas.setMatrix(matrix);
+ //canvas.setMatrix(matrix); // buggy, does not work as expected on all versions, broken on API-21
//canvas.translate(tx, ty);
canvas.clipRect(tx+x, ty+y, tx+x + w, ty+y + h);
dirtyClip = true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|