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 "SkBase64.h" | 10 #include "SkBase64.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 static SkScalar svg_opacity(SkColor color) { | 35 static SkScalar svg_opacity(SkColor color) { |
36 return SkIntToScalar(SkColorGetA(color)) / SK_AlphaOPAQUE; | 36 return SkIntToScalar(SkColorGetA(color)) / SK_AlphaOPAQUE; |
37 } | 37 } |
38 | 38 |
39 // Keep in sync with SkPaint::Cap | 39 // Keep in sync with SkPaint::Cap |
40 static const char* cap_map[] = { | 40 static const char* cap_map[] = { |
41 NULL, // kButt_Cap (default) | 41 NULL, // kButt_Cap (default) |
42 "round", // kRound_Cap | 42 "round", // kRound_Cap |
43 "square" // kSquare_Cap | 43 "square" // kSquare_Cap |
44 }; | 44 }; |
45 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(cap_map) == SkPaint::kCapCount, missing_cap_map
_entry); | 45 static_assert(SK_ARRAY_COUNT(cap_map) == SkPaint::kCapCount, "missing_cap_map_en
try"); |
46 | 46 |
47 static const char* svg_cap(SkPaint::Cap cap) { | 47 static const char* svg_cap(SkPaint::Cap cap) { |
48 SkASSERT(cap < SK_ARRAY_COUNT(cap_map)); | 48 SkASSERT(cap < SK_ARRAY_COUNT(cap_map)); |
49 return cap_map[cap]; | 49 return cap_map[cap]; |
50 } | 50 } |
51 | 51 |
52 // Keep in sync with SkPaint::Join | 52 // Keep in sync with SkPaint::Join |
53 static const char* join_map[] = { | 53 static const char* join_map[] = { |
54 NULL, // kMiter_Join (default) | 54 NULL, // kMiter_Join (default) |
55 "round", // kRound_Join | 55 "round", // kRound_Join |
56 "bevel" // kBevel_Join | 56 "bevel" // kBevel_Join |
57 }; | 57 }; |
58 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(join_map) == SkPaint::kJoinCount, missing_join_
map_entry); | 58 static_assert(SK_ARRAY_COUNT(join_map) == SkPaint::kJoinCount, "missing_join_map
_entry"); |
59 | 59 |
60 static const char* svg_join(SkPaint::Join join) { | 60 static const char* svg_join(SkPaint::Join join) { |
61 SkASSERT(join < SK_ARRAY_COUNT(join_map)); | 61 SkASSERT(join < SK_ARRAY_COUNT(join_map)); |
62 return join_map[join]; | 62 return join_map[join]; |
63 } | 63 } |
64 | 64 |
65 // Keep in sync with SkPaint::Align | 65 // Keep in sync with SkPaint::Align |
66 static const char* text_align_map[] = { | 66 static const char* text_align_map[] = { |
67 NULL, // kLeft_Align (default) | 67 NULL, // kLeft_Align (default) |
68 "middle", // kCenter_Align | 68 "middle", // kCenter_Align |
69 "end" // kRight_Align | 69 "end" // kRight_Align |
70 }; | 70 }; |
71 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(text_align_map) == SkPaint::kAlignCount, | 71 static_assert(SK_ARRAY_COUNT(text_align_map) == SkPaint::kAlignCount, |
72 missing_text_align_map_entry); | 72 "missing_text_align_map_entry"); |
73 static const char* svg_text_align(SkPaint::Align align) { | 73 static const char* svg_text_align(SkPaint::Align align) { |
74 SkASSERT(align < SK_ARRAY_COUNT(text_align_map)); | 74 SkASSERT(align < SK_ARRAY_COUNT(text_align_map)); |
75 return text_align_map[align]; | 75 return text_align_map[align]; |
76 } | 76 } |
77 | 77 |
78 static SkString svg_transform(const SkMatrix& t) { | 78 static SkString svg_transform(const SkMatrix& t) { |
79 SkASSERT(!t.isIdentity()); | 79 SkASSERT(!t.isIdentity()); |
80 | 80 |
81 SkString tstr; | 81 SkString tstr; |
82 switch (t.getType()) { | 82 switch (t.getType()) { |
(...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |