OLD | NEW |
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 |
11 #ifdef SK_DEVELOPER | 11 #ifdef SK_DEVELOPER |
| 12 #include "SkPatchUtils.h" |
12 #include "SkPicture.h" | 13 #include "SkPicture.h" |
13 #include "SkPixelRef.h" | 14 #include "SkPixelRef.h" |
14 #include "SkRRect.h" | 15 #include "SkRRect.h" |
15 #include "SkString.h" | 16 #include "SkString.h" |
16 #include <stdarg.h> | 17 #include <stdarg.h> |
17 #include <stdio.h> | 18 #include <stdio.h> |
18 | 19 |
19 // needed just to know that these are all subclassed from SkFlattenable | 20 // needed just to know that these are all subclassed from SkFlattenable |
20 #include "SkShader.h" | 21 #include "SkShader.h" |
21 #include "SkPathEffect.h" | 22 #include "SkPathEffect.h" |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 void SkDumpCanvas::drawVertices(VertexMode vmode, int vertexCount, | 437 void SkDumpCanvas::drawVertices(VertexMode vmode, int vertexCount, |
437 const SkPoint vertices[], const SkPoint texs[], | 438 const SkPoint vertices[], const SkPoint texs[], |
438 const SkColor colors[], SkXfermode* xmode, | 439 const SkColor colors[], SkXfermode* xmode, |
439 const uint16_t indices[], int indexCount, | 440 const uint16_t indices[], int indexCount, |
440 const SkPaint& paint) { | 441 const SkPaint& paint) { |
441 this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)", | 442 this->dump(kDrawVertices_Verb, &paint, "drawVertices(%s [%d] %g %g ...)", |
442 toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX), | 443 toString(vmode), vertexCount, SkScalarToFloat(vertices[0].fX), |
443 SkScalarToFloat(vertices[0].fY)); | 444 SkScalarToFloat(vertices[0].fY)); |
444 } | 445 } |
445 | 446 |
446 void SkDumpCanvas::drawPatch(const SkPatch& patch, const SkPaint& paint) { | 447 void SkDumpCanvas::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4]
, |
447 const SkPoint* points = patch.getControlPoints(); | 448 const SkPoint texCoords[4], SkXfermode* xmode, |
448 const SkColor* color = patch.getColors(); | 449 const SkPaint& paint) { |
449 //dumps corner points and colors in clockwise order starting on upper-left c
orner | 450 //dumps corner points and colors in clockwise order starting on upper-left c
orner |
450 this->dump(kDrawPatch_Verb, &paint, "drawPatch(Vertices{[%f, %f], [%f, %f],
[%f, %f], [%f, %f]}\ | 451 this->dump(kDrawPatch_Verb, &paint, "drawPatch(Vertices{[%f, %f], [%f, %f],
[%f, %f], [%f, %f]}\ |
451 | Colors{[0x%x], [0x%x], [0x%x], [0x%x]})", | 452 | Colors{[0x%x], [0x%x], [0x%x], [0x%x]} | TexCoords{[%f,%f], [%f,
%f], [%f,%f], \ |
452 points[SkPatch::kTopP0_CubicCtrlPts].fX, points[SkPatch::kTopP0_Cu
bicCtrlPts].fY, | 453 [%f,%f]})", |
453 points[SkPatch::kTopP3_CubicCtrlPts].fX, points[SkPatch::kTopP3_Cu
bicCtrlPts].fY, | 454 cubics[SkPatchUtils::kTopP0_CubicCtrlPts].fX, |
454 points[SkPatch::kBottomP3_CubicCtrlPts].fX,points[SkPatch::kBottom
P3_CubicCtrlPts].fY, | 455 cubics[SkPatchUtils::kTopP0_CubicCtrlPts].fY, |
455 points[SkPatch::kBottomP0_CubicCtrlPts].fX,points[SkPatch::kBottom
P0_CubicCtrlPts].fY, | 456 cubics[SkPatchUtils::kTopP3_CubicCtrlPts].fX, |
456 color[0], color[1], color[2], color[3]); | 457 cubics[SkPatchUtils::kTopP3_CubicCtrlPts].fY, |
| 458 cubics[SkPatchUtils::kBottomP3_CubicCtrlPts].fX, |
| 459 cubics[SkPatchUtils::kBottomP3_CubicCtrlPts].fY, |
| 460 cubics[SkPatchUtils::kBottomP0_CubicCtrlPts].fX, |
| 461 cubics[SkPatchUtils::kBottomP0_CubicCtrlPts].fY, |
| 462 colors[0], colors[1], colors[2], colors[3], |
| 463 texCoords[0].x(), texCoords[0].y(), texCoords[1].x(), texCoords[1]
.y(), |
| 464 texCoords[2].x(), texCoords[2].y(), texCoords[3].x(), texCoords[3]
.y()); |
457 } | 465 } |
458 | 466 |
459 void SkDumpCanvas::drawData(const void* data, size_t length) { | 467 void SkDumpCanvas::drawData(const void* data, size_t length) { |
460 // this->dump(kDrawData_Verb, NULL, "drawData(%d)", length); | 468 // this->dump(kDrawData_Verb, NULL, "drawData(%d)", length); |
461 this->dump(kDrawData_Verb, NULL, "drawData(%d) %.*s", length, | 469 this->dump(kDrawData_Verb, NULL, "drawData(%d) %.*s", length, |
462 SkTMin<size_t>(length, 64), data); | 470 SkTMin<size_t>(length, 64), data); |
463 } | 471 } |
464 | 472 |
465 void SkDumpCanvas::beginCommentGroup(const char* description) { | 473 void SkDumpCanvas::beginCommentGroup(const char* description) { |
466 this->dump(kBeginCommentGroup_Verb, NULL, "beginCommentGroup(%s)", descripti
on); | 474 this->dump(kBeginCommentGroup_Verb, NULL, "beginCommentGroup(%s)", descripti
on); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 | 541 |
534 /////////////////////////////////////////////////////////////////////////////// | 542 /////////////////////////////////////////////////////////////////////////////// |
535 | 543 |
536 static void dumpToDebugf(const char text[], void*) { | 544 static void dumpToDebugf(const char text[], void*) { |
537 SkDebugf("%s\n", text); | 545 SkDebugf("%s\n", text); |
538 } | 546 } |
539 | 547 |
540 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} | 548 SkDebugfDumper::SkDebugfDumper() : INHERITED(dumpToDebugf, NULL) {} |
541 | 549 |
542 #endif | 550 #endif |
OLD | NEW |