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

Side by Side Diff: src/svg/SkSVGDevice.cpp

Issue 1127933003: Update SVGDevice for RRect and drawPoints (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 | « no previous file | no next file » | 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 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkSVGDevice.h" 8 #include "SkSVGDevice.h"
9 9
10 #include "SkBase64.h" 10 #include "SkBase64.h"
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 const SkBitmap& SkSVGDevice::onAccessBitmap() { 596 const SkBitmap& SkSVGDevice::onAccessBitmap() {
597 return fLegacyBitmap; 597 return fLegacyBitmap;
598 } 598 }
599 599
600 void SkSVGDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 600 void SkSVGDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
601 AutoElement rect("rect", fWriter, fResourceBucket, draw, paint); 601 AutoElement rect("rect", fWriter, fResourceBucket, draw, paint);
602 rect.addRectAttributes(SkRect::MakeWH(SkIntToScalar(this->width()), 602 rect.addRectAttributes(SkRect::MakeWH(SkIntToScalar(this->width()),
603 SkIntToScalar(this->height()))); 603 SkIntToScalar(this->height())));
604 } 604 }
605 605
606 void SkSVGDevice::drawPoints(const SkDraw&, SkCanvas::PointMode mode, size_t cou nt, 606 void SkSVGDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_ t count,
607 const SkPoint[], const SkPaint& paint) { 607 const SkPoint pts[], const SkPaint& paint) {
608 // todo 608 SkPath path;
609 SkDebugf("unsupported operation: drawPoints()\n"); 609
610 switch (mode) {
611 // todo
612 case SkCanvas::kPoints_PointMode:
613 SkDebugf("unsupported operation: drawPoints(kPoints_PointMode)\n");
614 break;
615 case SkCanvas::kLines_PointMode:
616 count -= 1;
617 for (size_t i = 0; i < count; i += 2) {
618 path.rewind();
619 path.moveTo(pts[i]);
620 path.lineTo(pts[i+1]);
621 AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
622 elem.addPathAttributes(path);
623 }
624 break;
625 case SkCanvas::kPolygon_PointMode:
626 if (count > 1) {
627 path.addPoly(pts, SkToInt(count), false);
628 path.moveTo(pts[0]);
629 AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
630 elem.addPathAttributes(path);
631 }
632 break;
633 }
610 } 634 }
611 635
612 void SkSVGDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& p aint) { 636 void SkSVGDevice::drawRect(const SkDraw& draw, const SkRect& r, const SkPaint& p aint) {
613 AutoElement rect("rect", fWriter, fResourceBucket, draw, paint); 637 AutoElement rect("rect", fWriter, fResourceBucket, draw, paint);
614 rect.addRectAttributes(r); 638 rect.addRectAttributes(r);
615 } 639 }
616 640
617 void SkSVGDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint & paint) { 641 void SkSVGDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint & paint) {
618 AutoElement ellipse("ellipse", fWriter, fResourceBucket, draw, paint); 642 AutoElement ellipse("ellipse", fWriter, fResourceBucket, draw, paint);
619 ellipse.addAttribute("cx", oval.centerX()); 643 ellipse.addAttribute("cx", oval.centerX());
620 ellipse.addAttribute("cy", oval.centerY()); 644 ellipse.addAttribute("cy", oval.centerY());
621 ellipse.addAttribute("rx", oval.width() / 2); 645 ellipse.addAttribute("rx", oval.width() / 2);
622 ellipse.addAttribute("ry", oval.height() / 2); 646 ellipse.addAttribute("ry", oval.height() / 2);
623 } 647 }
624 648
625 void SkSVGDevice::drawRRect(const SkDraw&, const SkRRect& rr, const SkPaint& pai nt) { 649 void SkSVGDevice::drawRRect(const SkDraw& draw, const SkRRect& rr, const SkPaint & paint) {
626 // todo 650 SkPath path;
627 SkDebugf("unsupported operation: drawRRect()\n"); 651 path.addRRect(rr);
652
653 AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
654 elem.addPathAttributes(path);
628 } 655 }
629 656
630 void SkSVGDevice::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint & paint, 657 void SkSVGDevice::drawPath(const SkDraw& draw, const SkPath& path, const SkPaint & paint,
631 const SkMatrix* prePathMatrix, bool pathIsMutable) { 658 const SkMatrix* prePathMatrix, bool pathIsMutable) {
632 AutoElement elem("path", fWriter, fResourceBucket, draw, paint); 659 AutoElement elem("path", fWriter, fResourceBucket, draw, paint);
633 elem.addPathAttributes(path); 660 elem.addPathAttributes(path);
634 } 661 }
635 662
636 void SkSVGDevice::drawBitmapCommon(const SkDraw& draw, const SkBitmap& bm, 663 void SkSVGDevice::drawBitmapCommon(const SkDraw& draw, const SkBitmap& bm,
637 const SkPaint& paint) { 664 const SkPaint& paint) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
780 const SkPaint& paint) { 807 const SkPaint& paint) {
781 // todo 808 // todo
782 SkDebugf("unsupported operation: drawVertices()\n"); 809 SkDebugf("unsupported operation: drawVertices()\n");
783 } 810 }
784 811
785 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, 812 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
786 const SkPaint&) { 813 const SkPaint&) {
787 // todo 814 // todo
788 SkDebugf("unsupported operation: drawDevice()\n"); 815 SkDebugf("unsupported operation: drawDevice()\n");
789 } 816 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698