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) 2010 Zoltan Herczeg <zherczeg@webkit.org> | 5 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org> |
6 * Copyright (C) 2011 University of Szeged | 6 * Copyright (C) 2011 University of Szeged |
7 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> | 7 * Copyright (C) 2011 Renata Hodovan <reni@webkit.org> |
8 * | 8 * |
9 * Redistribution and use in source and binary forms, with or without | 9 * Redistribution and use in source and binary forms, with or without |
10 * modification, are permitted provided that the following conditions | 10 * modification, are permitted provided that the following conditions |
(...skipping 17 matching lines...) Expand all Loading... |
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
29 */ | 29 */ |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "platform/graphics/filters/DistantLightSource.h" | 32 #include "platform/graphics/filters/DistantLightSource.h" |
33 | 33 |
34 #include "platform/text/TextStream.h" | 34 #include "platform/text/TextStream.h" |
35 | 35 |
36 namespace WebCore { | 36 namespace WebCore { |
37 | 37 |
38 void DistantLightSource::initPaintingData(PaintingData& paintingData) | 38 void DistantLightSource::initPaintingData(PaintingData& paintingData) const |
39 { | 39 { |
40 float azimuth = deg2rad(m_azimuth); | 40 float azimuth = deg2rad(m_azimuth); |
41 float elevation = deg2rad(m_elevation); | 41 float elevation = deg2rad(m_elevation); |
42 paintingData.lightVector.setX(cosf(azimuth) * cosf(elevation)); | 42 paintingData.lightVector.setX(cosf(azimuth) * cosf(elevation)); |
43 paintingData.lightVector.setY(sinf(azimuth) * cosf(elevation)); | 43 paintingData.lightVector.setY(sinf(azimuth) * cosf(elevation)); |
44 paintingData.lightVector.setZ(sinf(elevation)); | 44 paintingData.lightVector.setZ(sinf(elevation)); |
45 paintingData.lightVectorLength = 1; | 45 paintingData.lightVectorLength = 1; |
46 } | 46 } |
47 | 47 |
48 void DistantLightSource::updatePaintingData(PaintingData&, int, int, float) | 48 void DistantLightSource::updatePaintingData(PaintingData&, float, float, float)
const |
49 { | 49 { |
50 } | 50 } |
51 | 51 |
52 bool DistantLightSource::setAzimuth(float azimuth) | 52 bool DistantLightSource::setAzimuth(float azimuth) |
53 { | 53 { |
54 if (m_azimuth == azimuth) | 54 if (m_azimuth == azimuth) |
55 return false; | 55 return false; |
56 m_azimuth = azimuth; | 56 m_azimuth = azimuth; |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 bool DistantLightSource::setElevation(float elevation) | 60 bool DistantLightSource::setElevation(float elevation) |
61 { | 61 { |
62 if (m_elevation == elevation) | 62 if (m_elevation == elevation) |
63 return false; | 63 return false; |
64 m_elevation = elevation; | 64 m_elevation = elevation; |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const | 68 TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const |
69 { | 69 { |
70 ts << "[type=DISTANT-LIGHT] "; | 70 ts << "[type=DISTANT-LIGHT] "; |
71 ts << "[azimuth=\"" << azimuth() << "\"]"; | 71 ts << "[azimuth=\"" << azimuth() << "\"]"; |
72 ts << "[elevation=\"" << elevation() << "\"]"; | 72 ts << "[elevation=\"" << elevation() << "\"]"; |
73 return ts; | 73 return ts; |
74 } | 74 } |
75 | 75 |
76 } // namespace WebCore | 76 } // namespace WebCore |
OLD | NEW |