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

Side by Side Diff: experimental/svg/model/SkSVGAttributeParser.h

Issue 2220933003: [SVGDom] Improved transform parsing (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: review 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
« no previous file with comments | « no previous file | experimental/svg/model/SkSVGAttributeParser.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 2016 Google Inc. 2 * Copyright 2016 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 #ifndef SkSVGAttributeParser_DEFINED 8 #ifndef SkSVGAttributeParser_DEFINED
9 #define SkSVGAttributeParser_DEFINED 9 #define SkSVGAttributeParser_DEFINED
10 10
11 #include "SkSVGTypes.h" 11 #include "SkSVGTypes.h"
12 12
13 class SkSVGAttributeParser : public SkNoncopyable { 13 class SkSVGAttributeParser : public SkNoncopyable {
14 public: 14 public:
15 SkSVGAttributeParser(const char[]); 15 SkSVGAttributeParser(const char[]);
16 16
17 bool parseColor(SkSVGColorType*); 17 bool parseColor(SkSVGColorType*);
18 bool parseNumber(SkSVGNumberType*); 18 bool parseNumber(SkSVGNumberType*);
19 bool parseLength(SkSVGLength*); 19 bool parseLength(SkSVGLength*);
20 bool parseViewBox(SkSVGViewBoxType*); 20 bool parseViewBox(SkSVGViewBoxType*);
21 bool parseTransform(SkSVGTransformType*);
21 22
22 private: 23 private:
23 // Stack-only 24 // Stack-only
24 void* operator new(size_t) = delete; 25 void* operator new(size_t) = delete;
25 void* operator new(size_t, void*) = delete; 26 void* operator new(size_t, void*) = delete;
26 27
27 template <typename F> 28 template <typename F>
28 bool advanceWhile(F func); 29 bool advanceWhile(F func);
29 30
30 bool parseWSToken(); 31 bool parseWSToken();
31 bool parseEOSToken(); 32 bool parseEOSToken();
32 bool parseSepToken(); 33 bool parseSepToken();
33 bool parseExpectedStringToken(const char*); 34 bool parseExpectedStringToken(const char*);
34 bool parseScalarToken(SkScalar*); 35 bool parseScalarToken(SkScalar*);
35 bool parseHexToken(uint32_t*); 36 bool parseHexToken(uint32_t*);
36 bool parseLengthUnitToken(SkSVGLength::Unit*); 37 bool parseLengthUnitToken(SkSVGLength::Unit*);
37 bool parseNamedColorToken(SkColor*); 38 bool parseNamedColorToken(SkColor*);
38 bool parseHexColorToken(SkColor*); 39 bool parseHexColorToken(SkColor*);
39 40
41 // Transform helpers
42 bool parseMatrixToken(SkMatrix*);
43 bool parseTranslateToken(SkMatrix*);
44 bool parseScaleToken(SkMatrix*);
45 bool parseRotateToken(SkMatrix*);
46 bool parseSkewXToken(SkMatrix*);
47 bool parseSkewYToken(SkMatrix*);
48
49 // Parses a sequence of 'WS* <prefix> WS* (<nested>)', where the nested sequ ence
50 // is handled by the passed functor.
51 template <typename Func, typename T>
52 bool parseParenthesized(const char* prefix, Func, T* result);
53
40 // The current position in the input string. 54 // The current position in the input string.
41 const char* fCurPos; 55 const char* fCurPos;
42 56
43 typedef SkNoncopyable INHERITED; 57 typedef SkNoncopyable INHERITED;
44 }; 58 };
45 59
46 #endif // SkSVGAttributeParser_DEFINED 60 #endif // SkSVGAttributeParser_DEFINED
OLDNEW
« no previous file with comments | « no previous file | experimental/svg/model/SkSVGAttributeParser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698