| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2006 The Android Open Source Project | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 | |
| 9 #include "SkSVGEllipse.h" | |
| 10 #include "SkSVGParser.h" | |
| 11 #include "SkParse.h" | |
| 12 #include <stdio.h> | |
| 13 | |
| 14 const SkSVGAttribute SkSVGEllipse::gAttributes[] = { | |
| 15 SVG_ATTRIBUTE(cx), | |
| 16 SVG_ATTRIBUTE(cy), | |
| 17 SVG_ATTRIBUTE(rx), | |
| 18 SVG_ATTRIBUTE(ry) | |
| 19 }; | |
| 20 | |
| 21 DEFINE_SVG_INFO(Ellipse) | |
| 22 | |
| 23 void SkSVGEllipse::translate(SkSVGParser& parser, bool defState) { | |
| 24 parser._startElement("oval"); | |
| 25 INHERITED::translate(parser, defState); | |
| 26 SkScalar cx, cy, rx, ry; | |
| 27 SkParse::FindScalar(f_cx.c_str(), &cx); | |
| 28 SkParse::FindScalar(f_cy.c_str(), &cy); | |
| 29 SkParse::FindScalar(f_rx.c_str(), &rx); | |
| 30 SkParse::FindScalar(f_ry.c_str(), &ry); | |
| 31 SkScalar left, top, right, bottom; | |
| 32 left = cx - rx; | |
| 33 top = cy - ry; | |
| 34 right = cx + rx; | |
| 35 bottom = cy + ry; | |
| 36 char scratch[16]; | |
| 37 sprintf(scratch, "%g", SkScalarToDouble(left)); | |
| 38 parser._addAttribute("left", scratch); | |
| 39 sprintf(scratch, "%g", SkScalarToDouble(top)); | |
| 40 parser._addAttribute("top", scratch); | |
| 41 sprintf(scratch, "%g", SkScalarToDouble(right)); | |
| 42 parser._addAttribute("right", scratch); | |
| 43 sprintf(scratch, "%g", SkScalarToDouble(bottom)); | |
| 44 parser._addAttribute("bottom", scratch); | |
| 45 parser._endElement(); | |
| 46 } | |
| OLD | NEW |