OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 University of Szeged | 2 * Copyright (C) 2010 University of Szeged |
3 * Copyright (C) 2010 Zoltan Herczeg | 3 * Copyright (C) 2010 Zoltan Herczeg |
4 * Copyright (C) 2013 Google Inc. All rights reserved. | 4 * Copyright (C) 2013 Google Inc. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 11 matching lines...) Expand all Loading... |
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY | 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 */ | 26 */ |
27 | 27 |
28 #include "config.h" | 28 #include "config.h" |
29 #include "platform/graphics/filters/FELighting.h" | 29 #include "platform/graphics/filters/FELighting.h" |
30 | 30 |
31 #include "SkLightingImageFilter.h" | 31 #include "SkLightingImageFilter.h" |
32 #include "platform/graphics/cpu/arm/filters/FELightingNEON.h" | |
33 #include "platform/graphics/filters/DistantLightSource.h" | 32 #include "platform/graphics/filters/DistantLightSource.h" |
34 #include "platform/graphics/filters/ParallelJobs.h" | 33 #include "platform/graphics/filters/ParallelJobs.h" |
35 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" | 34 #include "platform/graphics/filters/SkiaImageFilterBuilder.h" |
36 #include "platform/graphics/skia/NativeImageSkia.h" | 35 #include "platform/graphics/skia/NativeImageSkia.h" |
37 | 36 |
38 namespace WebCore { | 37 namespace WebCore { |
39 | 38 |
40 FELighting::FELighting(Filter* filter, LightingType lightingType, const Color& l
ightingColor, float surfaceScale, | 39 FELighting::FELighting(Filter* filter, LightingType lightingType, const Color& l
ightingColor, float surfaceScale, |
41 float diffuseConstant, float specularConstant, float specularExponent, | 40 float diffuseConstant, float specularConstant, float specularExponent, |
42 float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> li
ghtSource) | 41 float kernelUnitLengthX, float kernelUnitLengthY, PassRefPtr<LightSource> li
ghtSource) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 return; | 286 return; |
288 } | 287 } |
289 // Fallback to single threaded mode. | 288 // Fallback to single threaded mode. |
290 } | 289 } |
291 | 290 |
292 platformApplyGenericPaint(data, paintingData, 1, data.heightDecreasedByOne); | 291 platformApplyGenericPaint(data, paintingData, 1, data.heightDecreasedByOne); |
293 } | 292 } |
294 | 293 |
295 inline void FELighting::platformApply(LightingData& data, LightSource::PaintingD
ata& paintingData) | 294 inline void FELighting::platformApply(LightingData& data, LightSource::PaintingD
ata& paintingData) |
296 { | 295 { |
297 // The selection here eventually should happen dynamically on some platforms
. | |
298 #if CPU(ARM_NEON) && CPU(ARM_TRADITIONAL) && COMPILER(GCC) | |
299 platformApplyNeon(data, paintingData); | |
300 #else | |
301 platformApplyGeneric(data, paintingData); | 296 platformApplyGeneric(data, paintingData); |
302 #endif | |
303 } | 297 } |
304 | 298 |
305 void FELighting::getTransform(FloatPoint3D* scale, FloatSize* offset) const | 299 void FELighting::getTransform(FloatPoint3D* scale, FloatSize* offset) const |
306 { | 300 { |
307 FloatRect initialEffectRect = effectBoundaries(); | 301 FloatRect initialEffectRect = effectBoundaries(); |
308 FloatRect absoluteEffectRect = filter()->mapLocalRectToAbsoluteRect(initialE
ffectRect); | 302 FloatRect absoluteEffectRect = filter()->mapLocalRectToAbsoluteRect(initialE
ffectRect); |
309 FloatPoint absoluteLocation(absolutePaintRect().location()); | 303 FloatPoint absoluteLocation(absolutePaintRect().location()); |
310 FloatSize positionOffset(absoluteLocation - absoluteEffectRect.location()); | 304 FloatSize positionOffset(absoluteLocation - absoluteEffectRect.location()); |
311 offset->setWidth(positionOffset.width()); | 305 offset->setWidth(positionOffset.width()); |
312 offset->setHeight(positionOffset.height()); | 306 offset->setHeight(positionOffset.height()); |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 return adoptRef(SkLightingImageFilter::CreateSpotLitSpecular(locatio
n, target, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale
, m_specularConstant, m_specularExponent, input.get(), &rect)); | 469 return adoptRef(SkLightingImageFilter::CreateSpotLitSpecular(locatio
n, target, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale
, m_specularConstant, m_specularExponent, input.get(), &rect)); |
476 return adoptRef(SkLightingImageFilter::CreateSpotLitDiffuse(location, ta
rget, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale, m_d
iffuseConstant, input.get(), &rect)); | 470 return adoptRef(SkLightingImageFilter::CreateSpotLitDiffuse(location, ta
rget, specularExponent, limitingConeAngle, lightColor.rgb(), m_surfaceScale, m_d
iffuseConstant, input.get(), &rect)); |
477 } | 471 } |
478 default: | 472 default: |
479 ASSERT_NOT_REACHED(); | 473 ASSERT_NOT_REACHED(); |
480 return nullptr; | 474 return nullptr; |
481 } | 475 } |
482 } | 476 } |
483 | 477 |
484 } // namespace WebCore | 478 } // namespace WebCore |
OLD | NEW |