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

Side by Side Diff: Source/core/paint/FilterPainter.cpp

Issue 678163002: Oilpan: move SVG property hierarchy to the heap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased upto r185213 Created 6 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "config.h" 5 #include "config.h"
6 #include "core/paint/FilterPainter.h" 6 #include "core/paint/FilterPainter.h"
7 7
8 #include "core/paint/LayerPainter.h" 8 #include "core/paint/LayerPainter.h"
9 #include "core/rendering/FilterEffectRenderer.h" 9 #include "core/rendering/FilterEffectRenderer.h"
10 #include "core/rendering/RenderLayer.h" 10 #include "core/rendering/RenderLayer.h"
11 #include "platform/graphics/GraphicsContext.h" 11 #include "platform/graphics/GraphicsContext.h"
12 #include "platform/graphics/filters/FilterEffect.h" 12 #include "platform/graphics/filters/FilterEffect.h"
13 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" 13 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
14 14
15 namespace blink { 15 namespace blink {
16 16
17 FilterPainter::FilterPainter(RenderLayer& renderLayer, GraphicsContext* context, const FloatRect& filterBoxRect, const ClipRect& clipRect, const LayerPaintingIn fo& paintingInfo, PaintLayerFlags paintFlags) 17 FilterPainter::FilterPainter(RenderLayer& renderLayer, GraphicsContext* context, const FloatRect& filterBoxRect, const ClipRect& clipRect, const LayerPaintingIn fo& paintingInfo, PaintLayerFlags paintFlags)
18 : m_filterInProgress(false) 18 : m_filterInProgress(false)
19 , m_context(context) 19 , m_context(context)
20 { 20 {
21 SkiaImageFilterBuilder builder(context); 21 SkiaImageFilterBuilder builder(context);
22 RefPtr<FilterEffect> lastEffect = renderLayer.filterRenderer()->lastEffect() ; 22 RefPtrWillBeRawPtr<FilterEffect> lastEffect = renderLayer.filterRenderer()-> lastEffect();
23 lastEffect->determineFilterPrimitiveSubregion(MapRectForward); 23 lastEffect->determineFilterPrimitiveSubregion(MapRectForward);
24 RefPtr<ImageFilter> imageFilter = builder.build(lastEffect.get(), ColorSpace DeviceRGB); 24 RefPtr<ImageFilter> imageFilter = builder.build(lastEffect.get(), ColorSpace DeviceRGB);
25 if (!imageFilter) 25 if (!imageFilter)
26 return; 26 return;
27 27
28 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius()) { 28 if (clipRect.rect() != paintingInfo.paintDirtyRect || clipRect.hasRadius()) {
29 m_clipRecorder = adoptPtr(new ClipRecorder(&renderLayer, context, Displa yItem::ClipLayerFilter, clipRect)); 29 m_clipRecorder = adoptPtr(new ClipRecorder(&renderLayer, context, Displa yItem::ClipLayerFilter, clipRect));
30 if (clipRect.hasRadius()) 30 if (clipRect.hasRadius())
31 LayerPainter::applyRoundedRectClips(renderLayer, paintingInfo, conte xt, paintFlags, *m_clipRecorder); 31 LayerPainter::applyRoundedRectClips(renderLayer, paintingInfo, conte xt, paintFlags, *m_clipRecorder);
32 } 32 }
33 33
34 context->save(); 34 context->save();
35 FloatRect boundaries = mapImageFilterRect(imageFilter.get(), filterBoxRect); 35 FloatRect boundaries = mapImageFilterRect(imageFilter.get(), filterBoxRect);
36 context->translate(filterBoxRect.x(), filterBoxRect.y()); 36 context->translate(filterBoxRect.x(), filterBoxRect.y());
37 boundaries.move(-filterBoxRect.x(), -filterBoxRect.y()); 37 boundaries.move(-filterBoxRect.x(), -filterBoxRect.y());
38 context->beginLayer(1, CompositeSourceOver, &boundaries, ColorFilterNone, im ageFilter.get()); 38 context->beginLayer(1, CompositeSourceOver, &boundaries, ColorFilterNone, im ageFilter.get());
39 context->translate(-filterBoxRect.x(), -filterBoxRect.y()); 39 context->translate(-filterBoxRect.x(), -filterBoxRect.y());
40 m_filterInProgress = true; 40 m_filterInProgress = true;
41 } 41 }
42 42
43 FilterPainter::~FilterPainter() 43 FilterPainter::~FilterPainter()
44 { 44 {
45 if (m_filterInProgress) { 45 if (m_filterInProgress) {
46 m_context->endLayer(); 46 m_context->endLayer();
47 m_context->restore(); 47 m_context->restore();
48 } 48 }
49 } 49 }
50 50
51 } // namespace blink 51 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/core/rendering/FilterEffectRenderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698