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

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

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

Powered by Google App Engine
This is Rietveld 408576698