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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 for (unsigned i = 0; i < 256; ++i) { | 96 for (unsigned i = 0; i < 256; ++i) { |
97 double val = transferFunction.slope * i + 255 * transferFunction.intercept; | 97 double val = transferFunction.slope * i + 255 * transferFunction.intercept; |
98 val = clampTo(val, 0.0, 255.0); | 98 val = clampTo(val, 0.0, 255.0); |
99 values[i] = static_cast<unsigned char>(val); | 99 values[i] = static_cast<unsigned char>(val); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 static void gamma(unsigned char* values, | 103 static void gamma(unsigned char* values, |
104 const ComponentTransferFunction& transferFunction) { | 104 const ComponentTransferFunction& transferFunction) { |
105 for (unsigned i = 0; i < 256; ++i) { | 105 for (unsigned i = 0; i < 256; ++i) { |
106 double exponent = | 106 double exponent = transferFunction.exponent; |
107 transferFunction | |
108 .exponent; // RCVT doesn't like passing a double and a float to pow
, so promote this to double | |
109 double val = | 107 double val = |
110 255.0 * (transferFunction.amplitude * pow((i / 255.0), exponent) + | 108 255.0 * (transferFunction.amplitude * pow((i / 255.0), exponent) + |
111 transferFunction.offset); | 109 transferFunction.offset); |
112 val = clampTo(val, 0.0, 255.0); | 110 val = clampTo(val, 0.0, 255.0); |
113 values[i] = static_cast<unsigned char>(val); | 111 values[i] = static_cast<unsigned char>(val); |
114 } | 112 } |
115 } | 113 } |
116 | 114 |
117 bool FEComponentTransfer::affectsTransparentPixels() const { | 115 bool FEComponentTransfer::affectsTransparentPixels() const { |
118 double intercept = 0; | 116 double intercept = 0; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ts << "{green: " << m_greenFunc << "}\n"; | 214 ts << "{green: " << m_greenFunc << "}\n"; |
217 writeIndent(ts, indent + 2); | 215 writeIndent(ts, indent + 2); |
218 ts << "{blue: " << m_blueFunc << "}\n"; | 216 ts << "{blue: " << m_blueFunc << "}\n"; |
219 writeIndent(ts, indent + 2); | 217 writeIndent(ts, indent + 2); |
220 ts << "{alpha: " << m_alphaFunc << "}]\n"; | 218 ts << "{alpha: " << m_alphaFunc << "}]\n"; |
221 inputEffect(0)->externalRepresentation(ts, indent + 1); | 219 inputEffect(0)->externalRepresentation(ts, indent + 1); |
222 return ts; | 220 return ts; |
223 } | 221 } |
224 | 222 |
225 } // namespace blink | 223 } // namespace blink |
OLD | NEW |