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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 case FECOMPOSITE_OPERATOR_XOR: | 185 case FECOMPOSITE_OPERATOR_XOR: |
186 return SkXfermode::kXor_Mode; | 186 return SkXfermode::kXor_Mode; |
187 case FECOMPOSITE_OPERATOR_LIGHTER: | 187 case FECOMPOSITE_OPERATOR_LIGHTER: |
188 return SkXfermode::kPlus_Mode; | 188 return SkXfermode::kPlus_Mode; |
189 default: | 189 default: |
190 ASSERT_NOT_REACHED(); | 190 ASSERT_NOT_REACHED(); |
191 return SkXfermode::kSrcOver_Mode; | 191 return SkXfermode::kSrcOver_Mode; |
192 } | 192 } |
193 } | 193 } |
194 | 194 |
195 PassRefPtr<SkImageFilter> FEComposite::createImageFilter(SkiaImageFilterBuilder*
builder) | 195 PassRefPtr<SkImageFilter> FEComposite::createImageFilter(SkiaImageFilterBuilder&
builder) |
196 { | 196 { |
197 return createImageFilterInternal(builder, true); | 197 return createImageFilterInternal(builder, true); |
198 } | 198 } |
199 | 199 |
200 PassRefPtr<SkImageFilter> FEComposite::createImageFilterWithoutValidation(SkiaIm
ageFilterBuilder* builder) | 200 PassRefPtr<SkImageFilter> FEComposite::createImageFilterWithoutValidation(SkiaIm
ageFilterBuilder& builder) |
201 { | 201 { |
202 return createImageFilterInternal(builder, false); | 202 return createImageFilterInternal(builder, false); |
203 } | 203 } |
204 | 204 |
205 PassRefPtr<SkImageFilter> FEComposite::createImageFilterInternal(SkiaImageFilter
Builder* builder, bool requiresPMColorValidation) | 205 PassRefPtr<SkImageFilter> FEComposite::createImageFilterInternal(SkiaImageFilter
Builder& builder, bool requiresPMColorValidation) |
206 { | 206 { |
207 RefPtr<SkImageFilter> foreground(builder->build(inputEffect(0), operatingCol
orSpace(), !mayProduceInvalidPreMultipliedPixels())); | 207 RefPtr<SkImageFilter> foreground(builder.build(inputEffect(0), operatingColo
rSpace(), !mayProduceInvalidPreMultipliedPixels())); |
208 RefPtr<SkImageFilter> background(builder->build(inputEffect(1), operatingCol
orSpace(), !mayProduceInvalidPreMultipliedPixels())); | 208 RefPtr<SkImageFilter> background(builder.build(inputEffect(1), operatingColo
rSpace(), !mayProduceInvalidPreMultipliedPixels())); |
209 SkImageFilter::CropRect cropRect = getCropRect(builder->cropOffset()); | 209 SkImageFilter::CropRect cropRect = getCropRect(builder.cropOffset()); |
210 RefPtr<SkXfermode> mode; | 210 RefPtr<SkXfermode> mode; |
211 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) | 211 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) |
212 mode = adoptRef(SkArithmeticMode::Create(SkFloatToScalar(m_k1), SkFloatT
oScalar(m_k2), SkFloatToScalar(m_k3), SkFloatToScalar(m_k4), requiresPMColorVali
dation)); | 212 mode = adoptRef(SkArithmeticMode::Create(SkFloatToScalar(m_k1), SkFloatT
oScalar(m_k2), SkFloatToScalar(m_k3), SkFloatToScalar(m_k4), requiresPMColorVali
dation)); |
213 else | 213 else |
214 mode = adoptRef(SkXfermode::Create(toXfermode(m_type))); | 214 mode = adoptRef(SkXfermode::Create(toXfermode(m_type))); |
215 return adoptRef(SkXfermodeImageFilter::Create(mode.get(), background.get(),
foreground.get(), &cropRect)); | 215 return adoptRef(SkXfermodeImageFilter::Create(mode.get(), background.get(),
foreground.get(), &cropRect)); |
216 } | 216 } |
217 | 217 |
218 static TextStream& operator<<(TextStream& ts, const CompositeOperationType& type
) | 218 static TextStream& operator<<(TextStream& ts, const CompositeOperationType& type
) |
219 { | 219 { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 ts << " operation=\"" << m_type << "\""; | 254 ts << " operation=\"" << m_type << "\""; |
255 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) | 255 if (m_type == FECOMPOSITE_OPERATOR_ARITHMETIC) |
256 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\
" k4=\"" << m_k4 << "\""; | 256 ts << " k1=\"" << m_k1 << "\" k2=\"" << m_k2 << "\" k3=\"" << m_k3 << "\
" k4=\"" << m_k4 << "\""; |
257 ts << "]\n"; | 257 ts << "]\n"; |
258 inputEffect(0)->externalRepresentation(ts, indent + 1); | 258 inputEffect(0)->externalRepresentation(ts, indent + 1); |
259 inputEffect(1)->externalRepresentation(ts, indent + 1); | 259 inputEffect(1)->externalRepresentation(ts, indent + 1); |
260 return ts; | 260 return ts; |
261 } | 261 } |
262 | 262 |
263 } // namespace blink | 263 } // namespace blink |
OLD | NEW |