<pre>
Current implementation causes very nasty clipping issue in some midlets. One of related issues I encountered is like this:
my expected clip: 7, 13, 100, 100
actual clip: 14, 26, 93, 83
Note: the origin of the clip is wrongly translated by (7,13) keeping the bottom right point unchanged.
The following implementation works fine for me:
int clipX = g.getClipX();
int clipY = g.getClipY();
int clipW = g.getClipWidth();
int clipH = g.getClipHeight();
g.translate(x - viewX, y - viewY);
g.clipRect(viewX, viewY, viewW, viewH);
for (int i = getSize(); --i >= 0; ) {
Layer comp = getLayerAt(i);
if (comp.isVisible()) {
comp.paint(g);
}
}
g.translate(-x + viewX, -y + viewY);
g.setClip(clipX, clipY, clipW, clipH);
</pre>
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
<pre>
Current implementation causes very nasty clipping issue in some midlets. One of related issues I encountered is like this:
my expected clip: 7, 13, 100, 100
actual clip: 14, 26, 93, 83
Note: the origin of the clip is wrongly translated by (7,13) keeping the bottom right point unchanged.
The following implementation works fine for me:
int clipX = g.getClipX();
int clipY = g.getClipY();
int clipW = g.getClipWidth();
int clipH = g.getClipHeight();
g.translate(x - viewX, y - viewY);
g.clipRect(viewX, viewY, viewW, viewH);
for (int i = getSize(); --i >= 0; ) {
Layer comp = getLayerAt(i);
if (comp.isVisible()) {
comp.paint(g);
}
}
g.translate(-x + viewX, -y + viewY);
g.setClip(clipX, clipY, clipW, clipH);
</pre>
Is that code the whole implementation of paint method or just a fragment?
whole
Fixed