OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies) |
4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> | 4 * Copyright (C) 2007 Alp Toker <alp@atoker.com> |
5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> | 5 * Copyright (C) 2008 Eric Seidel <eric@webkit.org> |
6 * | 6 * |
7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
9 * are met: | 9 * are met: |
10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 { | 127 { |
128 RGBA32 rgba; | 128 RGBA32 rgba; |
129 ColorParseResult parseResult = parseColor(rgba, color, document); | 129 ColorParseResult parseResult = parseColor(rgba, color, document); |
130 switch (parseResult) { | 130 switch (parseResult) { |
131 case ParsedRGBA: | 131 case ParsedRGBA: |
132 case ParsedSystemColor: | 132 case ParsedSystemColor: |
133 return adoptRef(new CanvasStyle(rgba)); | 133 return adoptRef(new CanvasStyle(rgba)); |
134 case ParsedCurrentColor: | 134 case ParsedCurrentColor: |
135 return adoptRef(new CanvasStyle(CurrentColor)); | 135 return adoptRef(new CanvasStyle(CurrentColor)); |
136 case ParseFailed: | 136 case ParseFailed: |
137 return 0; | 137 return nullptr; |
138 default: | 138 default: |
139 ASSERT_NOT_REACHED(); | 139 ASSERT_NOT_REACHED(); |
140 return 0; | 140 return nullptr; |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 PassRefPtr<CanvasStyle> CanvasStyle::createFromStringWithOverrideAlpha(const Str
ing& color, float alpha) | 144 PassRefPtr<CanvasStyle> CanvasStyle::createFromStringWithOverrideAlpha(const Str
ing& color, float alpha) |
145 { | 145 { |
146 RGBA32 rgba; | 146 RGBA32 rgba; |
147 ColorParseResult parseResult = parseColor(rgba, color); | 147 ColorParseResult parseResult = parseColor(rgba, color); |
148 switch (parseResult) { | 148 switch (parseResult) { |
149 case ParsedRGBA: | 149 case ParsedRGBA: |
150 return adoptRef(new CanvasStyle(colorWithOverrideAlpha(rgba, alpha))); | 150 return adoptRef(new CanvasStyle(colorWithOverrideAlpha(rgba, alpha))); |
151 case ParsedCurrentColor: | 151 case ParsedCurrentColor: |
152 return adoptRef(new CanvasStyle(CurrentColorWithOverrideAlpha, alpha)); | 152 return adoptRef(new CanvasStyle(CurrentColorWithOverrideAlpha, alpha)); |
153 case ParseFailed: | 153 case ParseFailed: |
154 return 0; | 154 return nullptr; |
155 default: | 155 default: |
156 ASSERT_NOT_REACHED(); | 156 ASSERT_NOT_REACHED(); |
157 return 0; | 157 return nullptr; |
158 } | 158 } |
159 } | 159 } |
160 | 160 |
161 PassRefPtr<CanvasStyle> CanvasStyle::createFromGradient(PassRefPtr<CanvasGradien
t> gradient) | 161 PassRefPtr<CanvasStyle> CanvasStyle::createFromGradient(PassRefPtr<CanvasGradien
t> gradient) |
162 { | 162 { |
163 if (!gradient) | 163 if (!gradient) |
164 return 0; | 164 return nullptr; |
165 return adoptRef(new CanvasStyle(gradient)); | 165 return adoptRef(new CanvasStyle(gradient)); |
166 } | 166 } |
| 167 |
167 PassRefPtr<CanvasStyle> CanvasStyle::createFromPattern(PassRefPtr<CanvasPattern>
pattern) | 168 PassRefPtr<CanvasStyle> CanvasStyle::createFromPattern(PassRefPtr<CanvasPattern>
pattern) |
168 { | 169 { |
169 if (!pattern) | 170 if (!pattern) |
170 return 0; | 171 return nullptr; |
171 return adoptRef(new CanvasStyle(pattern)); | 172 return adoptRef(new CanvasStyle(pattern)); |
172 } | 173 } |
173 | 174 |
174 bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const | 175 bool CanvasStyle::isEquivalentColor(const CanvasStyle& other) const |
175 { | 176 { |
176 if (m_type != other.m_type) | 177 if (m_type != other.m_type) |
177 return false; | 178 return false; |
178 | 179 |
179 switch (m_type) { | 180 switch (m_type) { |
180 case RGBA: | 181 case RGBA: |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 context->setFillPattern(canvasPattern()->pattern()); | 265 context->setFillPattern(canvasPattern()->pattern()); |
265 break; | 266 break; |
266 case CurrentColor: | 267 case CurrentColor: |
267 case CurrentColorWithOverrideAlpha: | 268 case CurrentColorWithOverrideAlpha: |
268 ASSERT_NOT_REACHED(); | 269 ASSERT_NOT_REACHED(); |
269 break; | 270 break; |
270 } | 271 } |
271 } | 272 } |
272 | 273 |
273 } | 274 } |
OLD | NEW |