| 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 return; | 202 return; |
| 203 | 203 |
| 204 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); | 204 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); |
| 205 if (!color.alpha()) { | 205 if (!color.alpha()) { |
| 206 // When shadow-only but there is no shadow, we use an empty draw looper | 206 // When shadow-only but there is no shadow, we use an empty draw looper |
| 207 // to disable rendering of the source primitive. When not shadow-only,
we | 207 // to disable rendering of the source primitive. When not shadow-only,
we |
| 208 // clear the looper. | 208 // clear the looper. |
| 209 if (shadowMode != DrawShadowOnly) | 209 if (shadowMode != DrawShadowOnly) |
| 210 drawLooperBuilder.clear(); | 210 drawLooperBuilder.clear(); |
| 211 | 211 |
| 212 setDrawLooper(drawLooperBuilder.release()); | 212 setDrawLooper(std::move(drawLooperBuilder)); |
| 213 return; | 213 return; |
| 214 } | 214 } |
| 215 | 215 |
| 216 drawLooperBuilder->addShadow(offset, blur, color, shadowTransformMode, shado
wAlphaMode); | 216 drawLooperBuilder->addShadow(offset, blur, color, shadowTransformMode, shado
wAlphaMode); |
| 217 if (shadowMode == DrawShadowAndForeground) { | 217 if (shadowMode == DrawShadowAndForeground) { |
| 218 drawLooperBuilder->addUnmodifiedContent(); | 218 drawLooperBuilder->addUnmodifiedContent(); |
| 219 } | 219 } |
| 220 setDrawLooper(drawLooperBuilder.release()); | 220 setDrawLooper(std::move(drawLooperBuilder)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void GraphicsContext::setDrawLooper(PassOwnPtr<DrawLooperBuilder> drawLooperBuil
der) | 223 void GraphicsContext::setDrawLooper(PassOwnPtr<DrawLooperBuilder> drawLooperBuil
der) |
| 224 { | 224 { |
| 225 if (contextDisabled()) | 225 if (contextDisabled()) |
| 226 return; | 226 return; |
| 227 | 227 |
| 228 mutableState()->setDrawLooper(drawLooperBuilder ? drawLooperBuilder->detachD
rawLooper() : nullptr); | 228 mutableState()->setDrawLooper(drawLooperBuilder ? drawLooperBuilder->detachD
rawLooper() : nullptr); |
| 229 } | 229 } |
| 230 | 230 |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 roundedHole.expandRadii(-shadowSpread); | 473 roundedHole.expandRadii(-shadowSpread); |
| 474 else | 474 else |
| 475 roundedHole.shrinkRadii(shadowSpread); | 475 roundedHole.shrinkRadii(shadowSpread); |
| 476 } else { | 476 } else { |
| 477 clip(rect.rect()); | 477 clip(rect.rect()); |
| 478 } | 478 } |
| 479 | 479 |
| 480 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); | 480 OwnPtr<DrawLooperBuilder> drawLooperBuilder = DrawLooperBuilder::create(); |
| 481 drawLooperBuilder->addShadow(FloatSize(shadowOffset), shadowBlur, shadowColo
r, | 481 drawLooperBuilder->addShadow(FloatSize(shadowOffset), shadowBlur, shadowColo
r, |
| 482 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIg
noresAlpha); | 482 DrawLooperBuilder::ShadowRespectsTransforms, DrawLooperBuilder::ShadowIg
noresAlpha); |
| 483 setDrawLooper(drawLooperBuilder.release()); | 483 setDrawLooper(std::move(drawLooperBuilder)); |
| 484 fillRectWithRoundedHole(outerRect, roundedHole, fillColor); | 484 fillRectWithRoundedHole(outerRect, roundedHole, fillColor); |
| 485 } | 485 } |
| 486 | 486 |
| 487 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) | 487 void GraphicsContext::drawLine(const IntPoint& point1, const IntPoint& point2) |
| 488 { | 488 { |
| 489 if (contextDisabled()) | 489 if (contextDisabled()) |
| 490 return; | 490 return; |
| 491 ASSERT(m_canvas); | 491 ASSERT(m_canvas); |
| 492 | 492 |
| 493 StrokeStyle penStyle = getStrokeStyle(); | 493 StrokeStyle penStyle = getStrokeStyle(); |
| (...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 static const SkPMColor colors[] = { | 1354 static const SkPMColor colors[] = { |
| 1355 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1355 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
| 1356 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1356 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
| 1357 }; | 1357 }; |
| 1358 | 1358 |
| 1359 return colors[index]; | 1359 return colors[index]; |
| 1360 } | 1360 } |
| 1361 #endif | 1361 #endif |
| 1362 | 1362 |
| 1363 } // namespace blink | 1363 } // namespace blink |
| OLD | NEW |