Hi list,

I am trying to cache my viewgroup to a bitmap and blit this to screen
instead of calling dispatchDraw on the group while scrolling for
performance reasons. This works quite well on 1.5, but has ugly
scaling artefacts on 1.6 and newer for high density screens. Because
of my 1.5 compatibility I can't find a way to set the density of my
cached bitmap.

Here is the relevant code from my ViewGroup subclass:

        @Override
        public void dispatchDraw (Canvas canvas) {
                if (active) {  // Draw the real viewgroup if we aren't scrolling
                        super.dispatchDraw(canvas);
                } else {  // otherwise create a cached copy if necessary and 
draw
this
                        if (idleView == null) { // create canvas and bitmap if 
not done
already
                                idleView = Bitmap.createBitmap(getWidth(), 
getHeight(),
Bitmap.Config.ARGB_8888);
                                idleCanvas = new Canvas(idleView);
                                idleViewValid = false;
                        }
                        if (!idleViewValid) {  // Draw onto the canvas
                                super.dispatchDraw(idleCanvas);
                                idleViewValid = true;
                        }
                        // Then render this bitmap to screen
                        canvas.drawBitmap(idleView, matrix, paint);
                }
        }

I tried the same with getDrawingCache and had the same problem :(

I'd be glad for any help.

Best regards,

Kevin

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to