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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 FloatSize floatCanvasSize(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, &floatCanvasSize, &fillPaintForFilter, &strokePaintForFilter); |
324 | 324 |
325 if (FilterEffect* lastEffect = filterEffectBuilder->lastEffect()) { | 325 FilterEffect* lastEffect = filterEffectBuilder->lastEffect(); |
326 lastEffect->determineMaximumEffectRect(DetermineMaxEffectRectNone); | 326 if (lastEffect) { |
327 m_resolvedFilter = SkiaImageFilterBuilder::build(lastEffect, ColorSp
aceDeviceRGB); | 327 lastEffect->determineFilterPrimitiveSubregion(); |
328 if (m_resolvedFilter) { | 328 } |
329 updateFilterReferences(toHTMLCanvasElement(styleResolutionHost),
context, filterStyle->filter()); | 329 m_resolvedFilter = SkiaImageFilterBuilder::build(lastEffect, ColorSpaceD
eviceRGB); |
330 if (lastEffect->originTainted()) | 330 if (m_resolvedFilter) { |
331 context->setOriginTainted(); | 331 updateFilterReferences(toHTMLCanvasElement(styleResolutionHost), con
text, filterStyle->filter()); |
332 } | 332 if (lastEffect->originTainted()) |
| 333 context->setOriginTainted(); |
333 } | 334 } |
334 } | 335 } |
335 | 336 |
336 return m_resolvedFilter.get(); | 337 return m_resolvedFilter.get(); |
337 } | 338 } |
338 | 339 |
339 bool CanvasRenderingContext2DState::hasFilter(Element* styleResolutionHost, IntS
ize canvasSize, CanvasRenderingContext2D* context) const | 340 bool CanvasRenderingContext2DState::hasFilter(Element* styleResolutionHost, IntS
ize canvasSize, CanvasRenderingContext2D* context) const |
340 { | 341 { |
341 // Checking for a non-null m_filterValue isn't sufficient, since this value | 342 // Checking for a non-null m_filterValue isn't sufficient, since this value |
342 // might refer to a non-existent filter. | 343 // might refer to a non-existent filter. |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 paint->setLooper(0); | 562 paint->setLooper(0); |
562 paint->setImageFilter(shadowAndForegroundImageFilter()); | 563 paint->setImageFilter(shadowAndForegroundImageFilter()); |
563 return paint; | 564 return paint; |
564 } | 565 } |
565 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); | 566 paint->setLooper(sk_ref_sp(shadowAndForegroundDrawLooper())); |
566 paint->setImageFilter(0); | 567 paint->setImageFilter(0); |
567 return paint; | 568 return paint; |
568 } | 569 } |
569 | 570 |
570 } // namespace blink | 571 } // namespace blink |
OLD | NEW |