OLD | NEW |
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) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 float FEOffset::dy() const | 56 float FEOffset::dy() const |
57 { | 57 { |
58 return m_dy; | 58 return m_dy; |
59 } | 59 } |
60 | 60 |
61 void FEOffset::setDy(float dy) | 61 void FEOffset::setDy(float dy) |
62 { | 62 { |
63 m_dy = dy; | 63 m_dy = dy; |
64 } | 64 } |
65 | 65 |
66 FloatRect FEOffset::mapRect(const FloatRect& rect, bool forward) const | 66 FloatRect FEOffset::mapEffect(const FloatRect& rect) const |
67 { | 67 { |
68 FloatRect result = rect; | 68 FloatRect result = rect; |
69 if (forward) | 69 result.move(getFilter()->applyHorizontalScale(m_dx), getFilter()->applyVerti
calScale(m_dy)); |
70 result.move(getFilter()->applyHorizontalScale(m_dx), getFilter()->applyV
erticalScale(m_dy)); | |
71 else | |
72 result.move(-getFilter()->applyHorizontalScale(m_dx), -getFilter()->appl
yVerticalScale(m_dy)); | |
73 return result; | 70 return result; |
74 } | 71 } |
75 | 72 |
76 sk_sp<SkImageFilter> FEOffset::createImageFilter() | 73 sk_sp<SkImageFilter> FEOffset::createImageFilter() |
77 { | 74 { |
78 Filter* filter = this->getFilter(); | 75 Filter* filter = this->getFilter(); |
79 SkImageFilter::CropRect cropRect = getCropRect(); | 76 SkImageFilter::CropRect cropRect = getCropRect(); |
80 return SkOffsetImageFilter::Make( | 77 return SkOffsetImageFilter::Make( |
81 SkFloatToScalar(filter->applyHorizontalScale(m_dx)), | 78 SkFloatToScalar(filter->applyHorizontalScale(m_dx)), |
82 SkFloatToScalar(filter->applyVerticalScale(m_dy)), | 79 SkFloatToScalar(filter->applyVerticalScale(m_dy)), |
83 SkiaImageFilterBuilder::build(inputEffect(0), operatingColorSpace()), | 80 SkiaImageFilterBuilder::build(inputEffect(0), operatingColorSpace()), |
84 &cropRect); | 81 &cropRect); |
85 } | 82 } |
86 | 83 |
87 TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const | 84 TextStream& FEOffset::externalRepresentation(TextStream& ts, int indent) const |
88 { | 85 { |
89 writeIndent(ts, indent); | 86 writeIndent(ts, indent); |
90 ts << "[feOffset"; | 87 ts << "[feOffset"; |
91 FilterEffect::externalRepresentation(ts); | 88 FilterEffect::externalRepresentation(ts); |
92 ts << " dx=\"" << dx() << "\" dy=\"" << dy() << "\"]\n"; | 89 ts << " dx=\"" << dx() << "\" dy=\"" << dy() << "\"]\n"; |
93 inputEffect(0)->externalRepresentation(ts, indent + 1); | 90 inputEffect(0)->externalRepresentation(ts, indent + 1); |
94 return ts; | 91 return ts; |
95 } | 92 } |
96 | 93 |
97 } // namespace blink | 94 } // namespace blink |
OLD | NEW |