Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(126)

Side by Side Diff: Source/platform/graphics/filters/DistantLightSource.cpp

Issue 951523002: Remove PaintingData from LightSource (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 blink { 36 namespace blink {
37 37
38 void DistantLightSource::initPaintingData(PaintingData& paintingData) const
39 {
40 float azimuth = deg2rad(m_azimuth);
41 float elevation = deg2rad(m_elevation);
42 paintingData.lightVector.setX(cosf(azimuth) * cosf(elevation));
43 paintingData.lightVector.setY(sinf(azimuth) * cosf(elevation));
44 paintingData.lightVector.setZ(sinf(elevation));
45 paintingData.lightVectorLength = 1;
46 }
47
48 void DistantLightSource::updatePaintingData(PaintingData&, int, int, float) cons t
49 {
50 }
51
52 bool DistantLightSource::setAzimuth(float azimuth) 38 bool DistantLightSource::setAzimuth(float azimuth)
53 { 39 {
54 if (m_azimuth == azimuth) 40 if (m_azimuth == azimuth)
55 return false; 41 return false;
56 m_azimuth = azimuth; 42 m_azimuth = azimuth;
57 return true; 43 return true;
58 } 44 }
59 45
60 bool DistantLightSource::setElevation(float elevation) 46 bool DistantLightSource::setElevation(float elevation)
61 { 47 {
62 if (m_elevation == elevation) 48 if (m_elevation == elevation)
63 return false; 49 return false;
64 m_elevation = elevation; 50 m_elevation = elevation;
65 return true; 51 return true;
66 } 52 }
67 53
68 TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const 54 TextStream& DistantLightSource::externalRepresentation(TextStream& ts) const
69 { 55 {
70 ts << "[type=DISTANT-LIGHT] "; 56 ts << "[type=DISTANT-LIGHT] ";
71 ts << "[azimuth=\"" << azimuth() << "\"]"; 57 ts << "[azimuth=\"" << azimuth() << "\"]";
72 ts << "[elevation=\"" << elevation() << "\"]"; 58 ts << "[elevation=\"" << elevation() << "\"]";
73 return ts; 59 return ts;
74 } 60 }
75 61
76 } // namespace blink 62 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/DistantLightSource.h ('k') | Source/platform/graphics/filters/LightSource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698