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

Side by Side Diff: Source/platform/graphics/filters/SpotLightSource.h

Issue 181943003: Scaling and offset fix for FELighting (software and skia paths) (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Changed fix to temporary light creation Created 6 years, 9 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) 2008 Alex Mathews <possessedpenguinbob@gmail.com> 2 * Copyright (C) 2008 Alex Mathews <possessedpenguinbob@gmail.com>
3 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org> 3 * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann@kde.org>
4 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org> 4 * Copyright (C) 2004, 2005 Rob Buis <buis@kde.org>
5 * Copyright (C) 2005 Eric Seidel <eric@webkit.org> 5 * Copyright (C) 2005 Eric Seidel <eric@webkit.org>
6 * 6 *
7 * This library is free software; you can redistribute it and/or 7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public 8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either 9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version. 10 * version 2 of the License, or (at your option) any later version.
(...skipping 17 matching lines...) Expand all
28 namespace WebCore { 28 namespace WebCore {
29 29
30 class PLATFORM_EXPORT SpotLightSource : public LightSource { 30 class PLATFORM_EXPORT SpotLightSource : public LightSource {
31 public: 31 public:
32 static PassRefPtr<SpotLightSource> create(const FloatPoint3D& position, 32 static PassRefPtr<SpotLightSource> create(const FloatPoint3D& position,
33 const FloatPoint3D& direction, float specularExponent, float limitingCon eAngle) 33 const FloatPoint3D& direction, float specularExponent, float limitingCon eAngle)
34 { 34 {
35 return adoptRef(new SpotLightSource(position, direction, specularExponen t, limitingConeAngle)); 35 return adoptRef(new SpotLightSource(position, direction, specularExponen t, limitingConeAngle));
36 } 36 }
37 37
38 virtual PassRefPtr<LightSource> create(const FloatPoint3D& scale, const Floa tSize& offset) const OVERRIDE
39 {
40 FloatPoint3D position(m_position.x() * scale.x() - offset.width(), m_pos ition.y() * scale.y() - offset.height(), m_position.z() * scale.z());
41 FloatPoint3D direction(m_direction.x() * scale.x() - offset.width(), m_d irection.y() * scale.y() - offset.height(), m_direction.z() * scale.z());
42 return adoptRef(new SpotLightSource(position, direction, m_specularExpon ent, m_limitingConeAngle));
43 }
44
38 const FloatPoint3D& position() const { return m_position; } 45 const FloatPoint3D& position() const { return m_position; }
39 const FloatPoint3D& direction() const { return m_direction; } 46 const FloatPoint3D& direction() const { return m_direction; }
40 float specularExponent() const { return m_specularExponent; } 47 float specularExponent() const { return m_specularExponent; }
41 float limitingConeAngle() const { return m_limitingConeAngle; } 48 float limitingConeAngle() const { return m_limitingConeAngle; }
42 49
43 virtual bool setX(float) OVERRIDE; 50 virtual bool setX(float) OVERRIDE;
44 virtual bool setY(float) OVERRIDE; 51 virtual bool setY(float) OVERRIDE;
45 virtual bool setZ(float) OVERRIDE; 52 virtual bool setZ(float) OVERRIDE;
46 virtual bool setPointsAtX(float) OVERRIDE; 53 virtual bool setPointsAtX(float) OVERRIDE;
47 virtual bool setPointsAtY(float) OVERRIDE; 54 virtual bool setPointsAtY(float) OVERRIDE;
48 virtual bool setPointsAtZ(float) OVERRIDE; 55 virtual bool setPointsAtZ(float) OVERRIDE;
49 56
50 virtual bool setSpecularExponent(float) OVERRIDE; 57 virtual bool setSpecularExponent(float) OVERRIDE;
51 virtual bool setLimitingConeAngle(float) OVERRIDE; 58 virtual bool setLimitingConeAngle(float) OVERRIDE;
52 59
53 virtual void initPaintingData(PaintingData&) OVERRIDE; 60 virtual void initPaintingData(PaintingData&) const OVERRIDE;
54 virtual void updatePaintingData(PaintingData&, int x, int y, float z) OVERRI DE; 61 virtual void updatePaintingData(PaintingData&, int x, int y, float z) const OVERRIDE;
55 62
56 virtual TextStream& externalRepresentation(TextStream&) const OVERRIDE; 63 virtual TextStream& externalRepresentation(TextStream&) const OVERRIDE;
57 64
58 private: 65 private:
59 SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction, 66 SpotLightSource(const FloatPoint3D& position, const FloatPoint3D& direction,
60 float specularExponent, float limitingConeAngle) 67 float specularExponent, float limitingConeAngle)
61 : LightSource(LS_SPOT) 68 : LightSource(LS_SPOT)
62 , m_position(position) 69 , m_position(position)
63 , m_direction(direction) 70 , m_direction(direction)
64 , m_specularExponent(specularExponent) 71 , m_specularExponent(specularExponent)
65 , m_limitingConeAngle(limitingConeAngle) 72 , m_limitingConeAngle(limitingConeAngle)
66 { 73 {
67 } 74 }
68 75
69 FloatPoint3D m_position; 76 FloatPoint3D m_position;
70 FloatPoint3D m_direction; 77 FloatPoint3D m_direction;
71 78
72 float m_specularExponent; 79 float m_specularExponent;
73 float m_limitingConeAngle; 80 float m_limitingConeAngle;
74 }; 81 };
75 82
76 } // namespace WebCore 83 } // namespace WebCore
77 84
78 #endif // SpotLightSource_h 85 #endif // SpotLightSource_h
OLDNEW
« no previous file with comments | « Source/platform/graphics/filters/PointLightSource.cpp ('k') | Source/platform/graphics/filters/SpotLightSource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698