OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2012 Rik Cabanier (cabanier@adobe.com) | 3 * Copyright (C) 2012 Rik Cabanier (cabanier@adobe.com) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 "difference", | 61 "difference", |
62 "exclusion", | 62 "exclusion", |
63 "hue", | 63 "hue", |
64 "saturation", | 64 "saturation", |
65 "color", | 65 "color", |
66 "luminosity" | 66 "luminosity" |
67 }; | 67 }; |
68 const int numCompositeOperatorNames = WTF_ARRAY_LENGTH(compositeOperatorNames); | 68 const int numCompositeOperatorNames = WTF_ARRAY_LENGTH(compositeOperatorNames); |
69 const int numBlendOperatorNames = WTF_ARRAY_LENGTH(blendOperatorNames); | 69 const int numBlendOperatorNames = WTF_ARRAY_LENGTH(blendOperatorNames); |
70 | 70 |
71 bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, blin
k::WebBlendMode& blendOp) | 71 bool parseCompositeAndBlendOperator(const String& s, CompositeOperator& op, WebB
lendMode& blendOp) |
72 { | 72 { |
73 for (int i = 0; i < numCompositeOperatorNames; i++) { | 73 for (int i = 0; i < numCompositeOperatorNames; i++) { |
74 if (s == compositeOperatorNames[i]) { | 74 if (s == compositeOperatorNames[i]) { |
75 op = static_cast<CompositeOperator>(i); | 75 op = static_cast<CompositeOperator>(i); |
76 blendOp = blink::WebBlendModeNormal; | 76 blendOp = WebBlendModeNormal; |
77 return true; | 77 return true; |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 for (int i = 0; i < numBlendOperatorNames; i++) { | 81 for (int i = 0; i < numBlendOperatorNames; i++) { |
82 if (s == blendOperatorNames[i]) { | 82 if (s == blendOperatorNames[i]) { |
83 blendOp = static_cast<blink::WebBlendMode>(i+1); | 83 blendOp = static_cast<WebBlendMode>(i+1); |
84 // For now, blending will always assume source-over. This will be fi
xed in the future | 84 // For now, blending will always assume source-over. This will be fi
xed in the future |
85 op = CompositeSourceOver; | 85 op = CompositeSourceOver; |
86 return true; | 86 return true; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 return false; | 90 return false; |
91 } | 91 } |
92 | 92 |
93 // FIXME: when we support blend modes in combination with compositing other than
source-over | 93 // FIXME: when we support blend modes in combination with compositing other than
source-over |
94 // this routine needs to be updated. | 94 // this routine needs to be updated. |
95 String compositeOperatorName(CompositeOperator op, blink::WebBlendMode blendOp) | 95 String compositeOperatorName(CompositeOperator op, WebBlendMode blendOp) |
96 { | 96 { |
97 ASSERT(op >= 0); | 97 ASSERT(op >= 0); |
98 ASSERT(op < numCompositeOperatorNames); | 98 ASSERT(op < numCompositeOperatorNames); |
99 ASSERT(blendOp >= 0); | 99 ASSERT(blendOp >= 0); |
100 ASSERT(blendOp <= numBlendOperatorNames); | 100 ASSERT(blendOp <= numBlendOperatorNames); |
101 if (blendOp != blink::WebBlendModeNormal) | 101 if (blendOp != WebBlendModeNormal) |
102 return blendOperatorNames[blendOp-1]; | 102 return blendOperatorNames[blendOp-1]; |
103 return compositeOperatorNames[op]; | 103 return compositeOperatorNames[op]; |
104 } | 104 } |
105 | 105 |
106 bool parseLineCap(const String& s, LineCap& cap) | 106 bool parseLineCap(const String& s, LineCap& cap) |
107 { | 107 { |
108 if (s == "butt") { | 108 if (s == "butt") { |
109 cap = ButtCap; | 109 cap = ButtCap; |
110 return true; | 110 return true; |
111 } | 111 } |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 baseline = IdeographicTextBaseline; | 216 baseline = IdeographicTextBaseline; |
217 return true; | 217 return true; |
218 } | 218 } |
219 if (s == "hanging") { | 219 if (s == "hanging") { |
220 baseline = HangingTextBaseline; | 220 baseline = HangingTextBaseline; |
221 return true; | 221 return true; |
222 } | 222 } |
223 return false; | 223 return false; |
224 } | 224 } |
225 | 225 |
226 } | 226 } // namespace blink |
OLD | NEW |