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/platform/graphics/filters/FilterEffect.cpp

Issue 1097053004: Drop some dead code from FilterEffect (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com> 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 3 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
4 * Copyright (C) Research In Motion Limited 2010. All rights reserved. 4 * Copyright (C) Research In Motion Limited 2010. All rights reserved.
5 * Copyright (C) 2012 University of Szeged 5 * Copyright (C) 2012 University of Szeged
6 * Copyright (C) 2013 Google Inc. All rights reserved. 6 * Copyright (C) 2013 Google Inc. All rights reserved.
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 12 matching lines...) Expand all
23 23
24 #include "config.h" 24 #include "config.h"
25 25
26 #include "platform/graphics/filters/FilterEffect.h" 26 #include "platform/graphics/filters/FilterEffect.h"
27 27
28 #include "platform/graphics/filters/Filter.h" 28 #include "platform/graphics/filters/Filter.h"
29 29
30 namespace blink { 30 namespace blink {
31 31
32 FilterEffect::FilterEffect(Filter* filter) 32 FilterEffect::FilterEffect(Filter* filter)
33 : m_alphaImage(false) 33 : m_filter(filter)
34 , m_filter(filter)
35 , m_hasX(false) 34 , m_hasX(false)
36 , m_hasY(false) 35 , m_hasY(false)
37 , m_hasWidth(false) 36 , m_hasWidth(false)
38 , m_hasHeight(false) 37 , m_hasHeight(false)
39 , m_clipsToBounds(true) 38 , m_clipsToBounds(true)
40 , m_operatingColorSpace(ColorSpaceLinearRGB) 39 , m_operatingColorSpace(ColorSpaceLinearRGB)
41 , m_resultColorSpace(ColorSpaceDeviceRGB)
42 { 40 {
43 ASSERT(m_filter); 41 ASSERT(m_filter);
44 } 42 }
45 43
46 FilterEffect::~FilterEffect() 44 FilterEffect::~FilterEffect()
47 { 45 {
48 } 46 }
49 47
50 DEFINE_TRACE(FilterEffect) 48 DEFINE_TRACE(FilterEffect)
51 { 49 {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 FloatRect result; 87 FloatRect result;
90 if (m_inputEffects.size() > 0) { 88 if (m_inputEffects.size() > 0) {
91 result = m_inputEffects.at(0)->mapRectRecursive(rect); 89 result = m_inputEffects.at(0)->mapRectRecursive(rect);
92 for (unsigned i = 1; i < m_inputEffects.size(); ++i) 90 for (unsigned i = 1; i < m_inputEffects.size(); ++i)
93 result.unite(m_inputEffects.at(i)->mapRectRecursive(rect)); 91 result.unite(m_inputEffects.at(i)->mapRectRecursive(rect));
94 } else 92 } else
95 result = rect; 93 result = rect;
96 return mapRect(result); 94 return mapRect(result);
97 } 95 }
98 96
99 FloatRect FilterEffect::getSourceRect(const FloatRect& destRect, const FloatRect & destClipRect)
100 {
101 FloatRect sourceRect = mapRect(destRect, false);
102 FloatRect sourceClipRect = mapRect(destClipRect, false);
103
104 FloatRect boundaries = filter()->mapLocalRectToAbsoluteRect(effectBoundaries ());
105 if (hasX())
106 sourceClipRect.setX(boundaries.x());
107 if (hasY())
108 sourceClipRect.setY(boundaries.y());
109 if (hasWidth())
110 sourceClipRect.setWidth(boundaries.width());
111 if (hasHeight())
112 sourceClipRect.setHeight(boundaries.height());
113
114 FloatRect result;
115 if (m_inputEffects.size() > 0) {
116 result = m_inputEffects.at(0)->getSourceRect(sourceRect, sourceClipRect) ;
117 for (unsigned i = 1; i < m_inputEffects.size(); ++i)
118 result.unite(m_inputEffects.at(i)->getSourceRect(sourceRect, sourceC lipRect));
119 } else {
120 result = sourceRect;
121 result.intersect(sourceClipRect);
122 }
123 return result;
124 }
125
126 FilterEffect* FilterEffect::inputEffect(unsigned number) const 97 FilterEffect* FilterEffect::inputEffect(unsigned number) const
127 { 98 {
128 ASSERT_WITH_SECURITY_IMPLICATION(number < m_inputEffects.size()); 99 ASSERT_WITH_SECURITY_IMPLICATION(number < m_inputEffects.size());
129 return m_inputEffects.at(number).get(); 100 return m_inputEffects.at(number).get();
130 } 101 }
131 102
132 void FilterEffect::addAbsolutePaintRect(const FloatRect& paintRect) 103 void FilterEffect::addAbsolutePaintRect(const FloatRect& paintRect)
133 { 104 {
134 IntRect intPaintRect(enclosingIntRect(paintRect)); 105 IntRect intPaintRect(enclosingIntRect(paintRect));
135 if (m_absolutePaintRect.contains(intPaintRect)) 106 if (m_absolutePaintRect.contains(intPaintRect))
136 return; 107 return;
137 intPaintRect.unite(m_absolutePaintRect); 108 intPaintRect.unite(m_absolutePaintRect);
138 // Make sure we are not holding on to a smaller rendering. 109 // Make sure we are not holding on to a smaller rendering.
139 clearResult(); 110 clearResult();
140 m_absolutePaintRect = intPaintRect; 111 m_absolutePaintRect = intPaintRect;
141 } 112 }
142 113
143 void FilterEffect::clearResult() 114 void FilterEffect::clearResult()
144 { 115 {
145 m_absolutePaintRect = IntRect(); 116 m_absolutePaintRect = IntRect();
146 for (int i = 0; i < 4; i++) { 117 for (int i = 0; i < 4; i++) {
147 m_imageFilters[i] = nullptr; 118 m_imageFilters[i] = nullptr;
148 } 119 }
149 } 120 }
150 121
151 void FilterEffect::clearResultsRecursive()
152 {
153 unsigned size = m_inputEffects.size();
154 for (unsigned i = 0; i < size; ++i)
155 m_inputEffects.at(i).get()->clearResultsRecursive();
156 }
157
158 Color FilterEffect::adaptColorToOperatingColorSpace(const Color& deviceColor) 122 Color FilterEffect::adaptColorToOperatingColorSpace(const Color& deviceColor)
159 { 123 {
160 // |deviceColor| is assumed to be DeviceRGB. 124 // |deviceColor| is assumed to be DeviceRGB.
161 return ColorSpaceUtilities::convertColor(deviceColor, operatingColorSpace()) ; 125 return ColorSpaceUtilities::convertColor(deviceColor, operatingColorSpace()) ;
162 } 126 }
163 127
164 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const 128 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const
165 { 129 {
166 // FIXME: We should dump the subRegions of the filter primitives here later. This isn't 130 // FIXME: We should dump the subRegions of the filter primitives here later. This isn't
167 // possible at the moment, because we need more detailed informations from t he target object. 131 // possible at the moment, because we need more detailed informations from t he target object.
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 return m_imageFilters[index].get(); 234 return m_imageFilters[index].get();
271 } 235 }
272 236
273 void FilterEffect::setImageFilter(ColorSpace colorSpace, bool requiresPMColorVal idation, PassRefPtr<SkImageFilter> imageFilter) 237 void FilterEffect::setImageFilter(ColorSpace colorSpace, bool requiresPMColorVal idation, PassRefPtr<SkImageFilter> imageFilter)
274 { 238 {
275 int index = getImageFilterIndex(colorSpace, requiresPMColorValidation); 239 int index = getImageFilterIndex(colorSpace, requiresPMColorValidation);
276 m_imageFilters[index] = imageFilter; 240 m_imageFilters[index] = imageFilter;
277 } 241 }
278 242
279 } // namespace blink 243 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698