title: Android DrawBitMap very slow when using ARGB_8888
body: <p>I find that DrawBitMap is taking 50-60 ms for drawing just three bitmaps one is a rectangle occupying the full screen, one is a circle and another one is a Path. My bitmaps are created by using Canvas.drawPath, drawRect and drawCircle on a blank bitmap with the Bitmap.Config as ARGB_8888.
  I am using ARGB_8888 to make the background visible to get a layering effect.
  I was shocked to find the time taken as around 50ms as I thought drawBitmap would be a very simple operation. Can someone guide as to is there any fundamental mistake that I am making. Following is my code</p>
  
  <p><strong>Creating the Blank Bitmaps</strong></p>
  
  <pre><code>Rectangle = Bitmap.createBitmap(320,480,Bitmap.Config.ARGB_8888);
  Circle = Bitmap.createBitmap(70,70,Bitmap.Config.ARGB_8888);
  Leaf1 = Bitmap.createBitmap(20,30,Bitmap.Config.ARGB_8888);
  </code></pre>
  
  <p><strong>Drawing the Shapes on the appropriate BitMap</strong></p>
  
  <pre><code>Canvas c = new  Canvas(Rectangle);
  Paint p = new Paint();
  p.setAntiAlias(true);
  p.setColor(0xff6e8b3e);
  c.drawRect(0,0,320,480,p);
  
  Canvas c = new Canvas(Circle);
  Paint p = new Paint();
  CirclePath = new Path();
  p.setAntiAlias(true);
  p.setColor(0xffcd661d);
  System.out.println("x = "+x+" y = "+y);
  CirclePath.addCircle(50,50,10,Path.Direction.CW);
  c.drawPath(CirclePath,p);
  
  Canvas c = new  Canvas(Leaf1);
  Paint paint = new Paint();
  Path path = new Path();
  paint.setAntiAlias(true);
  path.moveTo((float)184.37,(float)219.15);
  path.cubicTo((float)188.32,(float)219.15,(float)192.88,(float)220.44,(float)195.62,(float)223.54);
  path.cubicTo((float)197.84,(float)226.05,(float)203.2,(float)229.84,(float)198.18,(float)245.98);
  </code></pre>
  
  <p><strong>Drawing the BitMap in OnDraw</strong></p>
  
  <pre><code>canvas.drawBitmap(Rectangle,0,0,p);
  canvas.translate(x,y); // For animation effect
  canvas.drawBitmap(Circle,0,0,p);
  canvas.drawBitmap(Leaf1,0,0,p);
  </code></pre>
  
  <p>Now when I record the time taken for this three drawBitMap I find it is taking around 50ms
  Is there something big time mistake in the code. Changing the Bitmap.Config to RGB_565 brings the time down to around 8ms but then the background is not visible and I am getting a black box around the path</p>