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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 = transferFunction.exponent; | 106 double exponent = transferFunction.exponent; |
107 double val = | 107 double val = 255.0 * |
108 255.0 * (transferFunction.amplitude * pow((i / 255.0), exponent) + | 108 (transferFunction.amplitude * pow((i / 255.0), exponent) + |
109 transferFunction.offset); | 109 transferFunction.offset); |
110 val = clampTo(val, 0.0, 255.0); | 110 val = clampTo(val, 0.0, 255.0); |
111 values[i] = static_cast<unsigned char>(val); | 111 values[i] = static_cast<unsigned char>(val); |
112 } | 112 } |
113 } | 113 } |
114 | 114 |
115 bool FEComponentTransfer::affectsTransparentPixels() const { | 115 bool FEComponentTransfer::affectsTransparentPixels() const { |
116 double intercept = 0; | 116 double intercept = 0; |
117 switch (m_alphaFunc.type) { | 117 switch (m_alphaFunc.type) { |
118 case FECOMPONENTTRANSFER_TYPE_UNKNOWN: | 118 case FECOMPONENTTRANSFER_TYPE_UNKNOWN: |
119 case FECOMPONENTTRANSFER_TYPE_IDENTITY: | 119 case FECOMPONENTTRANSFER_TYPE_IDENTITY: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 ts << "{green: " << m_greenFunc << "}\n"; | 213 ts << "{green: " << m_greenFunc << "}\n"; |
214 writeIndent(ts, indent + 2); | 214 writeIndent(ts, indent + 2); |
215 ts << "{blue: " << m_blueFunc << "}\n"; | 215 ts << "{blue: " << m_blueFunc << "}\n"; |
216 writeIndent(ts, indent + 2); | 216 writeIndent(ts, indent + 2); |
217 ts << "{alpha: " << m_alphaFunc << "}]\n"; | 217 ts << "{alpha: " << m_alphaFunc << "}]\n"; |
218 inputEffect(0)->externalRepresentation(ts, indent + 1); | 218 inputEffect(0)->externalRepresentation(ts, indent + 1); |
219 return ts; | 219 return ts; |
220 } | 220 } |
221 | 221 |
222 } // namespace blink | 222 } // namespace blink |
OLD | NEW |