title: Canvas.clipPath(Path) not clipping as expected
body: <p>I'm trying to clip a canvas drawing operation to an arc-shaped wedge. However, I'm not getting the intended result after setting the clipping path to the canvas. </p>
  
  <p>For illustration, here is what I'm doing:</p>
  
  <p><img src="https://i.stack.imgur.com/uwhpW.png" alt="enter image description here"></p>
  
  <pre><code>path.reset();
  
  //Move to point #1
  path.moveTo(rect.centerX(), rect.centerY());
  
  //Per the documentation, this will draw a connecting line from the current
  //position to the starting position of the arc (at 0 degrees), add the arc
  //and my current position now lies at #2.
  path.arcTo(rect, 0, -30);
  
  //This should then close the path, finishing back at the center point (#3)
  path.close();
  </code></pre>
  
  <p>This works, and when I simply draw this path (<code>canvas.drawPath(path, paint)</code>) it draws the wedge as shown above. However, when I set this path as the canvas's clipping path and draw into it:</p>
  
  <pre><code>//I've tried it with and without the Region.Op parameter
  canvas.clipPath(path, Region.Op.REPLACE);
  canvas.drawColor(Color.BLUE);
  </code></pre>
  
  <p>I get the following result instead (the wedge is left just to show reference):</p>
  
  <p><img src="https://i.stack.imgur.com/QqUwJ.png" alt="enter image description here"></p>
  
  <p>So it instead seems to clip to the bounding rect of the <code>Path</code>, and not the <code>Path</code> itself. Any ideas what's happening here?</p>
  
  <p><strong>EDIT</strong> Just as an update, I've found a much more efficient way of doing this that allows for hardware acceleration. First, draw the entire image (that you'd be clipping) into an offscreen bitmap. Make a <code>BitmapShader</code> using this <code>Bitmap</code>, set that shader to a <code>Paint</code>, then draw the wedge path using that <code>Paint</code> object:</p>
  
  <pre><code>drawMyBitmap(bitmap);
  Shader shader = new BitmapShader(bitmap, Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
  Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
  paint.setShader(shader);
  
  @Override
  public void onDraw(Canvas canvas) {
      canvas.drawArc(rect,         //The rectangle bounding the circle
                     startAngle,   //The angle (CW from 3 o'clock) to start
                     sweepAngle,   //The angle (CW from 3 o'clock) of the arc
                     true,         //Boolean of whether to draw a filled arc (wedge)
                     paint         //The paint with the shader attached
      );
  }
  </code></pre>