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

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

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 years, 3 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/svg/SkSVGCanvas.cpp ('k') | src/svg/skp2svg.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 * 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 283
284 AutoElement(const char name[], SkXMLWriter* writer, ResourceBucket* bucket, 284 AutoElement(const char name[], SkXMLWriter* writer, ResourceBucket* bucket,
285 const SkDraw& draw, const SkPaint& paint) 285 const SkDraw& draw, const SkPaint& paint)
286 : fWriter(writer) 286 : fWriter(writer)
287 , fResourceBucket(bucket) { 287 , fResourceBucket(bucket) {
288 288
289 Resources res = this->addResources(draw, paint); 289 Resources res = this->addResources(draw, paint);
290 if (!res.fClip.isEmpty()) { 290 if (!res.fClip.isEmpty()) {
291 // The clip is in device space. Apply it via a <g> wrapper to avoid local transform 291 // The clip is in device space. Apply it via a <g> wrapper to avoid local transform
292 // interference. 292 // interference.
293 fClipGroup.reset(SkNEW_ARGS(AutoElement, ("g", fWriter))); 293 fClipGroup.reset(new AutoElement("g", fWriter));
294 fClipGroup->addAttribute("clip-path",res.fClip); 294 fClipGroup->addAttribute("clip-path",res.fClip);
295 } 295 }
296 296
297 fWriter->startElement(name); 297 fWriter->startElement(name);
298 298
299 this->addPaint(paint, res); 299 this->addPaint(paint, res);
300 300
301 if (!draw.fMatrix->isIdentity()) { 301 if (!draw.fMatrix->isIdentity()) {
302 this->addAttribute("transform", svg_transform(*draw.fMatrix)); 302 this->addAttribute("transform", svg_transform(*draw.fMatrix));
303 } 303 }
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 if (!familyName.isEmpty()) { 559 if (!familyName.isEmpty()) {
560 this->addAttribute("font-family", familyName); 560 this->addAttribute("font-family", familyName);
561 } 561 }
562 } 562 }
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 NULL; 566 return NULL;
567 } 567 }
568 568
569 return SkNEW_ARGS(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(SkSurfaceProps(0, kUnknown_SkPixelGeometry))
574 , fWriter(writer) 574 , fWriter(writer)
575 , fResourceBucket(SkNEW(ResourceBucket)) { 575 , fResourceBucket(new ResourceBucket) {
576 SkASSERT(writer); 576 SkASSERT(writer);
577 577
578 fLegacyBitmap.setInfo(SkImageInfo::MakeUnknown(size.width(), size.height())) ; 578 fLegacyBitmap.setInfo(SkImageInfo::MakeUnknown(size.width(), size.height())) ;
579 579
580 fWriter->writeHeader(); 580 fWriter->writeHeader();
581 581
582 // The root <svg> tag gets closed by the destructor. 582 // The root <svg> tag gets closed by the destructor.
583 fRootElement.reset(SkNEW_ARGS(AutoElement, ("svg", fWriter))); 583 fRootElement.reset(new AutoElement("svg", fWriter));
584 584
585 fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg"); 585 fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg");
586 fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); 586 fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink");
587 fRootElement->addAttribute("width", size.width()); 587 fRootElement->addAttribute("width", size.width());
588 fRootElement->addAttribute("height", size.height()); 588 fRootElement->addAttribute("height", size.height());
589 } 589 }
590 590
591 SkSVGDevice::~SkSVGDevice() { 591 SkSVGDevice::~SkSVGDevice() {
592 } 592 }
593 593
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 const SkPaint& paint) { 809 const SkPaint& paint) {
810 // todo 810 // todo
811 SkDebugf("unsupported operation: drawVertices()\n"); 811 SkDebugf("unsupported operation: drawVertices()\n");
812 } 812 }
813 813
814 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, 814 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y,
815 const SkPaint&) { 815 const SkPaint&) {
816 // todo 816 // todo
817 SkDebugf("unsupported operation: drawDevice()\n"); 817 SkDebugf("unsupported operation: drawDevice()\n");
818 } 818 }
OLDNEW
« no previous file with comments | « src/svg/SkSVGCanvas.cpp ('k') | src/svg/skp2svg.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698