Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/canvas2d/CanvasRenderingContext2DState.h" | 5 #include "modules/canvas2d/CanvasRenderingContext2DState.h" |
| 6 | 6 |
| 7 #include "core/css/CSSFontSelector.h" | 7 #include "core/css/CSSFontSelector.h" |
| 8 #include "core/css/resolver/FilterOperationResolver.h" | 8 #include "core/css/resolver/FilterOperationResolver.h" |
| 9 #include "core/css/resolver/StyleBuilder.h" | 9 #include "core/css/resolver/StyleBuilder.h" |
| 10 #include "core/css/resolver/StyleResolverState.h" | 10 #include "core/css/resolver/StyleResolverState.h" |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 296 filterStyle->setFont(m_fontForFilter); | 296 filterStyle->setFont(m_fontForFilter); |
| 297 | 297 |
| 298 StyleResolverState resolverState(styleResolutionHost->document(), | 298 StyleResolverState resolverState(styleResolutionHost->document(), |
| 299 styleResolutionHost, filterStyle.get()); | 299 styleResolutionHost, filterStyle.get()); |
| 300 resolverState.setStyle(filterStyle); | 300 resolverState.setStyle(filterStyle); |
| 301 | 301 |
| 302 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, | 302 StyleBuilder::applyProperty(CSSPropertyFilter, resolverState, |
| 303 *m_filterValue); | 303 *m_filterValue); |
| 304 resolverState.loadPendingResources(); | 304 resolverState.loadPendingResources(); |
| 305 | 305 |
| 306 // We can't reuse m_fillPaint and m_strokePaint for the filter, since these incorporate | 306 // We can't reuse m_fillPaint and m_strokePaint for the filter, since these |
| 307 // the global alpha, which isn't applicable here. | 307 // incorporate the global alpha, which isn't applicable here. |
| 308 SkPaint fillPaintForFilter; | 308 SkPaint fillPaintForFilter; |
| 309 m_fillStyle->applyToPaint(fillPaintForFilter); | 309 m_fillStyle->applyToPaint(fillPaintForFilter); |
| 310 fillPaintForFilter.setColor(m_fillStyle->paintColor()); | 310 fillPaintForFilter.setColor(m_fillStyle->paintColor()); |
| 311 SkPaint strokePaintForFilter; | 311 SkPaint strokePaintForFilter; |
| 312 m_strokeStyle->applyToPaint(strokePaintForFilter); | 312 m_strokeStyle->applyToPaint(strokePaintForFilter); |
| 313 strokePaintForFilter.setColor(m_strokeStyle->paintColor()); | 313 strokePaintForFilter.setColor(m_strokeStyle->paintColor()); |
| 314 | 314 |
| 315 FilterEffectBuilder filterEffectBuilder( | 315 FilterEffectBuilder filterEffectBuilder( |
| 316 styleResolutionHost, FloatRect((FloatPoint()), FloatSize(canvasSize)), | 316 styleResolutionHost, FloatRect((FloatPoint()), FloatSize(canvasSize)), |
| 317 1.0f, // Deliberately ignore zoom on the canvas element. | 317 1.0f, // Deliberately ignore zoom on the canvas element. |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 513 ImageType imageType) const { | 513 ImageType imageType) const { |
| 514 SkPaint* paint; | 514 SkPaint* paint; |
| 515 switch (paintType) { | 515 switch (paintType) { |
| 516 case StrokePaintType: | 516 case StrokePaintType: |
| 517 updateLineDash(); | 517 updateLineDash(); |
| 518 updateStrokeStyle(); | 518 updateStrokeStyle(); |
| 519 paint = &m_strokePaint; | 519 paint = &m_strokePaint; |
| 520 break; | 520 break; |
| 521 default: | 521 default: |
| 522 ASSERT_NOT_REACHED(); | 522 ASSERT_NOT_REACHED(); |
| 523 // no break on purpose: paint needs to be assigned to avoid compiler warning about uninitialized variable | 523 // no break on purpose: paint needs to be assigned to avoid compiler warning |
| 524 // about uninitialized variable | |
|
Justin Novosad
2016/10/03 18:13:11
period
| |
| 524 case FillPaintType: | 525 case FillPaintType: |
| 525 updateFillStyle(); | 526 updateFillStyle(); |
| 526 paint = &m_fillPaint; | 527 paint = &m_fillPaint; |
| 527 break; | 528 break; |
| 528 case ImagePaintType: | 529 case ImagePaintType: |
| 529 paint = &m_imagePaint; | 530 paint = &m_imagePaint; |
| 530 break; | 531 break; |
| 531 } | 532 } |
| 532 | 533 |
| 533 if ((!shouldDrawShadows() && shadowMode == DrawShadowAndForeground) || | 534 if ((!shouldDrawShadows() && shadowMode == DrawShadowAndForeground) || |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 559 paint->setLooper(0); | 560 paint->setLooper(0); |
| 560 paint->setImageFilter(shadowAndForegroundImageFilter()); | 561 paint->setImageFilter(shadowAndForegroundImageFilter()); |
| 561 return paint; | 562 return paint; |
| 562 } | 563 } |
| 563 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 564 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
| 564 paint->setImageFilter(0); | 565 paint->setImageFilter(0); |
| 565 return paint; | 566 return paint; |
| 566 } | 567 } |
| 567 | 568 |
| 568 } // namespace blink | 569 } // namespace blink |
| OLD | NEW |