Ticket Created
over 5 years ago

WERETECH-8101

Datafield Issue Rendering Clipped Regions

I have discovered when using a clip region drawing a Datafield, the display is sometimes rendered incorrectly if the field is present on multiple positions of the screen.  I have replicated the problem using the code example below on the simulator and on a physical Edge 830 device.  The issue is observed on several of the screen layouts, here are examples for '3 Fields B' and '6 Fields B' - notice the incomplete rectangle on the center instance.

        

    function onUpdate(dc) {  
    	var w = dc.getWidth();
    	var h = dc.getHeight();
    	
    	// Fill left half of field with black
		dc.setColor(Graphics.COLOR_BLACK, Graphics.COLOR_RED);
        dc.fillRectangle(0, 0, w/2, h);
        
        // Draw full frame in black
        dc.drawRectangle(w/4, h/4, w/2, h/2);
        
        // Draw frame in white, but clipped to left half of field
		dc.setColor(Graphics.COLOR_WHITE, Graphics.COLOR_RED);
        dc.setClip(0,0,w/2, h);
        dc.drawRectangle(w/4, h/4, w/2, h/2);
        dc.clearClip();
    }

I'm running Connect IQ SDK 3.1.5

  • The above issue persists in 3.1.6. There is clearly a bug in the rendering of clip regions on the middle 'B' Datafield position.  The following example shows that simply setting and clearing the clip region results in a large part of the Datafield being overwritten with white.  As mentioned this affects simulation and physical devices.

        function onUpdate(dc) {  
    	    	var w = dc.getWidth();
    	    	var h = dc.getHeight();
    	    	
    	    	// Draw blue circle on black background
    		    dc.setColor(Graphics.COLOR_BLUE, Graphics.COLOR_BLACK);
    	        dc.clear();
    	        dc.fillCircle(w/2, h/2, h/3);
    	        
    	        // Set a clip area
    	        dc.setClip(10, 10, 20, 20);
    	        dc.clearClip();
        }