OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 2 * Copyright (C) Research In Motion Limited 2011. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 Google Inc. All rights reserved. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 result.unite(offsetRect); | 59 result.unite(offsetRect); |
60 | 60 |
61 IntSize kernelSize = FEGaussianBlur::calculateKernelSize(filter, FloatPoint(
m_stdX, m_stdY)); | 61 IntSize kernelSize = FEGaussianBlur::calculateKernelSize(filter, FloatPoint(
m_stdX, m_stdY)); |
62 | 62 |
63 // We take the half kernel size and multiply it with three, because we run b
ox blur three times. | 63 // We take the half kernel size and multiply it with three, because we run b
ox blur three times. |
64 result.inflateX(3 * kernelSize.width() * 0.5f); | 64 result.inflateX(3 * kernelSize.width() * 0.5f); |
65 result.inflateY(3 * kernelSize.height() * 0.5f); | 65 result.inflateY(3 * kernelSize.height() * 0.5f); |
66 return result; | 66 return result; |
67 } | 67 } |
68 | 68 |
69 PassRefPtr<SkImageFilter> FEDropShadow::createImageFilter(SkiaImageFilterBuilder
* builder) | 69 PassRefPtr<SkImageFilter> FEDropShadow::createImageFilter(SkiaImageFilterBuilder
& builder) |
70 { | 70 { |
71 RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpa
ce())); | 71 RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpac
e())); |
72 float dx = filter()->applyHorizontalScale(m_dx); | 72 float dx = filter()->applyHorizontalScale(m_dx); |
73 float dy = filter()->applyVerticalScale(m_dy); | 73 float dy = filter()->applyVerticalScale(m_dy); |
74 float stdX = filter()->applyHorizontalScale(m_stdX); | 74 float stdX = filter()->applyHorizontalScale(m_stdX); |
75 float stdY = filter()->applyVerticalScale(m_stdY); | 75 float stdY = filter()->applyVerticalScale(m_stdY); |
76 Color color = adaptColorToOperatingColorSpace(m_shadowColor.combineWithAlpha
(m_shadowOpacity)); | 76 Color color = adaptColorToOperatingColorSpace(m_shadowColor.combineWithAlpha
(m_shadowOpacity)); |
77 SkImageFilter::CropRect cropRect = getCropRect(builder->cropOffset()); | 77 SkImageFilter::CropRect cropRect = getCropRect(builder.cropOffset()); |
78 return adoptRef(SkDropShadowImageFilter::Create(SkFloatToScalar(dx), SkFloat
ToScalar(dy), SkFloatToScalar(stdX), SkFloatToScalar(stdY), color.rgb(), SkDropS
hadowImageFilter::kDrawShadowAndForeground_ShadowMode, input.get(), &cropRect)); | 78 return adoptRef(SkDropShadowImageFilter::Create(SkFloatToScalar(dx), SkFloat
ToScalar(dy), SkFloatToScalar(stdX), SkFloatToScalar(stdY), color.rgb(), SkDropS
hadowImageFilter::kDrawShadowAndForeground_ShadowMode, input.get(), &cropRect)); |
79 } | 79 } |
80 | 80 |
81 | 81 |
82 TextStream& FEDropShadow::externalRepresentation(TextStream& ts, int indent) con
st | 82 TextStream& FEDropShadow::externalRepresentation(TextStream& ts, int indent) con
st |
83 { | 83 { |
84 writeIndent(ts, indent); | 84 writeIndent(ts, indent); |
85 ts << "[feDropShadow"; | 85 ts << "[feDropShadow"; |
86 FilterEffect::externalRepresentation(ts); | 86 FilterEffect::externalRepresentation(ts); |
87 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\" dx=\"" << m_dx <
< "\" dy=\"" << m_dy << "\" flood-color=\"" << m_shadowColor.nameForLayoutTreeAs
Text() <<"\" flood-opacity=\"" << m_shadowOpacity << "]\n"; | 87 ts << " stdDeviation=\"" << m_stdX << ", " << m_stdY << "\" dx=\"" << m_dx <
< "\" dy=\"" << m_dy << "\" flood-color=\"" << m_shadowColor.nameForLayoutTreeAs
Text() <<"\" flood-opacity=\"" << m_shadowOpacity << "]\n"; |
88 inputEffect(0)->externalRepresentation(ts, indent + 1); | 88 inputEffect(0)->externalRepresentation(ts, indent + 1); |
89 return ts; | 89 return ts; |
90 } | 90 } |
91 | 91 |
92 } // namespace blink | 92 } // namespace blink |
OLD | NEW |