Menu

deep bug in LayerManager.paint()

Mr.Thumb
2006-11-03
2013-04-26
  • Mr.Thumb

    Mr.Thumb - 2006-11-03

    <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>

     
    • Bartek Teodorczyk

      Is that code the whole implementation of paint method or just a fragment?

       
    • Mr.Thumb

      Mr.Thumb - 2006-11-06

      whole

       
      • Bartek Teodorczyk

        Fixed

         

Log in to post a comment.

MongoDB Logo MongoDB