OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2002, 2003 The Karbon Developers | 2 * Copyright (C) 2002, 2003 The Karbon Developers |
3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> |
5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. |
6 * | 6 * |
7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 if (string.is8Bit()) { | 244 if (string.is8Bit()) { |
245 const LChar* ptr = string.characters8(); | 245 const LChar* ptr = string.characters8(); |
246 const LChar* end = ptr + string.length(); | 246 const LChar* end = ptr + string.length(); |
247 return genericParseNumberOrPercentage(ptr, end, number); | 247 return genericParseNumberOrPercentage(ptr, end, number); |
248 } | 248 } |
249 const UChar* ptr = string.characters16(); | 249 const UChar* ptr = string.characters16(); |
250 const UChar* end = ptr + string.length(); | 250 const UChar* end = ptr + string.length(); |
251 return genericParseNumberOrPercentage(ptr, end, number); | 251 return genericParseNumberOrPercentage(ptr, end, number); |
252 } | 252 } |
253 | 253 |
254 template <typename CharType> | |
255 bool parseFloatPoint(const CharType*& current, const CharType* end, FloatPoint&
point) | |
256 { | |
257 float x; | |
258 float y; | |
259 if (!parseNumber(current, end, x) | |
260 || !parseNumber(current, end, y)) | |
261 return false; | |
262 point = FloatPoint(x, y); | |
263 return true; | |
264 } | |
265 | |
266 template bool parseFloatPoint(const LChar*& current, const LChar* end, FloatPoin
t& point1); | |
267 template bool parseFloatPoint(const UChar*& current, const UChar* end, FloatPoin
t& point1); | |
268 | |
269 template <typename CharType> | |
270 inline bool parseFloatPoint2(const CharType*& current, const CharType* end, Floa
tPoint& point1, FloatPoint& point2) | |
271 { | |
272 float x1; | |
273 float y1; | |
274 float x2; | |
275 float y2; | |
276 if (!parseNumber(current, end, x1) | |
277 || !parseNumber(current, end, y1) | |
278 || !parseNumber(current, end, x2) | |
279 || !parseNumber(current, end, y2)) | |
280 return false; | |
281 point1 = FloatPoint(x1, y1); | |
282 point2 = FloatPoint(x2, y2); | |
283 return true; | |
284 } | |
285 | |
286 template bool parseFloatPoint2(const LChar*& current, const LChar* end, FloatPoi
nt& point1, FloatPoint& point2); | |
287 template bool parseFloatPoint2(const UChar*& current, const UChar* end, FloatPoi
nt& point1, FloatPoint& point2); | |
288 | |
289 template <typename CharType> | |
290 bool parseFloatPoint3(const CharType*& current, const CharType* end, FloatPoint&
point1, FloatPoint& point2, FloatPoint& point3) | |
291 { | |
292 float x1; | |
293 float y1; | |
294 float x2; | |
295 float y2; | |
296 float x3; | |
297 float y3; | |
298 if (!parseNumber(current, end, x1) | |
299 || !parseNumber(current, end, y1) | |
300 || !parseNumber(current, end, x2) | |
301 || !parseNumber(current, end, y2) | |
302 || !parseNumber(current, end, x3) | |
303 || !parseNumber(current, end, y3)) | |
304 return false; | |
305 point1 = FloatPoint(x1, y1); | |
306 point2 = FloatPoint(x2, y2); | |
307 point3 = FloatPoint(x3, y3); | |
308 return true; | |
309 } | |
310 | |
311 template bool parseFloatPoint3(const LChar*& current, const LChar* end, FloatPoi
nt& point1, FloatPoint& point2, FloatPoint& point3); | |
312 template bool parseFloatPoint3(const UChar*& current, const UChar* end, FloatPoi
nt& point1, FloatPoint& point2, FloatPoint& point3); | |
313 | |
314 static const LChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'}; | 254 static const LChar skewXDesc[] = {'s', 'k', 'e', 'w', 'X'}; |
315 static const LChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'}; | 255 static const LChar skewYDesc[] = {'s', 'k', 'e', 'w', 'Y'}; |
316 static const LChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'}; | 256 static const LChar scaleDesc[] = {'s', 'c', 'a', 'l', 'e'}; |
317 static const LChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', '
e'}; | 257 static const LChar translateDesc[] = {'t', 'r', 'a', 'n', 's', 'l', 'a', 't', '
e'}; |
318 static const LChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'}; | 258 static const LChar rotateDesc[] = {'r', 'o', 't', 'a', 't', 'e'}; |
319 static const LChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'}; | 259 static const LChar matrixDesc[] = {'m', 'a', 't', 'r', 'i', 'x'}; |
320 | 260 |
321 template<typename CharType> | 261 template<typename CharType> |
322 bool parseAndSkipTransformType(const CharType*& ptr, const CharType* end, SVGTra
nsformType& type) | 262 bool parseAndSkipTransformType(const CharType*& ptr, const CharType* end, SVGTra
nsformType& type) |
323 { | 263 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 parseAndSkipTransformType(ptr, end, type); | 299 parseAndSkipTransformType(ptr, end, type); |
360 } else { | 300 } else { |
361 const UChar* ptr = string.characters16(); | 301 const UChar* ptr = string.characters16(); |
362 const UChar* end = ptr + string.length(); | 302 const UChar* end = ptr + string.length(); |
363 parseAndSkipTransformType(ptr, end, type); | 303 parseAndSkipTransformType(ptr, end, type); |
364 } | 304 } |
365 return type; | 305 return type; |
366 } | 306 } |
367 | 307 |
368 } | 308 } |
OLD | NEW |