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

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

Issue 2261003003: store info in basedevice, change getter to non-virtual const& (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 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
« include/core/SkDevice.h ('K') | « src/svg/SkSVGDevice.h ('k') | 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 563
564 SkBaseDevice* SkSVGDevice::Create(const SkISize& size, SkXMLWriter* writer) { 564 SkBaseDevice* SkSVGDevice::Create(const SkISize& size, SkXMLWriter* writer) {
565 if (!writer) { 565 if (!writer) {
566 return nullptr; 566 return nullptr;
567 } 567 }
568 568
569 return new SkSVGDevice(size, writer); 569 return new SkSVGDevice(size, writer);
570 } 570 }
571 571
572 SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer) 572 SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer)
573 : INHERITED(SkSurfaceProps(0, kUnknown_SkPixelGeometry)) 573 : INHERITED(SkImageInfo::MakeUnknown(size.fWidth, size.fHeight),
574 SkSurfaceProps(0, kUnknown_SkPixelGeometry))
574 , fWriter(writer) 575 , fWriter(writer)
575 , fResourceBucket(new ResourceBucket) 576 , fResourceBucket(new ResourceBucket)
576 , fSize(size) { 577 {
577 SkASSERT(writer); 578 SkASSERT(writer);
578 579
579 fWriter->writeHeader(); 580 fWriter->writeHeader();
580 581
581 // The root <svg> tag gets closed by the destructor. 582 // The root <svg> tag gets closed by the destructor.
582 fRootElement.reset(new AutoElement("svg", fWriter)); 583 fRootElement.reset(new AutoElement("svg", fWriter));
583 584
584 fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg"); 585 fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg");
585 fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); 586 fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
586 fRootElement->addAttribute("width", size.width()); 587 fRootElement->addAttribute("width", size.width());
587 fRootElement->addAttribute("height", size.height()); 588 fRootElement->addAttribute("height", size.height());
588 } 589 }
589 590
590 SkSVGDevice::~SkSVGDevice() { 591 SkSVGDevice::~SkSVGDevice() {
591 } 592 }
592 593
593 SkImageInfo SkSVGDevice::imageInfo() const {
594 SkImageInfo info = SkImageInfo::MakeUnknown(fSize.fWidth, fSize.fHeight);
595 return info;
596 }
597
598 void SkSVGDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) { 594 void SkSVGDevice::drawPaint(const SkDraw& draw, const SkPaint& paint) {
599 AutoElement rect("rect", fWriter, fResourceBucket, draw, paint); 595 AutoElement rect("rect", fWriter, fResourceBucket, draw, paint);
600 rect.addRectAttributes(SkRect::MakeWH(SkIntToScalar(this->width()), 596 rect.addRectAttributes(SkRect::MakeWH(SkIntToScalar(this->width()),
601 SkIntToScalar(this->height()))); 597 SkIntToScalar(this->height())));
602 } 598 }
603 599
604 void SkSVGDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_ t count, 600 void SkSVGDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, size_ t count,
605 const SkPoint pts[], const SkPaint& paint) { 601 const SkPoint pts[], const SkPaint& paint) {
606 SkPath path; 602 SkPath path;
607 603
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 const SkPaint& paint) { 801 const SkPaint& paint) {
806 // todo 802 // todo
807 SkDebugf("unsupported operation: drawVertices()\n"); 803 SkDebugf("unsupported operation: drawVertices()\n");
808 } 804 }
809 805
810 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, 806 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
811 const SkPaint&) { 807 const SkPaint&) {
812 // todo 808 // todo
813 SkDebugf("unsupported operation: drawDevice()\n"); 809 SkDebugf("unsupported operation: drawDevice()\n");
814 } 810 }
OLDNEW
« include/core/SkDevice.h ('K') | « src/svg/SkSVGDevice.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698