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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 case FECOMPONENTTRANSFER_TYPE_LINEAR: | 120 case FECOMPONENTTRANSFER_TYPE_LINEAR: |
121 intercept = m_alphaFunc.intercept; | 121 intercept = m_alphaFunc.intercept; |
122 break; | 122 break; |
123 case FECOMPONENTTRANSFER_TYPE_GAMMA: | 123 case FECOMPONENTTRANSFER_TYPE_GAMMA: |
124 intercept = m_alphaFunc.offset; | 124 intercept = m_alphaFunc.offset; |
125 break; | 125 break; |
126 } | 126 } |
127 return 255 * intercept >= 1; | 127 return 255 * intercept >= 1; |
128 } | 128 } |
129 | 129 |
130 PassRefPtr<SkImageFilter> FEComponentTransfer::createImageFilter(SkiaImageFilter
Builder* builder) | 130 PassRefPtr<SkImageFilter> FEComponentTransfer::createImageFilter(SkiaImageFilter
Builder& builder) |
131 { | 131 { |
132 RefPtr<SkImageFilter> input(builder->build(inputEffect(0), operatingColorSpa
ce())); | 132 RefPtr<SkImageFilter> input(builder.build(inputEffect(0), operatingColorSpac
e())); |
133 | 133 |
134 unsigned char rValues[256], gValues[256], bValues[256], aValues[256]; | 134 unsigned char rValues[256], gValues[256], bValues[256], aValues[256]; |
135 getValues(rValues, gValues, bValues, aValues); | 135 getValues(rValues, gValues, bValues, aValues); |
136 | 136 |
137 SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::CreateARGB(aValu
es, rValues, gValues, bValues)); | 137 SkAutoTUnref<SkColorFilter> colorFilter(SkTableColorFilter::CreateARGB(aValu
es, rValues, gValues, bValues)); |
138 | 138 |
139 SkImageFilter::CropRect cropRect = getCropRect(builder->cropOffset()); | 139 SkImageFilter::CropRect cropRect = getCropRect(builder.cropOffset()); |
140 return adoptRef(SkColorFilterImageFilter::Create(colorFilter, input.get(), &
cropRect)); | 140 return adoptRef(SkColorFilterImageFilter::Create(colorFilter, input.get(), &
cropRect)); |
141 } | 141 } |
142 | 142 |
143 void FEComponentTransfer::getValues(unsigned char rValues[256], unsigned char gV
alues[256], unsigned char bValues[256], unsigned char aValues[256]) | 143 void FEComponentTransfer::getValues(unsigned char rValues[256], unsigned char gV
alues[256], unsigned char bValues[256], unsigned char aValues[256]) |
144 { | 144 { |
145 for (unsigned i = 0; i < 256; ++i) | 145 for (unsigned i = 0; i < 256; ++i) |
146 rValues[i] = gValues[i] = bValues[i] = aValues[i] = i; | 146 rValues[i] = gValues[i] = bValues[i] = aValues[i] = i; |
147 unsigned char* tables[] = { rValues, gValues, bValues, aValues }; | 147 unsigned char* tables[] = { rValues, gValues, bValues, aValues }; |
148 ComponentTransferFunction transferFunction[] = {m_redFunc, m_greenFunc, m_bl
ueFunc, m_alphaFunc}; | 148 ComponentTransferFunction transferFunction[] = {m_redFunc, m_greenFunc, m_bl
ueFunc, m_alphaFunc}; |
149 TransferType callEffect[] = {identity, identity, table, discrete, linear, ga
mma}; | 149 TransferType callEffect[] = {identity, identity, table, discrete, linear, ga
mma}; |
(...skipping 52 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 |