Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: src/core/SkCanvas.cpp

Issue 831253002: Revert of Revert of move remaining virtual draw methods to onDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/utils/SkProxyCanvas.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 09b9783cb95d1c954cc5f0e6c6042d9c48a6c1d7..13b84e7f0f38148f4a57e9d68da1f755ab8882c1 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1196,8 +1196,7 @@
LOOPER_END
}
-void SkCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
if (gTreatSpriteAsBitmap) {
this->save();
this->resetMatrix();
@@ -1671,6 +1670,66 @@
this->onDrawDRRect(outer, inner, paint);
}
+// These need to stop being virtual -- clients need to override the onDraw... versions
+
+void SkCanvas::drawPaint(const SkPaint& paint) {
+ this->onDrawPaint(paint);
+}
+
+void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
+ this->onDrawRect(r, paint);
+}
+
+void SkCanvas::drawOval(const SkRect& r, const SkPaint& paint) {
+ this->onDrawOval(r, paint);
+}
+
+void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+ this->onDrawRRect(rrect, paint);
+}
+
+void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint) {
+ this->onDrawPoints(mode, count, pts, paint);
+}
+
+void SkCanvas::drawVertices(VertexMode vmode, int vertexCount, const SkPoint vertices[],
+ const SkPoint texs[], const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount, const SkPaint& paint) {
+ this->onDrawVertices(vmode, vertexCount, vertices, texs, colors, xmode,
+ indices, indexCount, paint);
+}
+
+void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+ this->onDrawPath(path, paint);
+}
+
+void SkCanvas::drawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint) {
+ this->onDrawImage(image, dx, dy, paint);
+}
+
+void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
+ this->onDrawImageRect(image, src, dst, paint);
+}
+
+void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar dx, SkScalar dy, const SkPaint* paint) {
+ this->onDrawBitmap(bitmap, dx, dy, paint);
+}
+
+void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
+ this->onDrawBitmapRect(bitmap, src, dst, paint, flags);
+}
+
+void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
+ const SkPaint* paint) {
+ this->onDrawBitmapNine(bitmap, center, dst, paint);
+}
+
+void SkCanvas::drawSprite(const SkBitmap& bitmap, int left, int top, const SkPaint* paint) {
+ this->onDrawSprite(bitmap, left, top, paint);
+}
+
//////////////////////////////////////////////////////////////////////////////
// These are the virtual drawing methods
//////////////////////////////////////////////////////////////////////////////
@@ -1681,7 +1740,7 @@
}
}
-void SkCanvas::drawPaint(const SkPaint& paint) {
+void SkCanvas::onDrawPaint(const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPaint()");
this->internalDrawPaint(paint);
}
@@ -1696,8 +1755,8 @@
LOOPER_END
}
-void SkCanvas::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
- const SkPaint& paint) {
+void SkCanvas::onDrawPoints(PointMode mode, size_t count, const SkPoint pts[],
+ const SkPaint& paint) {
TRACE_EVENT1("disabled-by-default-skia", "SkCanvas::drawPoints()", "count", static_cast<uint64_t>(count));
if ((long)count <= 0) {
return;
@@ -1729,7 +1788,7 @@
LOOPER_END
}
-void SkCanvas::drawRect(const SkRect& r, const SkPaint& paint) {
+void SkCanvas::onDrawRect(const SkRect& r, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRect()");
SkRect storage;
const SkRect* bounds = NULL;
@@ -1749,7 +1808,7 @@
LOOPER_END
}
-void SkCanvas::drawOval(const SkRect& oval, const SkPaint& paint) {
+void SkCanvas::onDrawOval(const SkRect& oval, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawOval()");
SkRect storage;
const SkRect* bounds = NULL;
@@ -1769,7 +1828,7 @@
LOOPER_END
}
-void SkCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawRRect()");
SkRect storage;
const SkRect* bounds = NULL;
@@ -1819,7 +1878,7 @@
LOOPER_END
}
-void SkCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawPath()");
if (!path.isFinite()) {
return;
@@ -1852,21 +1911,18 @@
LOOPER_END
}
-void SkCanvas::drawImage(const SkImage* image, SkScalar left, SkScalar top,
- const SkPaint* paint) {
+void SkCanvas::onDrawImage(const SkImage* image, SkScalar dx, SkScalar dy, const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImage()");
- image->draw(this, left, top, paint);
-}
-
-void SkCanvas::drawImageRect(const SkImage* image, const SkRect* src,
- const SkRect& dst,
- const SkPaint* paint) {
+ image->draw(this, dx, dy, paint);
+}
+
+void SkCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawImageRect()");
image->drawRect(this, src, dst, paint);
}
-void SkCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmap()");
SkDEBUGCODE(bitmap.validate();)
@@ -1922,9 +1978,8 @@
LOOPER_END
}
-void SkCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapRectToRect()");
SkDEBUGCODE(bitmap.validate();)
this->internalDrawBitmapRect(bitmap, src, dst, paint, flags);
@@ -2000,8 +2055,8 @@
}
}
-void SkCanvas::drawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
- const SkRect& dst, const SkPaint* paint) {
+void SkCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, const SkRect& dst,
+ const SkPaint* paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawBitmapNine()");
SkDEBUGCODE(bitmap.validate();)
@@ -2208,11 +2263,11 @@
}
}
-void SkCanvas::drawVertices(VertexMode vmode, int vertexCount,
- const SkPoint verts[], const SkPoint texs[],
- const SkColor colors[], SkXfermode* xmode,
- const uint16_t indices[], int indexCount,
- const SkPaint& paint) {
+void SkCanvas::onDrawVertices(VertexMode vmode, int vertexCount,
+ const SkPoint verts[], const SkPoint texs[],
+ const SkColor colors[], SkXfermode* xmode,
+ const uint16_t indices[], int indexCount,
+ const SkPaint& paint) {
TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawVertices()");
LOOPER_BEGIN(paint, SkDrawFilter::kPath_Type, NULL)
« no previous file with comments | « include/utils/SkProxyCanvas.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698