| OLD | NEW |
| 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 "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 tface->getFamilyName(&familyName); | 464 tface->getFamilyName(&familyName); |
| 465 if (!familyName.isEmpty()) { | 465 if (!familyName.isEmpty()) { |
| 466 this->addAttribute("font-family", familyName); | 466 this->addAttribute("font-family", familyName); |
| 467 } | 467 } |
| 468 | 468 |
| 469 if (const char* textAlign = svg_text_align(paint.getTextAlign())) { | 469 if (const char* textAlign = svg_text_align(paint.getTextAlign())) { |
| 470 this->addAttribute("text-anchor", textAlign); | 470 this->addAttribute("text-anchor", textAlign); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 | 473 |
| 474 SkBaseDevice* SkSVGDevice::Create(const SkISize& size, SkWStream* wstream) { | 474 SkBaseDevice* SkSVGDevice::Create(const SkISize& size, SkXMLWriter* writer) { |
| 475 if (!SkToBool(wstream)) { | 475 if (!writer) { |
| 476 return NULL; | 476 return NULL; |
| 477 } | 477 } |
| 478 | 478 |
| 479 return SkNEW_ARGS(SkSVGDevice, (size, wstream)); | 479 return SkNEW_ARGS(SkSVGDevice, (size, writer)); |
| 480 } | 480 } |
| 481 | 481 |
| 482 SkSVGDevice::SkSVGDevice(const SkISize& size, SkWStream* wstream) | 482 SkSVGDevice::SkSVGDevice(const SkISize& size, SkXMLWriter* writer) |
| 483 : fWriter(SkNEW_ARGS(SkXMLStreamWriter, (wstream))) | 483 : fWriter(writer) |
| 484 , fResourceBucket(SkNEW(ResourceBucket)) { | 484 , fResourceBucket(SkNEW(ResourceBucket)) { |
| 485 SkASSERT(writer); |
| 485 | 486 |
| 486 fLegacyBitmap.setInfo(SkImageInfo::MakeUnknown(size.width(), size.height()))
; | 487 fLegacyBitmap.setInfo(SkImageInfo::MakeUnknown(size.width(), size.height()))
; |
| 487 | 488 |
| 488 fWriter->writeHeader(); | 489 fWriter->writeHeader(); |
| 489 | 490 |
| 490 // The root <svg> tag gets closed by the destructor. | 491 // The root <svg> tag gets closed by the destructor. |
| 491 fRootElement.reset(SkNEW_ARGS(AutoElement, ("svg", fWriter))); | 492 fRootElement.reset(SkNEW_ARGS(AutoElement, ("svg", fWriter))); |
| 492 | 493 |
| 493 fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg"); | 494 fRootElement->addAttribute("xmlns", "http://www.w3.org/2000/svg"); |
| 494 fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); | 495 fRootElement->addAttribute("xmlns:xlink", "http://www.w3.org/1999/xlink"); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 const SkPaint& paint) { | 642 const SkPaint& paint) { |
| 642 // todo | 643 // todo |
| 643 SkDebugf("unsupported operation: drawVertices()\n"); | 644 SkDebugf("unsupported operation: drawVertices()\n"); |
| 644 } | 645 } |
| 645 | 646 |
| 646 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, | 647 void SkSVGDevice::drawDevice(const SkDraw&, SkBaseDevice*, int x, int y, |
| 647 const SkPaint&) { | 648 const SkPaint&) { |
| 648 // todo | 649 // todo |
| 649 SkDebugf("unsupported operation: drawDevice()\n"); | 650 SkDebugf("unsupported operation: drawDevice()\n"); |
| 650 } | 651 } |
| OLD | NEW |