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 24 matching lines...) Expand all Loading... |
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 blink { | 41 namespace blink { |
42 | 42 |
43 class PLATFORM_EXPORT FELighting : public FilterEffect { | 43 class PLATFORM_EXPORT FELighting : public FilterEffect { |
44 public: | 44 public: |
45 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*)
OVERRIDE; | 45 virtual PassRefPtr<SkImageFilter> createImageFilter(SkiaImageFilterBuilder*)
override; |
46 | 46 |
47 protected: | 47 protected: |
48 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 |
49 | 49 |
50 enum LightingType { | 50 enum LightingType { |
51 DiffuseLighting, | 51 DiffuseLighting, |
52 SpecularLighting | 52 SpecularLighting |
53 }; | 53 }; |
54 | 54 |
55 struct LightingData { | 55 struct LightingData { |
(...skipping 20 matching lines...) Expand all Loading... |
76 friend class ParallelJobs; | 76 friend class ParallelJobs; |
77 | 77 |
78 struct PlatformApplyGenericParameters { | 78 struct PlatformApplyGenericParameters { |
79 FELighting* filter; | 79 FELighting* filter; |
80 LightingData data; | 80 LightingData data; |
81 LightSource::PaintingData paintingData; | 81 LightSource::PaintingData paintingData; |
82 int yStart; | 82 int yStart; |
83 int yEnd; | 83 int yEnd; |
84 }; | 84 }; |
85 | 85 |
86 virtual FloatRect mapPaintRect(const FloatRect&, bool forward = true) OVERRI
DE FINAL; | 86 virtual FloatRect mapPaintRect(const FloatRect&, bool forward = true) overri
de FINAL; |
87 virtual bool affectsTransparentPixels() OVERRIDE { return true; } | 87 virtual bool affectsTransparentPixels() override { return true; } |
88 | 88 |
89 static void platformApplyGenericWorker(PlatformApplyGenericParameters*); | 89 static void platformApplyGenericWorker(PlatformApplyGenericParameters*); |
90 | 90 |
91 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>); |
92 | 92 |
93 bool drawLighting(Uint8ClampedArray*, int, int); | 93 bool drawLighting(Uint8ClampedArray*, int, int); |
94 inline void inlineSetPixel(int offset, LightingData&, LightSource::PaintingD
ata&, | 94 inline void inlineSetPixel(int offset, LightingData&, LightSource::PaintingD
ata&, |
95 int lightX, int lightY, float factorX, float fact
orY, IntPoint& normalVector); | 95 int lightX, int lightY, float factorX, float fact
orY, IntPoint& normalVector); |
96 | 96 |
97 // Not worth to inline every occurence of setPixel. | 97 // Not worth to inline every occurence of setPixel. |
(...skipping 10 matching lines...) Expand all Loading... |
108 | 108 |
109 Color m_lightingColor; | 109 Color m_lightingColor; |
110 float m_surfaceScale; | 110 float m_surfaceScale; |
111 float m_diffuseConstant; | 111 float m_diffuseConstant; |
112 float m_specularConstant; | 112 float m_specularConstant; |
113 float m_specularExponent; | 113 float m_specularExponent; |
114 float m_kernelUnitLengthX; | 114 float m_kernelUnitLengthX; |
115 float m_kernelUnitLengthY; | 115 float m_kernelUnitLengthY; |
116 | 116 |
117 private: | 117 private: |
118 virtual void applySoftware() OVERRIDE; | 118 virtual void applySoftware() override; |
119 | 119 |
120 void getTransform(FloatPoint3D* scale, FloatSize* offset) const; | 120 void getTransform(FloatPoint3D* scale, FloatSize* offset) const; |
121 }; | 121 }; |
122 | 122 |
123 } // namespace blink | 123 } // namespace blink |
124 | 124 |
125 #endif // FELighting_h | 125 #endif // FELighting_h |
OLD | NEW |