| OLD | NEW |
| 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 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org> | 6 * Copyright (C) 2010 Zoltan Herczeg <zherczeg@webkit.org> |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 enum LightType { | 34 enum LightType { |
| 35 LS_DISTANT, | 35 LS_DISTANT, |
| 36 LS_POINT, | 36 LS_POINT, |
| 37 LS_SPOT | 37 LS_SPOT |
| 38 }; | 38 }; |
| 39 | 39 |
| 40 class TextStream; | 40 class TextStream; |
| 41 | 41 |
| 42 class PLATFORM_EXPORT LightSource : public RefCounted<LightSource> { | 42 class PLATFORM_EXPORT LightSource : public RefCounted<LightSource> { |
| 43 public: | 43 public: |
| 44 | |
| 45 // Light vectors must be calculated for every pixel during | |
| 46 // painting. It is expensive to pass all these arguments to | |
| 47 // a frequently called function, especially because not all | |
| 48 // light sources require all of them. Instead, we just pass | |
| 49 // a reference to the following structure | |
| 50 struct PaintingData { | |
| 51 // SVGFELighting also use them | |
| 52 FloatPoint3D lightVector; | |
| 53 FloatPoint3D colorVector; | |
| 54 float lightVectorLength; | |
| 55 // Private members | |
| 56 FloatPoint3D directionVector; | |
| 57 FloatPoint3D privateColorVector; | |
| 58 float coneCutOffLimit; | |
| 59 float coneFullLight; | |
| 60 }; | |
| 61 | |
| 62 LightSource(LightType type) | 44 LightSource(LightType type) |
| 63 : m_type(type) | 45 : m_type(type) |
| 64 { } | 46 { } |
| 65 | 47 |
| 66 virtual ~LightSource(); | 48 virtual ~LightSource(); |
| 67 | 49 |
| 68 LightType type() const { return m_type; } | 50 LightType type() const { return m_type; } |
| 69 virtual TextStream& externalRepresentation(TextStream&) const = 0; | 51 virtual TextStream& externalRepresentation(TextStream&) const = 0; |
| 70 | 52 |
| 71 virtual PassRefPtr<LightSource> create(const FloatPoint3D& scale, const Floa
tSize& offset) const = 0; | 53 virtual PassRefPtr<LightSource> create(const FloatPoint3D& scale, const Floa
tSize& offset) const = 0; |
| 72 | 54 |
| 73 virtual void initPaintingData(PaintingData&) const = 0; | |
| 74 // z is a float number, since it is the alpha value scaled by a user | |
| 75 // specified "surfaceScale" constant, which type is <number> in the SVG stan
dard | |
| 76 virtual void updatePaintingData(PaintingData&, int x, int y, float z) const
= 0; | |
| 77 | |
| 78 virtual bool setAzimuth(float) { return false; } | 55 virtual bool setAzimuth(float) { return false; } |
| 79 virtual bool setElevation(float) { return false; } | 56 virtual bool setElevation(float) { return false; } |
| 80 virtual bool setPosition(const FloatPoint3D&) { return false; } | 57 virtual bool setPosition(const FloatPoint3D&) { return false; } |
| 81 virtual bool setPointsAt(const FloatPoint3D&) { return false; } | 58 virtual bool setPointsAt(const FloatPoint3D&) { return false; } |
| 82 virtual bool setSpecularExponent(float) { return false; } | 59 virtual bool setSpecularExponent(float) { return false; } |
| 83 virtual bool setLimitingConeAngle(float) { return false; } | 60 virtual bool setLimitingConeAngle(float) { return false; } |
| 84 | 61 |
| 85 private: | 62 private: |
| 86 LightType m_type; | 63 LightType m_type; |
| 87 }; | 64 }; |
| 88 | 65 |
| 89 } // namespace blink | 66 } // namespace blink |
| 90 | 67 |
| 91 #endif // LightSource_h | 68 #endif // LightSource_h |
| OLD | NEW |