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 22 matching lines...) Expand all Loading... |
33 #include "platform/graphics/filters/FilterEffect.h" | 33 #include "platform/graphics/filters/FilterEffect.h" |
34 #include "platform/graphics/filters/LightSource.h" | 34 #include "platform/graphics/filters/LightSource.h" |
35 #include "platform/graphics/filters/PointLightSource.h" | 35 #include "platform/graphics/filters/PointLightSource.h" |
36 #include "platform/graphics/filters/SpotLightSource.h" | 36 #include "platform/graphics/filters/SpotLightSource.h" |
37 #include "wtf/Uint8ClampedArray.h" | 37 #include "wtf/Uint8ClampedArray.h" |
38 | 38 |
39 // Common base class for FEDiffuseLighting and FESpecularLighting | 39 // Common base class for FEDiffuseLighting and FESpecularLighting |
40 | 40 |
41 namespace WebCore { | 41 namespace WebCore { |
42 | 42 |
43 struct FELightingPaintingDataForNeon; | |
44 | |
45 class PLATFORM_EXPORT FELighting : public FilterEffect { | 43 class PLATFORM_EXPORT FELighting : public FilterEffect { |
46 public: | 44 public: |
47 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*)
OVERRIDE; | 45 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*)
OVERRIDE; |
48 | 46 |
49 protected: | 47 protected: |
50 static const int s_minimalRectDimension = 100 * 100; // Empirical data limit
for parallel jobs | 48 static const int s_minimalRectDimension = 100 * 100; // Empirical data limit
for parallel jobs |
51 | 49 |
52 enum LightingType { | 50 enum LightingType { |
53 DiffuseLighting, | 51 DiffuseLighting, |
54 SpecularLighting | 52 SpecularLighting |
(...skipping 27 matching lines...) Expand all Loading... |
82 LightingData data; | 80 LightingData data; |
83 LightSource::PaintingData paintingData; | 81 LightSource::PaintingData paintingData; |
84 int yStart; | 82 int yStart; |
85 int yEnd; | 83 int yEnd; |
86 }; | 84 }; |
87 | 85 |
88 virtual FloatRect mapPaintRect(const FloatRect&, bool forward = true) OVERRI
DE FINAL; | 86 virtual FloatRect mapPaintRect(const FloatRect&, bool forward = true) OVERRI
DE FINAL; |
89 virtual bool affectsTransparentPixels() OVERRIDE { return true; } | 87 virtual bool affectsTransparentPixels() OVERRIDE { return true; } |
90 | 88 |
91 static void platformApplyGenericWorker(PlatformApplyGenericParameters*); | 89 static void platformApplyGenericWorker(PlatformApplyGenericParameters*); |
92 static void platformApplyNeonWorker(FELightingPaintingDataForNeon*); | |
93 | 90 |
94 FELighting(Filter*, LightingType, const Color&, float, float, float, float,
float, float, PassRefPtr<LightSource>); | 91 FELighting(Filter*, LightingType, const Color&, float, float, float, float,
float, float, PassRefPtr<LightSource>); |
95 | 92 |
96 bool drawLighting(Uint8ClampedArray*, int, int); | 93 bool drawLighting(Uint8ClampedArray*, int, int); |
97 inline void inlineSetPixel(int offset, LightingData&, LightSource::PaintingD
ata&, | 94 inline void inlineSetPixel(int offset, LightingData&, LightSource::PaintingD
ata&, |
98 int lightX, int lightY, float factorX, float fact
orY, IntPoint& normalVector); | 95 int lightX, int lightY, float factorX, float fact
orY, IntPoint& normalVector); |
99 | 96 |
100 // Not worth to inline every occurence of setPixel. | 97 // Not worth to inline every occurence of setPixel. |
101 void setPixel(int offset, LightingData&, LightSource::PaintingData&, | 98 void setPixel(int offset, LightingData&, LightSource::PaintingData&, |
102 int lightX, int lightY, float factorX, float factorY, IntPoint
& normalVector); | 99 int lightX, int lightY, float factorX, float factorY, IntPoint
& normalVector); |
103 | 100 |
104 inline void platformApply(LightingData&, LightSource::PaintingData&); | 101 inline void platformApply(LightingData&, LightSource::PaintingData&); |
105 | 102 |
106 inline void platformApplyGenericPaint(LightingData&, LightSource::PaintingDa
ta&, int startX, int startY); | 103 inline void platformApplyGenericPaint(LightingData&, LightSource::PaintingDa
ta&, int startX, int startY); |
107 inline void platformApplyGeneric(LightingData&, LightSource::PaintingData&); | 104 inline void platformApplyGeneric(LightingData&, LightSource::PaintingData&); |
108 | 105 |
109 static int getPowerCoefficients(float exponent); | |
110 inline void platformApplyNeon(LightingData&, LightSource::PaintingData&); | |
111 | |
112 LightingType m_lightingType; | 106 LightingType m_lightingType; |
113 RefPtr<LightSource> m_lightSource; | 107 RefPtr<LightSource> m_lightSource; |
114 | 108 |
115 Color m_lightingColor; | 109 Color m_lightingColor; |
116 float m_surfaceScale; | 110 float m_surfaceScale; |
117 float m_diffuseConstant; | 111 float m_diffuseConstant; |
118 float m_specularConstant; | 112 float m_specularConstant; |
119 float m_specularExponent; | 113 float m_specularExponent; |
120 float m_kernelUnitLengthX; | 114 float m_kernelUnitLengthX; |
121 float m_kernelUnitLengthY; | 115 float m_kernelUnitLengthY; |
122 | 116 |
123 private: | 117 private: |
124 virtual void applySoftware() OVERRIDE; | 118 virtual void applySoftware() OVERRIDE; |
125 | 119 |
126 void getTransform(FloatPoint3D* scale, FloatSize* offset) const; | 120 void getTransform(FloatPoint3D* scale, FloatSize* offset) const; |
127 }; | 121 }; |
128 | 122 |
129 } // namespace WebCore | 123 } // namespace WebCore |
130 | 124 |
131 #endif // FELighting_h | 125 #endif // FELighting_h |
OLD | NEW |