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

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

Issue 2341923002: Harmonize FilterEffect::mapRect and mapPaintRect (Closed)
Patch Set: Rebase Created 4 years, 2 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) 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 FEConvolveMatrix* FEConvolveMatrix::create(Filter* filter, const IntSize& kernel Size, 50 FEConvolveMatrix* FEConvolveMatrix::create(Filter* filter, const IntSize& kernel Size,
51 float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMo de, 51 float divisor, float bias, const IntPoint& targetOffset, EdgeModeType edgeMo de,
52 bool preserveAlpha, const Vector<float>& kernelMatrix) 52 bool preserveAlpha, const Vector<float>& kernelMatrix)
53 { 53 {
54 return new FEConvolveMatrix(filter, kernelSize, divisor, bias, targetOffset, edgeMode, 54 return new FEConvolveMatrix(filter, kernelSize, divisor, bias, targetOffset, edgeMode,
55 preserveAlpha, kernelMatrix); 55 preserveAlpha, kernelMatrix);
56 } 56 }
57 57
58 FloatRect FEConvolveMatrix::mapPaintRect(const FloatRect& rect, bool forward) co nst 58 FloatRect FEConvolveMatrix::mapEffect(const FloatRect& rect) const
59 { 59 {
60 if (!parametersValid())
61 return rect;
60 FloatRect result = rect; 62 FloatRect result = rect;
61 if (parametersValid()) { 63 result.moveBy(-m_targetOffset);
62 result.moveBy(forward ? -m_targetOffset : m_targetOffset - m_kernelSize) ; 64 result.expand(FloatSize(m_kernelSize));
63 result.expand(FloatSize(m_kernelSize));
64 }
65 return result; 65 return result;
66 } 66 }
67 67
68 bool FEConvolveMatrix::setDivisor(float divisor) 68 bool FEConvolveMatrix::setDivisor(float divisor)
69 { 69 {
70 if (m_divisor == divisor) 70 if (m_divisor == divisor)
71 return false; 71 return false;
72 m_divisor = divisor; 72 m_divisor = divisor;
73 return true; 73 return true;
74 } 74 }
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 << "divisor=\"" << m_divisor << "\" " 187 << "divisor=\"" << m_divisor << "\" "
188 << "bias=\"" << m_bias << "\" " 188 << "bias=\"" << m_bias << "\" "
189 << "target=\"" << m_targetOffset << "\" " 189 << "target=\"" << m_targetOffset << "\" "
190 << "edgeMode=\"" << m_edgeMode << "\" " 190 << "edgeMode=\"" << m_edgeMode << "\" "
191 << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n"; 191 << "preserveAlpha=\"" << m_preserveAlpha << "\"]\n";
192 inputEffect(0)->externalRepresentation(ts, indent + 1); 192 inputEffect(0)->externalRepresentation(ts, indent + 1);
193 return ts; 193 return ts;
194 } 194 }
195 195
196 } // namespace blink 196 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698