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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 FilterEffectBuilder* filterEffectBuilder = FilterEffectBuilder::create()
; | 311 FilterEffectBuilder* filterEffectBuilder = FilterEffectBuilder::create()
; |
312 | 312 |
313 // We can't reuse m_fillPaint and m_strokePaint for the filter, since th
ese incorporate | 313 // We can't reuse m_fillPaint and m_strokePaint for the filter, since th
ese incorporate |
314 // the global alpha, which isn't applicable here. | 314 // the global alpha, which isn't applicable here. |
315 SkPaint fillPaintForFilter; | 315 SkPaint fillPaintForFilter; |
316 SkPaint strokePaintForFilter; | 316 SkPaint strokePaintForFilter; |
317 m_fillStyle->applyToPaint(fillPaintForFilter); | 317 m_fillStyle->applyToPaint(fillPaintForFilter); |
318 m_strokeStyle->applyToPaint(strokePaintForFilter); | 318 m_strokeStyle->applyToPaint(strokePaintForFilter); |
319 fillPaintForFilter.setColor(m_fillStyle->paintColor()); | 319 fillPaintForFilter.setColor(m_fillStyle->paintColor()); |
320 strokePaintForFilter.setColor(m_strokeStyle->paintColor()); | 320 strokePaintForFilter.setColor(m_strokeStyle->paintColor()); |
321 FloatSize floatCanvasSize(canvasSize); | 321 FloatRect referenceBox((FloatPoint()), FloatSize(canvasSize)); |
322 const double effectiveZoom = 1.0; // Deliberately ignore zoom on the can
vas element | 322 const double effectiveZoom = 1.0; // Deliberately ignore zoom on the can
vas element |
323 filterEffectBuilder->build(styleResolutionHost, filterStyle->filter(), e
ffectiveZoom, &floatCanvasSize, &fillPaintForFilter, &strokePaintForFilter); | 323 filterEffectBuilder->build(styleResolutionHost, filterStyle->filter(), e
ffectiveZoom, referenceBox, &fillPaintForFilter, &strokePaintForFilter); |
324 | 324 |
325 if (FilterEffect* lastEffect = filterEffectBuilder->lastEffect()) { | 325 if (FilterEffect* lastEffect = filterEffectBuilder->lastEffect()) { |
326 m_resolvedFilter = SkiaImageFilterBuilder::build(lastEffect, ColorSp
aceDeviceRGB); | 326 m_resolvedFilter = SkiaImageFilterBuilder::build(lastEffect, ColorSp
aceDeviceRGB); |
327 if (m_resolvedFilter) { | 327 if (m_resolvedFilter) { |
328 updateFilterReferences(toHTMLCanvasElement(styleResolutionHost),
context, filterStyle->filter()); | 328 updateFilterReferences(toHTMLCanvasElement(styleResolutionHost),
context, filterStyle->filter()); |
329 if (lastEffect->originTainted()) | 329 if (lastEffect->originTainted()) |
330 context->setOriginTainted(); | 330 context->setOriginTainted(); |
331 } | 331 } |
332 } | 332 } |
333 } | 333 } |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
560 paint->setLooper(0); | 560 paint->setLooper(0); |
561 paint->setImageFilter(shadowAndForegroundImageFilter()); | 561 paint->setImageFilter(shadowAndForegroundImageFilter()); |
562 return paint; | 562 return paint; |
563 } | 563 } |
564 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 564 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
565 paint->setImageFilter(0); | 565 paint->setImageFilter(0); |
566 return paint; | 566 return paint; |
567 } | 567 } |
568 | 568 |
569 } // namespace blink | 569 } // namespace blink |
OLD | NEW |