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

Unified Diff: src/utils/SkDumpCanvas.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 | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkDumpCanvas.cpp
diff --git a/src/utils/SkDumpCanvas.cpp b/src/utils/SkDumpCanvas.cpp
index 1bfb1ba806afd3805291f6a488cc59c1c95b9ff2..54ca691dced250fbb360366a0345c1ede55fd743 100644
--- a/src/utils/SkDumpCanvas.cpp
+++ b/src/utils/SkDumpCanvas.cpp
@@ -294,29 +294,29 @@
///////////////////////////////////////////////////////////////////////////////
-void SkDumpCanvas::drawPaint(const SkPaint& paint) {
+void SkDumpCanvas::onDrawPaint(const SkPaint& paint) {
this->dump(kDrawPaint_Verb, &paint, "drawPaint()");
}
-void SkDumpCanvas::drawPoints(PointMode mode, size_t count,
+void SkDumpCanvas::onDrawPoints(PointMode mode, size_t count,
const SkPoint pts[], const SkPaint& paint) {
this->dump(kDrawPoints_Verb, &paint, "drawPoints(%s, %d)", toString(mode),
count);
}
-void SkDumpCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
+void SkDumpCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) {
SkString str;
toString(rect, &str);
this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str());
}
-void SkDumpCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
+void SkDumpCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) {
SkString str;
toString(rect, &str);
this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str());
}
-void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
+void SkDumpCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) {
SkString str;
toString(rrect, &str);
this->dump(kDrawDRRect_Verb, &paint, "drawRRect(%s)", str.c_str());
@@ -331,23 +331,22 @@
str0.c_str(), str1.c_str());
}
-void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
+void SkDumpCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) {
SkString str;
toString(path, &str);
this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str());
}
-void SkDumpCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
- const SkPaint* paint) {
+void SkDumpCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
+ const SkPaint* paint) {
SkString str;
bitmap.toString(&str);
this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(),
SkScalarToFloat(x), SkScalarToFloat(y));
}
-void SkDumpCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
- const SkRect& dst, const SkPaint* paint,
- DrawBitmapRectFlags flags) {
+void SkDumpCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint, DrawBitmapRectFlags flags) {
SkString bs, rs;
bitmap.toString(&bs);
toString(dst, &rs);
@@ -364,8 +363,42 @@
bs.c_str(), rs.c_str());
}
-void SkDumpCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
- const SkPaint* paint) {
+void SkDumpCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
+ const SkRect& dst, const SkPaint* paint) {
+ SkString str, centerStr, dstStr;
+ bitmap.toString(&str);
+ toString(center, &centerStr);
+ toString(dst, &dstStr);
+ this->dump(kDrawBitmap_Verb, paint, "drawBitmapNine(%s %s %s)", str.c_str(),
+ centerStr.c_str(), dstStr.c_str());
+}
+
+void SkDumpCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, const SkPaint* paint) {
+ SkString str;
+ image->toString(&str);
+ this->dump(kDrawBitmap_Verb, paint, "drawImage(%s %g %g)", str.c_str(),
+ SkScalarToFloat(x), SkScalarToFloat(y));
+}
+
+void SkDumpCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) {
+ SkString bs, rs;
+ image->toString(&bs);
+ toString(dst, &rs);
+ // show the src-rect only if its not everything
+ if (src && (src->fLeft > 0 || src->fTop > 0 ||
+ src->fRight < SkIntToScalar(image->width()) ||
+ src->fBottom < SkIntToScalar(image->height()))) {
+ SkString ss;
+ toString(*src, &ss);
+ rs.prependf("%s ", ss.c_str());
+ }
+
+ this->dump(kDrawBitmap_Verb, paint, "drawImageRectToRect(%s %s)",
+ bs.c_str(), rs.c_str());
+}
+
+void SkDumpCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPaint* paint) {
SkString str;
bitmap.toString(&str);
this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(),
@@ -427,11 +460,11 @@
picture->cullRect().fRight, picture->cullRect().fBottom);
}
-void SkDumpCanvas::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) {
+void SkDumpCanvas::onDrawVertices(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->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)",
toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX),
SkScalarToFloat(vertices[0].fY));
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698