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

Side by Side Diff: Source/platform/graphics/filters/FEConvolveMatrix.cpp

Issue 1354923003: Remove kernelUnitLength plumbing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: More TEs Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 2 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 3 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 4 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org> 5 * Copyright (C) 2009 Dirk Schulze <krit@webkit.org>
6 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org> 6 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org>
7 * Copyright (C) 2013 Google Inc. All rights reserved. 7 * Copyright (C) 2013 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 16 matching lines...) Expand all
27 27
28 #include "SkMatrixConvolutionImageFilter.h" 28 #include "SkMatrixConvolutionImageFilter.h"
29 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" 29 #include "platform/graphics/filters/SkiaImageFilterBuilder.h"
30 #include "platform/text/TextStream.h" 30 #include "platform/text/TextStream.h"
31 #include "wtf/OwnPtr.h" 31 #include "wtf/OwnPtr.h"
32 32
33 namespace blink { 33 namespace blink {
34 34
35 FEConvolveMatrix::FEConvolveMatrix(Filter* filter, const IntSize& kernelSize, 35 FEConvolveMatrix::FEConvolveMatrix(Filter* filter, const IntSize& kernelSize,
36 float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMo de, 36 float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMo de,
37 const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix) 37 bool preserveAlpha, const Vector<float>& kernelMatrix)
38 : FilterEffect(filter) 38 : FilterEffect(filter)
39 , m_kernelSize(kernelSize) 39 , m_kernelSize(kernelSize)
40 , m_divisor(divisor) 40 , m_divisor(divisor)
41 , m_bias(bias) 41 , m_bias(bias)
42 , m_targetOffset(targetOffset) 42 , m_targetOffset(targetOffset)
43 , m_edgeMode(edgeMode) 43 , m_edgeMode(edgeMode)
44 , m_kernelUnitLength(kernelUnitLength)
45 , m_preserveAlpha(preserveAlpha) 44 , m_preserveAlpha(preserveAlpha)
46 , m_kernelMatrix(kernelMatrix) 45 , m_kernelMatrix(kernelMatrix)
47 { 46 {
48 ASSERT(m_kernelSize.width() > 0); 47 ASSERT(m_kernelSize.width() > 0);
49 ASSERT(m_kernelSize.height() > 0); 48 ASSERT(m_kernelSize.height() > 0);
50 } 49 }
51 50
52 PassRefPtrWillBeRawPtr<FEConvolveMatrix> FEConvolveMatrix::create(Filter* filter , const IntSize& kernelSize, 51 PassRefPtrWillBeRawPtr<FEConvolveMatrix> FEConvolveMatrix::create(Filter* filter , const IntSize& kernelSize,
53 float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMo de, 52 float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMo de,
54 const FloatPoint& kernelUnitLength, bool preserveAlpha, const Vector<float>& kernelMatrix) 53 bool preserveAlpha, const Vector<float>& kernelMatrix)
55 { 54 {
56 return adoptRefWillBeNoop(new FEConvolveMatrix(filter, kernelSize, divisor, bias, targetOffset, edgeMode, kernelUnitLength, 55 return adoptRefWillBeNoop(new FEConvolveMatrix(filter, kernelSize, divisor, bias, targetOffset, edgeMode,
57 preserveAlpha, kernelMatrix)); 56 preserveAlpha, kernelMatrix));
58 } 57 }
59 58
60 FloatRect FEConvolveMatrix::mapPaintRect(const FloatRect& rect, bool forward) 59 FloatRect FEConvolveMatrix::mapPaintRect(const FloatRect& rect, bool forward)
61 { 60 {
62 FloatRect result = rect; 61 FloatRect result = rect;
63 62
64 result.moveBy(forward ? -m_targetOffset : m_targetOffset - m_kernelSize); 63 result.moveBy(forward ? -m_targetOffset : m_targetOffset - m_kernelSize);
65 result.expand(m_kernelSize); 64 result.expand(m_kernelSize);
66 return result; 65 return result;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 133 }
135 134
136 bool FEConvolveMatrix::setEdgeMode(EdgeModeType edgeMode) 135 bool FEConvolveMatrix::setEdgeMode(EdgeModeType edgeMode)
137 { 136 {
138 if (m_edgeMode == edgeMode) 137 if (m_edgeMode == edgeMode)
139 return false; 138 return false;
140 m_edgeMode = edgeMode; 139 m_edgeMode = edgeMode;
141 return true; 140 return true;
142 } 141 }
143 142
144 FloatPoint FEConvolveMatrix::kernelUnitLength() const
145 {
146 return m_kernelUnitLength;
147 }
148
149 bool FEConvolveMatrix::setKernelUnitLength(const FloatPoint& kernelUnitLength)
150 {
151 ASSERT(kernelUnitLength.x() > 0);
152 ASSERT(kernelUnitLength.y() > 0);
153 if (m_kernelUnitLength == kernelUnitLength)
154 return false;
155 m_kernelUnitLength = kernelUnitLength;
156 return true;
157 }
158
159 bool FEConvolveMatrix::preserveAlpha() const 143 bool FEConvolveMatrix::preserveAlpha() const
160 { 144 {
161 return m_preserveAlpha; 145 return m_preserveAlpha;
162 } 146 }
163 147
164 bool FEConvolveMatrix::setPreserveAlpha(bool preserveAlpha) 148 bool FEConvolveMatrix::setPreserveAlpha(bool preserveAlpha)
165 { 149 {
166 if (m_preserveAlpha == preserveAlpha) 150 if (m_preserveAlpha == preserveAlpha)
167 return false; 151 return false;
168 m_preserveAlpha = preserveAlpha; 152 m_preserveAlpha = preserveAlpha;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 { 208 {
225 writeIndent(ts, indent); 209 writeIndent(ts, indent);
226 ts << "[feConvolveMatrix"; 210 ts << "[feConvolveMatrix";
227 FilterEffect::externalRepresentation(ts); 211 FilterEffect::externalRepresentation(ts);
228 ts << " order=\"" << m_kernelSize << "\" " 212 ts << " order=\"" << m_kernelSize << "\" "
229 << "kernelMatrix=\"" << m_kernelMatrix << "\" " 213 << "kernelMatrix=\"" << m_kernelMatrix << "\" "
230 << "divisor=\"" << m_divisor << "\" " 214 << "divisor=\"" << m_divisor << "\" "
231 << "bias=\"" << m_bias << "\" " 215 << "bias=\"" << m_bias << "\" "
232 << "target=\"" << m_targetOffset << "\" " 216 << "target=\"" << m_targetOffset << "\" "
233 << "edgeMode=\"" << m_edgeMode << "\" " 217 << "edgeMode=\"" << m_edgeMode << "\" "
234 << "kernelUnitLength=\"" << m_kernelUnitLength << "\" "
235 << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n"; 218 << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n";
236 inputEffect(0)->externalRepresentation(ts, indent + 1); 219 inputEffect(0)->externalRepresentation(ts, indent + 1);
237 return ts; 220 return ts;
238 } 221 }
239 222
240 } // namespace blink 223 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/FEConvolveMatrix.h ('k') | Source/platform/graphics/filters/FEDiffuseLighting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698