Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DState.cpp

Issue 2343173002: Let clients of FilterEffectBuilder compute/provide the reference-box (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698