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

Side by Side Diff: src/utils/SkDumpCanvas.cpp

Issue 835913002: 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 unified diff | Download patch
« no previous file with comments | « src/utils/SkDeferredCanvas.cpp ('k') | src/utils/SkLuaCanvas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkDumpCanvas.h" 9 #include "SkDumpCanvas.h"
10 10
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) { 287 void SkDumpCanvas::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
288 SkString str; 288 SkString str;
289 toString(deviceRgn, &str); 289 toString(deviceRgn, &str);
290 this->dump(kClip_Verb, NULL, "clipRegion(%s %s)", str.c_str(), 290 this->dump(kClip_Verb, NULL, "clipRegion(%s %s)", str.c_str(),
291 toString(op)); 291 toString(op));
292 this->INHERITED::onClipRegion(deviceRgn, op); 292 this->INHERITED::onClipRegion(deviceRgn, op);
293 } 293 }
294 294
295 /////////////////////////////////////////////////////////////////////////////// 295 ///////////////////////////////////////////////////////////////////////////////
296 296
297 void SkDumpCanvas::onDrawPaint(const SkPaint& paint) { 297 void SkDumpCanvas::drawPaint(const SkPaint& paint) {
298 this->dump(kDrawPaint_Verb, &paint, "drawPaint()"); 298 this->dump(kDrawPaint_Verb, &paint, "drawPaint()");
299 } 299 }
300 300
301 void SkDumpCanvas::onDrawPoints(PointMode mode, size_t count, 301 void SkDumpCanvas::drawPoints(PointMode mode, size_t count,
302 const SkPoint pts[], const SkPaint& paint) { 302 const SkPoint pts[], const SkPaint& paint) {
303 this->dump(kDrawPoints_Verb, &paint, "drawPoints(%s, %d)", toString(mode), 303 this->dump(kDrawPoints_Verb, &paint, "drawPoints(%s, %d)", toString(mode),
304 count); 304 count);
305 } 305 }
306 306
307 void SkDumpCanvas::onDrawOval(const SkRect& rect, const SkPaint& paint) { 307 void SkDumpCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
308 SkString str; 308 SkString str;
309 toString(rect, &str); 309 toString(rect, &str);
310 this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str()); 310 this->dump(kDrawOval_Verb, &paint, "drawOval(%s)", str.c_str());
311 } 311 }
312 312
313 void SkDumpCanvas::onDrawRect(const SkRect& rect, const SkPaint& paint) { 313 void SkDumpCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
314 SkString str; 314 SkString str;
315 toString(rect, &str); 315 toString(rect, &str);
316 this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str()); 316 this->dump(kDrawRect_Verb, &paint, "drawRect(%s)", str.c_str());
317 } 317 }
318 318
319 void SkDumpCanvas::onDrawRRect(const SkRRect& rrect, const SkPaint& paint) { 319 void SkDumpCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
320 SkString str; 320 SkString str;
321 toString(rrect, &str); 321 toString(rrect, &str);
322 this->dump(kDrawDRRect_Verb, &paint, "drawRRect(%s)", str.c_str()); 322 this->dump(kDrawDRRect_Verb, &paint, "drawRRect(%s)", str.c_str());
323 } 323 }
324 324
325 void SkDumpCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner, 325 void SkDumpCanvas::onDrawDRRect(const SkRRect& outer, const SkRRect& inner,
326 const SkPaint& paint) { 326 const SkPaint& paint) {
327 SkString str0, str1; 327 SkString str0, str1;
328 toString(outer, &str0); 328 toString(outer, &str0);
329 toString(inner, &str0); 329 toString(inner, &str0);
330 this->dump(kDrawRRect_Verb, &paint, "drawDRRect(%s,%s)", 330 this->dump(kDrawRRect_Verb, &paint, "drawDRRect(%s,%s)",
331 str0.c_str(), str1.c_str()); 331 str0.c_str(), str1.c_str());
332 } 332 }
333 333
334 void SkDumpCanvas::onDrawPath(const SkPath& path, const SkPaint& paint) { 334 void SkDumpCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
335 SkString str; 335 SkString str;
336 toString(path, &str); 336 toString(path, &str);
337 this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str()); 337 this->dump(kDrawPath_Verb, &paint, "drawPath(%s)", str.c_str());
338 } 338 }
339 339
340 void SkDumpCanvas::onDrawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y, 340 void SkDumpCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
341 const SkPaint* paint) { 341 const SkPaint* paint) {
342 SkString str; 342 SkString str;
343 bitmap.toString(&str); 343 bitmap.toString(&str);
344 this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(), 344 this->dump(kDrawBitmap_Verb, paint, "drawBitmap(%s %g %g)", str.c_str(),
345 SkScalarToFloat(x), SkScalarToFloat(y)); 345 SkScalarToFloat(x), SkScalarToFloat(y));
346 } 346 }
347 347
348 void SkDumpCanvas::onDrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, c onst SkRect& dst, 348 void SkDumpCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* sr c,
349 const SkPaint* paint, DrawBitmapRectFlags fl ags) { 349 const SkRect& dst, const SkPaint* paint,
350 DrawBitmapRectFlags flags) {
350 SkString bs, rs; 351 SkString bs, rs;
351 bitmap.toString(&bs); 352 bitmap.toString(&bs);
352 toString(dst, &rs); 353 toString(dst, &rs);
353 // show the src-rect only if its not everything 354 // show the src-rect only if its not everything
354 if (src && (src->fLeft > 0 || src->fTop > 0 || 355 if (src && (src->fLeft > 0 || src->fTop > 0 ||
355 src->fRight < SkIntToScalar(bitmap.width()) || 356 src->fRight < SkIntToScalar(bitmap.width()) ||
356 src->fBottom < SkIntToScalar(bitmap.height()))) { 357 src->fBottom < SkIntToScalar(bitmap.height()))) {
357 SkString ss; 358 SkString ss;
358 toString(*src, &ss); 359 toString(*src, &ss);
359 rs.prependf("%s ", ss.c_str()); 360 rs.prependf("%s ", ss.c_str());
360 } 361 }
361 362
362 this->dump(kDrawBitmap_Verb, paint, "drawBitmapRectToRect(%s %s)", 363 this->dump(kDrawBitmap_Verb, paint, "drawBitmapRectToRect(%s %s)",
363 bs.c_str(), rs.c_str()); 364 bs.c_str(), rs.c_str());
364 } 365 }
365 366
366 void SkDumpCanvas::onDrawBitmapNine(const SkBitmap& bitmap, const SkIRect& cente r, 367 void SkDumpCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
367 const SkRect& dst, const SkPaint* paint) { 368 const SkPaint* paint) {
368 SkString str, centerStr, dstStr;
369 bitmap.toString(&str);
370 toString(center, &centerStr);
371 toString(dst, &dstStr);
372 this->dump(kDrawBitmap_Verb, paint, "drawBitmapNine(%s %s %s)", str.c_str(),
373 centerStr.c_str(), dstStr.c_str());
374 }
375
376 void SkDumpCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y, con st SkPaint* paint) {
377 SkString str;
378 image->toString(&str);
379 this->dump(kDrawBitmap_Verb, paint, "drawImage(%s %g %g)", str.c_str(),
380 SkScalarToFloat(x), SkScalarToFloat(y));
381 }
382
383 void SkDumpCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, cons t SkRect& dst,
384 const SkPaint* paint) {
385 SkString bs, rs;
386 image->toString(&bs);
387 toString(dst, &rs);
388 // show the src-rect only if its not everything
389 if (src && (src->fLeft > 0 || src->fTop > 0 ||
390 src->fRight < SkIntToScalar(image->width()) ||
391 src->fBottom < SkIntToScalar(image->height()))) {
392 SkString ss;
393 toString(*src, &ss);
394 rs.prependf("%s ", ss.c_str());
395 }
396
397 this->dump(kDrawBitmap_Verb, paint, "drawImageRectToRect(%s %s)",
398 bs.c_str(), rs.c_str());
399 }
400
401 void SkDumpCanvas::onDrawSprite(const SkBitmap& bitmap, int x, int y, const SkPa int* paint) {
402 SkString str; 369 SkString str;
403 bitmap.toString(&str); 370 bitmap.toString(&str);
404 this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(), 371 this->dump(kDrawBitmap_Verb, paint, "drawSprite(%s %d %d)", str.c_str(),
405 x, y); 372 x, y);
406 } 373 }
407 374
408 void SkDumpCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, S kScalar y, 375 void SkDumpCanvas::onDrawText(const void* text, size_t byteLength, SkScalar x, S kScalar y,
409 const SkPaint& paint) { 376 const SkPaint& paint) {
410 SkString str; 377 SkString str;
411 toString(text, byteLength, paint.getTextEncoding(), &str); 378 toString(text, byteLength, paint.getTextEncoding(), &str);
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 picture->cullRect().fLeft, picture->cullRect().fTop, 420 picture->cullRect().fLeft, picture->cullRect().fTop,
454 picture->cullRect().fRight, picture->cullRect().fBottom); 421 picture->cullRect().fRight, picture->cullRect().fBottom);
455 fNestLevel += 1; 422 fNestLevel += 1;
456 this->INHERITED::onDrawPicture(picture, matrix, paint); 423 this->INHERITED::onDrawPicture(picture, matrix, paint);
457 fNestLevel -= 1; 424 fNestLevel -= 1;
458 this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %f:%f:%f:%f", &picture, 425 this->dump(kDrawPicture_Verb, NULL, "endPicture(%p) %f:%f:%f:%f", &picture,
459 picture->cullRect().fLeft, picture->cullRect().fTop, 426 picture->cullRect().fLeft, picture->cullRect().fTop,
460 picture->cullRect().fRight, picture->cullRect().fBottom); 427 picture->cullRect().fRight, picture->cullRect().fBottom);
461 } 428 }
462 429
463 void SkDumpCanvas::onDrawVertices(VertexMode vmode, int vertexCount, 430 void SkDumpCanvas::drawVertices(VertexMode vmode, int vertexCount,
464 const SkPoint vertices[], const SkPoint texs[] , 431 const SkPoint vertices[], const SkPoint texs[],
465 const SkColor colors[], SkXfermode* xmode, 432 const SkColor colors[], SkXfermode* xmode,
466 const uint16_t indices[], int indexCount, 433 const uint16_t indices[], int indexCount,
467 const SkPaint& paint) { 434 const SkPaint& paint) {
468 this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)", 435 this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)",
469 toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX), 436 toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX),
470 SkScalarToFloat(vertices[0].fY)); 437 SkScalarToFloat(vertices[0].fY));
471 } 438 }
472 439
473 void SkDumpCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4] , 440 void SkDumpCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4] ,
474 const SkPoint texCoords[4], SkXfermode* xmode, 441 const SkPoint texCoords[4], SkXfermode* xmode,
475 const SkPaint& paint) { 442 const SkPaint& paint) {
476 //dumps corner points and colors in clockwise order starting on upper-left c orner 443 //dumps corner points and colors in clockwise order starting on upper-left c orner
477 this->dump(kDrawPatch_Verb, &paint, "drawPatch(Vertices{[%f, %f], [%f, %f], [%f, %f], [%f, %f]}\ 444 this->dump(kDrawPatch_Verb, &paint, "drawPatch(Vertices{[%f, %f], [%f, %f], [%f, %f], [%f, %f]}\
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 528
562 /////////////////////////////////////////////////////////////////////////////// 529 ///////////////////////////////////////////////////////////////////////////////
563 530
564 static void dumpToDebugf(const char text[], void*) { 531 static void dumpToDebugf(const char text[], void*) {
565 SkDebugf("%s\n", text); 532 SkDebugf("%s\n", text);
566 } 533 }
567 534
568 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} 535 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {}
569 536
570 #endif 537 #endif
OLDNEW
« 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