| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 #if ENABLE(ASSERT) | 205 #if ENABLE(ASSERT) |
| 206 void GraphicsContext::setInDrawingRecorder(bool val) | 206 void GraphicsContext::setInDrawingRecorder(bool val) |
| 207 { | 207 { |
| 208 // Nested drawing recorers are not allowed. | 208 // Nested drawing recorers are not allowed. |
| 209 ASSERT(!val || !m_inDrawingRecorder); | 209 ASSERT(!val || !m_inDrawingRecorder); |
| 210 m_inDrawingRecorder = val; | 210 m_inDrawingRecorder = val; |
| 211 } | 211 } |
| 212 #endif | 212 #endif |
| 213 | 213 |
| 214 void GraphicsContext::setStrokePattern(PassRefPtr<Pattern> pattern, float alpha) | |
| 215 { | |
| 216 if (contextDisabled()) | |
| 217 return; | |
| 218 | |
| 219 ASSERT(pattern); | |
| 220 if (!pattern) { | |
| 221 setStrokeColor(Color::black); | |
| 222 return; | |
| 223 } | |
| 224 | |
| 225 mutableState()->setStrokePattern(pattern, alpha); | |
| 226 } | |
| 227 | |
| 228 void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient, float alp
ha) | 214 void GraphicsContext::setStrokeGradient(PassRefPtr<Gradient> gradient, float alp
ha) |
| 229 { | 215 { |
| 230 if (contextDisabled()) | 216 if (contextDisabled()) |
| 231 return; | 217 return; |
| 232 | 218 |
| 233 ASSERT(gradient); | 219 ASSERT(gradient); |
| 234 if (!gradient) { | 220 if (!gradient) { |
| 235 setStrokeColor(Color::black); | 221 setStrokeColor(Color::black); |
| 236 return; | 222 return; |
| 237 } | 223 } |
| 238 mutableState()->setStrokeGradient(gradient, alpha); | 224 mutableState()->setStrokeGradient(gradient, alpha); |
| 239 } | 225 } |
| 240 | 226 |
| 241 void GraphicsContext::setFillPattern(PassRefPtr<Pattern> pattern, float alpha) | |
| 242 { | |
| 243 if (contextDisabled()) | |
| 244 return; | |
| 245 | |
| 246 ASSERT(pattern); | |
| 247 if (!pattern) { | |
| 248 setFillColor(Color::black); | |
| 249 return; | |
| 250 } | |
| 251 | |
| 252 mutableState()->setFillPattern(pattern, alpha); | |
| 253 } | |
| 254 | |
| 255 void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient, float alpha
) | 227 void GraphicsContext::setFillGradient(PassRefPtr<Gradient> gradient, float alpha
) |
| 256 { | 228 { |
| 257 if (contextDisabled()) | 229 if (contextDisabled()) |
| 258 return; | 230 return; |
| 259 | 231 |
| 260 ASSERT(gradient); | 232 ASSERT(gradient); |
| 261 if (!gradient) { | 233 if (!gradient) { |
| 262 setFillColor(Color::black); | 234 setFillColor(Color::black); |
| 263 return; | 235 return; |
| 264 } | 236 } |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1507 static const SkPMColor colors[] = { | 1479 static const SkPMColor colors[] = { |
| 1508 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1480 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
| 1509 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1481 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
| 1510 }; | 1482 }; |
| 1511 | 1483 |
| 1512 return colors[index]; | 1484 return colors[index]; |
| 1513 } | 1485 } |
| 1514 #endif | 1486 #endif |
| 1515 | 1487 |
| 1516 } // namespace blink | 1488 } // namespace blink |
| OLD | NEW |