add SkCanvas::drawDRRect
BUG=skia:
R=bsalomon@google.com, robertphillips@google.com, humper@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/174243003
git-svn-id: http://skia.googlecode.com/svn/trunk@13524 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/pipe/SkGPipePriv.h b/src/pipe/SkGPipePriv.h
index d1970c4..5e0b189 100644
--- a/src/pipe/SkGPipePriv.h
+++ b/src/pipe/SkGPipePriv.h
@@ -45,6 +45,7 @@
kDrawBitmapRectToRect_DrawOp,
kDrawClear_DrawOp,
kDrawData_DrawOp,
+ kDrawDRRect_DrawOp,
kDrawOval_DrawOp,
kDrawPaint_DrawOp,
kDrawPath_DrawOp,
diff --git a/src/pipe/SkGPipeRead.cpp b/src/pipe/SkGPipeRead.cpp
index 513a34d..8827adc 100644
--- a/src/pipe/SkGPipeRead.cpp
+++ b/src/pipe/SkGPipeRead.cpp
@@ -396,6 +396,16 @@
}
}
+static void drawDRRect_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
+ SkGPipeState* state) {
+ SkRRect outer, inner;
+ reader->readRRect(&outer);
+ reader->readRRect(&inner);
+ if (state->shouldDraw()) {
+ canvas->drawDRRect(outer, inner, state->paint());
+ }
+}
+
static void drawPath_rp(SkCanvas* canvas, SkReader32* reader, uint32_t op32,
SkGPipeState* state) {
SkPath path;
@@ -763,6 +773,7 @@
drawBitmapRect_rp,
drawClear_rp,
drawData_rp,
+ drawDRRect_rp,
drawOval_rp,
drawPaint_rp,
drawPath_rp,
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 17305bf..879ce82 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -290,6 +290,10 @@
* according to slot.
*/
bool shuttleBitmap(const SkBitmap&, int32_t slot);
+
+protected:
+ virtual void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRIDE;
+
private:
enum {
kNoSaveLayer = -1,
@@ -738,6 +742,17 @@
}
}
+void SkGPipeCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
+ const SkPaint& paint) {
+ NOTIFY_SETUP(this);
+ this->writePaint(paint);
+ if (this->needOpBytes(kSizeOfFlatRRect * 2)) {
+ this->writeOp(kDrawDRRect_DrawOp);
+ fWriter.writeRRect(outer);
+ fWriter.writeRRect(inner);
+ }
+}
+
void SkGPipeCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
NOTIFY_SETUP(this);
this->writePaint(paint);