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

Side by Side Diff: third_party/WebKit/Source/platform/graphics/filters/FilterEffect.cpp

Issue 2307343002: Remove dead uses of FilterEffect::determineMaximumEffectRect (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 /* 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
11 * version 2 of the License, or (at your option) any later version. 11 * version 2 of the License, or (at your option) any later version.
12 * 12 *
13 * This library is distributed in the hope that it will be useful, 13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details. 16 * Library General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU Library General Public License 18 * You should have received a copy of the GNU Library General Public License
19 * along with this library; see the file COPYING.LIB. If not, write to 19 * along with this library; see the file COPYING.LIB. If not, write to
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301, USA. 21 * Boston, MA 02110-1301, USA.
22 */ 22 */
23 23
24 #include "platform/graphics/filters/FilterEffect.h" 24 #include "platform/graphics/filters/FilterEffect.h"
25 25
26 #include "platform/graphics/filters/Filter.h" 26 #include "platform/graphics/filters/Filter.h"
27 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
28 #include "third_party/skia/include/core/SkColorFilter.h" 27 #include "third_party/skia/include/core/SkColorFilter.h"
29 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h" 28 #include "third_party/skia/include/effects/SkColorFilterImageFilter.h"
30 #include "third_party/skia/include/effects/SkPictureImageFilter.h"
31 29
32 namespace blink { 30 namespace blink {
33 31
34 FilterEffect::FilterEffect(Filter* filter) 32 FilterEffect::FilterEffect(Filter* filter)
35 : m_filter(filter) 33 : m_filter(filter)
36 , m_clipsToBounds(true) 34 , m_clipsToBounds(true)
37 , m_originTainted(false) 35 , m_originTainted(false)
38 , m_operatingColorSpace(ColorSpaceLinearRGB) 36 , m_operatingColorSpace(ColorSpaceLinearRGB)
39 { 37 {
40 ASSERT(m_filter); 38 ASSERT(m_filter);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 return ColorSpaceUtilities::convertColor(deviceColor, operatingColorSpace()) ; 120 return ColorSpaceUtilities::convertColor(deviceColor, operatingColorSpace()) ;
123 } 121 }
124 122
125 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const 123 TextStream& FilterEffect::externalRepresentation(TextStream& ts, int) const
126 { 124 {
127 // FIXME: We should dump the subRegions of the filter primitives here later. This isn't 125 // FIXME: We should dump the subRegions of the filter primitives here later. This isn't
128 // possible at the moment, because we need more detailed informations from t he target object. 126 // possible at the moment, because we need more detailed informations from t he target object.
129 return ts; 127 return ts;
130 } 128 }
131 129
132 FloatRect FilterEffect::determineMaximumEffectRect(DetermineMaxEffectRectFlags f lags) 130 FloatRect FilterEffect::determineMaximumEffectRect()
133 { 131 {
134 DCHECK(getFilter()); 132 DCHECK(getFilter());
135 Filter* filter = getFilter(); 133 Filter* filter = getFilter();
136 134
137 // Compute the union of the inputs. Always do this because it has 135 // Compute the union of the inputs. Always do this because it has
138 // side-effects. (It computes the maximum effect rect of the input.) 136 // side-effects. (It computes the maximum effect rect of the input.)
139 FloatRect absoluteInputUnion; 137 FloatRect absoluteInputUnion;
140 for (auto& effect : m_inputEffects) 138 for (auto& effect : m_inputEffects)
141 absoluteInputUnion.unite(effect->determineMaximumEffectRect(flags)); 139 absoluteInputUnion.unite(effect->determineMaximumEffectRect());
142 140
143 FloatRect absoluteSubregion; 141 FloatRect absoluteSubregion;
144 switch (getFilterEffectType()) { 142 switch (getFilterEffectType()) {
145 default: 143 default:
146 if (m_inputEffects.size()) { 144 if (m_inputEffects.size()) {
147 absoluteSubregion = absoluteInputUnion; 145 absoluteSubregion = absoluteInputUnion;
148 if (clipsToBounds()) 146 if (clipsToBounds())
149 absoluteSubregion.intersect(filter->mapLocalRectToAbsoluteRect(f ilterPrimitiveSubregion())); 147 absoluteSubregion.intersect(filter->mapLocalRectToAbsoluteRect(f ilterPrimitiveSubregion()));
150 break; 148 break;
151 } 149 }
152 // Else fall-through and use the primitive region. (FETurbulence/FEFlood /FEImage) 150 // Else fall-through and use the primitive region. (FETurbulence/FEFlood /FEImage)
153 case FilterEffectTypeTile: 151 case FilterEffectTypeTile:
154 absoluteSubregion = filter->mapLocalRectToAbsoluteRect(filterPrimitiveSu bregion()); 152 absoluteSubregion = filter->mapLocalRectToAbsoluteRect(filterPrimitiveSu bregion());
155 break; 153 break;
156 case FilterEffectTypeSourceInput: 154 case FilterEffectTypeSourceInput:
157 absoluteSubregion = filter->absoluteFilterRegion(); 155 absoluteSubregion = filter->absoluteFilterRegion();
158 break; 156 break;
159 } 157 }
160 158
161 if (flags & MapRectForward)
162 absoluteSubregion = mapRect(absoluteSubregion);
163
164 // Clip every filter effect to the filter region. 159 // Clip every filter effect to the filter region.
165 if (flags & ClipToFilterRegion) 160 absoluteSubregion.intersect(filter->absoluteFilterRegion());
166 absoluteSubregion.intersect(filter->absoluteFilterRegion());
167 161
168 m_maxEffectRect = absoluteSubregion; 162 m_maxEffectRect = absoluteSubregion;
169 return absoluteSubregion; 163 return absoluteSubregion;
170 } 164 }
171 165
172 sk_sp<SkImageFilter> FilterEffect::createImageFilter() 166 sk_sp<SkImageFilter> FilterEffect::createImageFilter()
173 { 167 {
174 return nullptr; 168 return nullptr;
175 } 169 }
176 170
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 return m_imageFilters[index].get(); 215 return m_imageFilters[index].get();
222 } 216 }
223 217
224 void FilterEffect::setImageFilter(ColorSpace colorSpace, bool requiresPMColorVal idation, sk_sp<SkImageFilter> imageFilter) 218 void FilterEffect::setImageFilter(ColorSpace colorSpace, bool requiresPMColorVal idation, sk_sp<SkImageFilter> imageFilter)
225 { 219 {
226 int index = getImageFilterIndex(colorSpace, requiresPMColorValidation); 220 int index = getImageFilterIndex(colorSpace, requiresPMColorValidation);
227 m_imageFilters[index] = std::move(imageFilter); 221 m_imageFilters[index] = std::move(imageFilter);
228 } 222 }
229 223
230 } // namespace blink 224 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698