开发者

What happens in the system when canvas.drawBitmap is called?

I have a scrollable and zoomable map which has a low res copy of the map which is drawn when the zoom scale is small and a tile system when the user zooms in past a certain point. The problem im having is that the very first time the tiles a开发者_运维百科re drawn there is a short, but noticable lag. After that initial lag everything is smooth. The GC isnt running, and all the bitmaps are loaded at launch time. Any idea what exactly is going on so i can take care of the lag? Or any way for a work around? Thanks. Heres the code below:

            canvas.drawBitmap(map, null, bgRect,paint);

            if(matrix[0]>.9){
                 mapPicture = makeMyMap(xScale,yScale); //make/update our map.
                 mapPicture.draw(canvas);  
            }


Try switching on tracing with DDMS to establish which methods take a long time on the first draw and see how they compare with the subsequent draws.

It's possible that drawBitmap is triggering the platform level up-scale / down-scale of the images on first draw rather than load - but that's speculation on my part.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜