Home | History | Annotate | Download | only in wince
      1 /*
      2  *  Copyright (C) 2007-2009 Torch Mobile, Inc.
      3  *
      4  *  This library is free software; you can redistribute it and/or
      5  *  modify it under the terms of the GNU Library General Public
      6  *  License as published by the Free Software Foundation; either
      7  *  version 2 of the License, or (at your option) any later version.
      8  *
      9  *  This library is distributed in the hope that it will be useful,
     10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
     11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     12  *  Library General Public License for more details.
     13  *
     14  *  You should have received a copy of the GNU Library General Public License
     15  *  along with this library; see the file COPYING.LIB.  If not, write to
     16  *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     17  *  Boston, MA 02110-1301, USA.
     18  */
     19 
     20 #include "config.h"
     21 #include "Path.h"
     22 
     23 #include "AffineTransform.h"
     24 #include "FloatRect.h"
     25 #include "NotImplemented.h"
     26 #include "PlatformPathWince.h"
     27 #include "PlatformString.h"
     28 #include <wtf/OwnPtr.h>
     29 
     30 namespace WebCore {
     31 
     32 Path::Path()
     33     : m_path(new PlatformPath())
     34 {
     35 }
     36 
     37 Path::Path(const Path& other)
     38     : m_path(new PlatformPath(*other.m_path))
     39 {
     40 }
     41 
     42 Path::~Path()
     43 {
     44     delete m_path;
     45 }
     46 
     47 Path& Path::operator=(const Path& other)
     48 {
     49     if (&other != this) {
     50         delete m_path;
     51         m_path = new PlatformPath(*other.m_path);
     52     }
     53     return *this;
     54 }
     55 
     56 bool Path::contains(const FloatPoint& point, WindRule rule) const
     57 {
     58     return m_path->contains(point, rule);
     59 }
     60 
     61 void Path::translate(const FloatSize& size)
     62 {
     63     m_path->translate(size);
     64 }
     65 
     66 FloatRect Path::boundingRect() const
     67 {
     68     return m_path->boundingRect();
     69 }
     70 
     71 void Path::moveTo(const FloatPoint& point)
     72 {
     73     m_path->moveTo(point);
     74 }
     75 
     76 void Path::addLineTo(const FloatPoint& point)
     77 {
     78     m_path->addLineTo(point);
     79 }
     80 
     81 void Path::addQuadCurveTo(const FloatPoint& cp, const FloatPoint& p)
     82 {
     83     m_path->addQuadCurveTo(cp, p);
     84 }
     85 
     86 void Path::addBezierCurveTo(const FloatPoint& cp1, const FloatPoint& cp2, const FloatPoint& p)
     87 {
     88     m_path->addBezierCurveTo(cp1, cp2, p);
     89 }
     90 
     91 void Path::addArcTo(const FloatPoint& p1, const FloatPoint& p2, float radius)
     92 {
     93     m_path->addArcTo(p1, p2, radius);
     94 }
     95 
     96 void Path::closeSubpath()
     97 {
     98     m_path->closeSubpath();
     99 }
    100 
    101 void Path::addArc(const FloatPoint& p, float r, float sar, float ear, bool anticlockwise)
    102 {
    103     m_path->addEllipse(p, r, r, sar, ear, anticlockwise);
    104 }
    105 
    106 void Path::addRect(const FloatRect& r)
    107 {
    108     m_path->addRect(r);
    109 }
    110 
    111 void Path::addEllipse(const FloatRect& r)
    112 {
    113     m_path->addEllipse(r);
    114 }
    115 
    116 void Path::clear()
    117 {
    118     m_path->clear();
    119 }
    120 
    121 bool Path::isEmpty() const
    122 {
    123     return m_path->isEmpty();
    124 }
    125 
    126 String Path::debugString() const
    127 {
    128     return m_path->debugString();
    129 }
    130 
    131 void Path::apply(void* info, PathApplierFunction function) const
    132 {
    133     m_path->apply(info, function);
    134 }
    135 
    136 void Path::transform(const AffineTransform& t)
    137 {
    138     m_path->transform(t);
    139 }
    140 
    141 FloatRect Path::strokeBoundingRect(StrokeStyleApplier *)
    142 {
    143     notImplemented();
    144     return FloatRect();
    145 }
    146 
    147 bool Path::strokeContains(StrokeStyleApplier*, const FloatPoint&) const
    148 {
    149     notImplemented();
    150     return false;
    151 }
    152 
    153 bool Path::hasCurrentPoint() const
    154 {
    155     // Not sure if this is correct. At the meantime, we do what other ports
    156     // do.
    157     // See https://bugs.webkit.org/show_bug.cgi?id=27266,
    158     // https://bugs.webkit.org/show_bug.cgi?id=27187, and
    159     // http://trac.webkit.org/changeset/45873
    160     return !isEmpty();
    161 }
    162 
    163 }
    164