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

Side by Side Diff: src/svg/parser/SkSVGCircle.cpp

Issue 2154193003: Delete the legacy SVG parser (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 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/parser/SkSVGCircle.h ('k') | src/svg/parser/SkSVGClipPath.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 "SkSVGCircle.h"
10 #include "SkSVGParser.h"
11 #include "SkParse.h"
12 #include <stdio.h>
13
14 const SkSVGAttribute SkSVGCircle::gAttributes[] = {
15 SVG_ATTRIBUTE(cx),
16 SVG_ATTRIBUTE(cy),
17 SVG_ATTRIBUTE(r)
18 };
19
20 DEFINE_SVG_INFO(Circle)
21
22 void SkSVGCircle::translate(SkSVGParser& parser, bool defState) {
23 parser._startElement("oval");
24 INHERITED::translate(parser, defState);
25 SkScalar cx, cy, r;
26 SkParse::FindScalar(f_cx.c_str(), &cx);
27 SkParse::FindScalar(f_cy.c_str(), &cy);
28 SkParse::FindScalar(f_r.c_str(), &r);
29 SkScalar left, top, right, bottom;
30 left = cx - r;
31 top = cy - r;
32 right = cx + r;
33 bottom = cy + r;
34 char scratch[16];
35 sprintf(scratch, "%g", SkScalarToDouble(left));
36 parser._addAttribute("left", scratch);
37 sprintf(scratch, "%g", SkScalarToDouble(top));
38 parser._addAttribute("top", scratch);
39 sprintf(scratch, "%g", SkScalarToDouble(right));
40 parser._addAttribute("right", scratch);
41 sprintf(scratch, "%g", SkScalarToDouble(bottom));
42 parser._addAttribute("bottom", scratch);
43 parser._endElement();
44 }
OLDNEW
« no previous file with comments | « src/svg/parser/SkSVGCircle.h ('k') | src/svg/parser/SkSVGClipPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698