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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 static void gamma(unsigned char* values, const ComponentTransferFunction& transf
erFunction) | 99 static void gamma(unsigned char* values, const ComponentTransferFunction& transf
erFunction) |
100 { | 100 { |
101 for (unsigned i = 0; i < 256; ++i) { | 101 for (unsigned i = 0; i < 256; ++i) { |
102 double exponent = transferFunction.exponent; // RCVT doesn't like passin
g a double and a float to pow, so promote this to double | 102 double exponent = transferFunction.exponent; // RCVT doesn't like passin
g a double and a float to pow, so promote this to double |
103 double val = 255.0 * (transferFunction.amplitude * pow((i / 255.0), expo
nent) + transferFunction.offset); | 103 double val = 255.0 * (transferFunction.amplitude * pow((i / 255.0), expo
nent) + transferFunction.offset); |
104 val = clampTo(val, 0.0, 255.0); | 104 val = clampTo(val, 0.0, 255.0); |
105 values[i] = static_cast<unsigned char>(val); | 105 values[i] = static_cast<unsigned char>(val); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 bool FEComponentTransfer::affectsTransparentPixels() | 109 bool FEComponentTransfer::affectsTransparentPixels() const |
110 { | 110 { |
111 double intercept = 0; | 111 double intercept = 0; |
112 switch (m_alphaFunc.type) { | 112 switch (m_alphaFunc.type) { |
113 case FECOMPONENTTRANSFER_TYPE_UNKNOWN: | 113 case FECOMPONENTTRANSFER_TYPE_UNKNOWN: |
114 case FECOMPONENTTRANSFER_TYPE_IDENTITY: | 114 case FECOMPONENTTRANSFER_TYPE_IDENTITY: |
115 break; | 115 break; |
116 case FECOMPONENTTRANSFER_TYPE_TABLE: | 116 case FECOMPONENTTRANSFER_TYPE_TABLE: |
117 case FECOMPONENTTRANSFER_TYPE_DISCRETE: | 117 case FECOMPONENTTRANSFER_TYPE_DISCRETE: |
118 if (m_alphaFunc.tableValues.size() > 0) | 118 if (m_alphaFunc.tableValues.size() > 0) |
119 intercept = m_alphaFunc.tableValues[0]; | 119 intercept = m_alphaFunc.tableValues[0]; |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 ts << "{green: " << m_greenFunc << "}\n"; | 202 ts << "{green: " << m_greenFunc << "}\n"; |
203 writeIndent(ts, indent + 2); | 203 writeIndent(ts, indent + 2); |
204 ts << "{blue: " << m_blueFunc << "}\n"; | 204 ts << "{blue: " << m_blueFunc << "}\n"; |
205 writeIndent(ts, indent + 2); | 205 writeIndent(ts, indent + 2); |
206 ts << "{alpha: " << m_alphaFunc << "}]\n"; | 206 ts << "{alpha: " << m_alphaFunc << "}]\n"; |
207 inputEffect(0)->externalRepresentation(ts, indent + 1); | 207 inputEffect(0)->externalRepresentation(ts, indent + 1); |
208 return ts; | 208 return ts; |
209 } | 209 } |
210 | 210 |
211 } // namespace blink | 211 } // namespace blink |
OLD | NEW |