| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkParse.h" | 10 #include "SkParse.h" |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 480 } |
| 481 // } else if (strchr(value, ',')) { | 481 // } else if (strchr(value, ',')) { |
| 482 // SkScalar array[4]; | 482 // SkScalar array[4]; |
| 483 // int count = count_separators(value, ",") + 1; // !!! count commas, add 1 | 483 // int count = count_separators(value, ",") + 1; // !!! count commas, add 1 |
| 484 // SkASSERT(count == 3 || count == 4); | 484 // SkASSERT(count == 3 || count == 4); |
| 485 // array[0] = SK_Scalar1 * 255; | 485 // array[0] = SK_Scalar1 * 255; |
| 486 // const char* end = SkParse::FindScalars(value, &array[4 - count], count); | 486 // const char* end = SkParse::FindScalars(value, &array[4 - count], count); |
| 487 // if (end == NULL) | 487 // if (end == NULL) |
| 488 // return NULL; | 488 // return NULL; |
| 489 // !!! range check for errors? | 489 // !!! range check for errors? |
| 490 // *colorPtr = SkColorSetARGB(SkScalarRound(array[0]), SkScalarRound(array[
1]), | 490 // *colorPtr = SkColorSetARGB(SkScalarRoundToInt(array[0]), SkScalarRoundTo
Int(array[1]), |
| 491 // SkScalarRound(array[2]), SkScalarRound(array[3])); | 491 // SkScalarRoundToInt(array[2]), SkScalarRoundToInt(array[3])); |
| 492 // return end; | 492 // return end; |
| 493 } else | 493 } else |
| 494 return FindNamedColor(value, strlen(value), colorPtr); | 494 return FindNamedColor(value, strlen(value), colorPtr); |
| 495 } | 495 } |
| 496 | 496 |
| 497 #ifdef SK_SUPPORT_UNITTEST | 497 #ifdef SK_SUPPORT_UNITTEST |
| 498 void SkParse::TestColor() { | 498 void SkParse::TestColor() { |
| 499 if (false) | 499 if (false) |
| 500 CreateTable(); // regenerates data table in the output window | 500 CreateTable(); // regenerates data table in the output window |
| 501 SkColor result; | 501 SkColor result; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 530 result = SK_ColorBLACK; | 530 result = SK_ColorBLACK; |
| 531 SkASSERT(FindColor("#123", &result)); | 531 SkASSERT(FindColor("#123", &result)); |
| 532 SkASSERT(result == 0Xff112233); | 532 SkASSERT(result == 0Xff112233); |
| 533 SkASSERT(FindColor("#abcd", &result)); | 533 SkASSERT(FindColor("#abcd", &result)); |
| 534 SkASSERT(result == 0Xaabbccdd); | 534 SkASSERT(result == 0Xaabbccdd); |
| 535 result = SK_ColorBLACK; | 535 result = SK_ColorBLACK; |
| 536 // SkASSERT(FindColor("71,162,253", &result)); | 536 // SkASSERT(FindColor("71,162,253", &result)); |
| 537 // SkASSERT(result == ((0xFF << 24) | (71 << 16) | (162 << 8) | (253 << 0))); | 537 // SkASSERT(result == ((0xFF << 24) | (71 << 16) | (162 << 8) | (253 << 0))); |
| 538 } | 538 } |
| 539 #endif | 539 #endif |
| OLD | NEW |