Home | History | Annotate | Download | only in filters
      1 /*
      2  * Copyright (C) 2004, 2005, 2006, 2007 Nikolas Zimmermann <zimmermann (at) kde.org>
      3  * Copyright (C) 2004, 2005 Rob Buis <buis (at) kde.org>
      4  * Copyright (C) 2005 Eric Seidel <eric (at) webkit.org>
      5  * Copyright (C) 2010 Zoltan Herczeg <zherczeg (at) webkit.org>
      6  * Copyright (C) 2011 Renata Hodovan <reni (at) webkit.org>, University of Szeged.
      7  *
      8  * This library is free software; you can redistribute it and/or
      9  * modify it under the terms of the GNU Library General Public
     10  * License as published by the Free Software Foundation; either
     11  * version 2 of the License, or (at your option) any later version.
     12  *
     13  * This library is distributed in the hope that it will be useful,
     14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     16  * Library General Public License for more details.
     17  *
     18  * You should have received a copy of the GNU Library General Public License
     19  * along with this library; see the file COPYING.LIB.  If not, write to
     20  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     21  * Boston, MA 02110-1301, USA.
     22  */
     23 
     24 #include "config.h"
     25 
     26 #if ENABLE(FILTERS)
     27 #include "LightSource.h"
     28 
     29 #include "DistantLightSource.h"
     30 #include "PointLightSource.h"
     31 #include "RenderTreeAsText.h"
     32 #include "SpotLightSource.h"
     33 #include <wtf/MathExtras.h>
     34 
     35 namespace WebCore {
     36 
     37 bool LightSource::setAzimuth(float azimuth)
     38 {
     39     if (m_type == LS_DISTANT)
     40         return static_cast<DistantLightSource*>(this)->setAzimuth(azimuth);
     41     return false;
     42 }
     43 
     44 bool LightSource::setElevation(float elevation)
     45 {
     46     if (m_type == LS_DISTANT)
     47         return static_cast<DistantLightSource*>(this)->setElevation(elevation);
     48     return false;
     49 }
     50 
     51 bool LightSource::setX(float x)
     52 {
     53     if (m_type == LS_SPOT)
     54         return static_cast<SpotLightSource*>(this)->setX(x);
     55     if (m_type == LS_POINT)
     56         return static_cast<PointLightSource*>(this)->setX(x);
     57     return false;
     58 }
     59 
     60 bool LightSource::setY(float y)
     61 {
     62     if (m_type == LS_SPOT)
     63         return static_cast<SpotLightSource*>(this)->setY(y);
     64     if (m_type == LS_POINT)
     65         return static_cast<PointLightSource*>(this)->setY(y);
     66     return false;
     67 }
     68 
     69 bool LightSource::setZ(float z)
     70 {
     71     if (m_type == LS_SPOT)
     72         return static_cast<SpotLightSource*>(this)->setZ(z);
     73     if (m_type == LS_POINT)
     74         return static_cast<PointLightSource*>(this)->setZ(z);
     75     return false;
     76 }
     77 
     78 bool LightSource::setPointsAtX(float pointsAtX)
     79 {
     80     if (m_type == LS_SPOT)
     81         return static_cast<SpotLightSource*>(this)->setPointsAtX(pointsAtX);
     82     return false;
     83 }
     84 
     85 bool LightSource::setPointsAtY(float pointsAtY)
     86 {
     87     if (m_type == LS_SPOT)
     88         return static_cast<SpotLightSource*>(this)->setPointsAtY(pointsAtY);
     89     return false;
     90 }
     91 
     92 bool LightSource::setPointsAtZ(float pointsAtZ)
     93 {
     94     if (m_type == LS_SPOT)
     95         return static_cast<SpotLightSource*>(this)->setPointsAtZ(pointsAtZ);
     96     return false;
     97 }
     98 
     99 bool LightSource::setSpecularExponent(float specularExponent)
    100 {
    101     if (m_type == LS_SPOT)
    102         return static_cast<SpotLightSource*>(this)->setSpecularExponent(specularExponent);
    103     return false;
    104 }
    105 
    106 bool LightSource::setLimitingConeAngle(float limitingConeAngle)
    107 {
    108     if (m_type == LS_SPOT)
    109         return static_cast<SpotLightSource*>(this)->setLimitingConeAngle(limitingConeAngle);
    110     return false;
    111 }
    112 
    113 } // namespace WebCore
    114 
    115 #endif // ENABLE(FILTERS)
    116