| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2009 Apple Inc. All rights reserved. |
| 3 * 2006 Rob Buis <buis@kde.org> | 3 * 2006 Rob Buis <buis@kde.org> |
| 4 * Copyright (C) 2007-2008 Torch Mobile, Inc. | 4 * Copyright (C) 2007-2008 Torch Mobile, Inc. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #ifndef Path_h | 28 #ifndef Path_h |
| 29 #define Path_h | 29 #define Path_h |
| 30 | 30 |
| 31 #include "RoundedRect.h" | 31 #include "RoundedRect.h" |
| 32 #include "WindRule.h" | 32 #include "WindRule.h" |
| 33 #include <wtf/FastAllocBase.h> | 33 #include <wtf/FastAllocBase.h> |
| 34 #include <wtf/Forward.h> | 34 #include <wtf/Forward.h> |
| 35 | 35 |
| 36 #if USE(CG) | 36 #if USE(CG) |
| 37 typedef struct CGPath PlatformPath; | 37 typedef struct CGPath PlatformPath; |
| 38 #elif PLATFORM(OPENVG) | |
| 39 namespace WebCore { | |
| 40 class PlatformPathOpenVG; | |
| 41 } | |
| 42 typedef WebCore::PlatformPathOpenVG PlatformPath; | |
| 43 #elif PLATFORM(QT) | |
| 44 #include <qpainterpath.h> | |
| 45 typedef QPainterPath PlatformPath; | |
| 46 #elif USE(SKIA) | 38 #elif USE(SKIA) |
| 47 class SkPath; | 39 class SkPath; |
| 48 typedef SkPath PlatformPath; | 40 typedef SkPath PlatformPath; |
| 49 #elif OS(WINCE) | 41 #elif OS(WINCE) |
| 50 namespace WebCore { | 42 namespace WebCore { |
| 51 class PlatformPath; | 43 class PlatformPath; |
| 52 } | 44 } |
| 53 typedef WebCore::PlatformPath PlatformPath; | 45 typedef WebCore::PlatformPath PlatformPath; |
| 54 #else | 46 #else |
| 55 typedef void PlatformPath; | 47 typedef void PlatformPath; |
| 56 #endif | 48 #endif |
| 57 | 49 |
| 58 #if PLATFORM(QT) | |
| 59 /* QPainterPath is valued based */ | |
| 60 typedef PlatformPath PlatformPathPtr; | |
| 61 #else | |
| 62 typedef PlatformPath* PlatformPathPtr; | 50 typedef PlatformPath* PlatformPathPtr; |
| 63 #endif | |
| 64 | 51 |
| 65 namespace WebCore { | 52 namespace WebCore { |
| 66 | 53 |
| 67 class AffineTransform; | 54 class AffineTransform; |
| 68 class FloatPoint; | 55 class FloatPoint; |
| 69 class FloatRect; | 56 class FloatRect; |
| 70 class FloatSize; | 57 class FloatSize; |
| 71 class GraphicsContext; | 58 class GraphicsContext; |
| 72 class StrokeStyleApplier; | 59 class StrokeStyleApplier; |
| 73 | 60 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 104 // should perfectly bound the points within the path. | 91 // should perfectly bound the points within the path. |
| 105 FloatRect boundingRect() const; | 92 FloatRect boundingRect() const; |
| 106 FloatRect fastBoundingRect() const; | 93 FloatRect fastBoundingRect() const; |
| 107 FloatRect strokeBoundingRect(StrokeStyleApplier* = 0) const; | 94 FloatRect strokeBoundingRect(StrokeStyleApplier* = 0) const; |
| 108 | 95 |
| 109 float length() const; | 96 float length() const; |
| 110 FloatPoint pointAtLength(float length, bool& ok) const; | 97 FloatPoint pointAtLength(float length, bool& ok) const; |
| 111 float normalAngleAtLength(float length, bool& ok) const; | 98 float normalAngleAtLength(float length, bool& ok) const; |
| 112 | 99 |
| 113 void clear(); | 100 void clear(); |
| 114 #if PLATFORM(QT) | |
| 115 bool isNull() const { return false; } | |
| 116 #else | |
| 117 bool isNull() const { return !m_path; } | 101 bool isNull() const { return !m_path; } |
| 118 #endif | |
| 119 bool isEmpty() const; | 102 bool isEmpty() const; |
| 120 // Gets the current point of the current path, which is conceptually the
final point reached by the path so far. | 103 // Gets the current point of the current path, which is conceptually the
final point reached by the path so far. |
| 121 // Note the Path can be empty (isEmpty() == true) and still have a curre
nt point. | 104 // Note the Path can be empty (isEmpty() == true) and still have a curre
nt point. |
| 122 bool hasCurrentPoint() const; | 105 bool hasCurrentPoint() const; |
| 123 FloatPoint currentPoint() const; | 106 FloatPoint currentPoint() const; |
| 124 | 107 |
| 125 void moveTo(const FloatPoint&); | 108 void moveTo(const FloatPoint&); |
| 126 void addLineTo(const FloatPoint&); | 109 void addLineTo(const FloatPoint&); |
| 127 void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& en
dPoint); | 110 void addQuadCurveTo(const FloatPoint& controlPoint, const FloatPoint& en
dPoint); |
| 128 void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint&
controlPoint2, const FloatPoint& endPoint); | 111 void addBezierCurveTo(const FloatPoint& controlPoint1, const FloatPoint&
controlPoint2, const FloatPoint& endPoint); |
| 129 void addArcTo(const FloatPoint&, const FloatPoint&, float radius); | 112 void addArcTo(const FloatPoint&, const FloatPoint&, float radius); |
| 130 void closeSubpath(); | 113 void closeSubpath(); |
| 131 | 114 |
| 132 void addArc(const FloatPoint&, float radius, float startAngle, float end
Angle, bool anticlockwise); | 115 void addArc(const FloatPoint&, float radius, float startAngle, float end
Angle, bool anticlockwise); |
| 133 void addRect(const FloatRect&); | 116 void addRect(const FloatRect&); |
| 134 void addEllipse(const FloatRect&); | 117 void addEllipse(const FloatRect&); |
| 135 | 118 |
| 136 enum RoundedRectStrategy { | 119 enum RoundedRectStrategy { |
| 137 PreferNativeRoundedRect, | 120 PreferNativeRoundedRect, |
| 138 PreferBezierRoundedRect | 121 PreferBezierRoundedRect |
| 139 }; | 122 }; |
| 140 | 123 |
| 141 void addRoundedRect(const FloatRect&, const FloatSize& roundingRadii, Ro
undedRectStrategy = PreferNativeRoundedRect); | 124 void addRoundedRect(const FloatRect&, const FloatSize& roundingRadii, Ro
undedRectStrategy = PreferNativeRoundedRect); |
| 142 void addRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, co
nst FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSiz
e& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect); | 125 void addRoundedRect(const FloatRect&, const FloatSize& topLeftRadius, co
nst FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const FloatSiz
e& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect); |
| 143 void addRoundedRect(const RoundedRect&); | 126 void addRoundedRect(const RoundedRect&); |
| 144 | 127 |
| 145 void translate(const FloatSize&); | 128 void translate(const FloatSize&); |
| 146 | 129 |
| 147 // To keep Path() cheap, it does not allocate a PlatformPath immediately | 130 // To keep Path() cheap, it does not allocate a PlatformPath immediately |
| 148 // meaning Path::platformPath() can return null (except on Qt). | 131 // meaning Path::platformPath() can return null. |
| 149 PlatformPathPtr platformPath() const { return m_path; } | 132 PlatformPathPtr platformPath() const { return m_path; } |
| 150 #if PLATFORM(QT) | |
| 151 PlatformPathPtr ensurePlatformPath() { return platformPath(); } | |
| 152 #else | |
| 153 // ensurePlatformPath() will allocate a PlatformPath if it has not yet b
een and will never return null. | 133 // ensurePlatformPath() will allocate a PlatformPath if it has not yet b
een and will never return null. |
| 154 PlatformPathPtr ensurePlatformPath(); | 134 PlatformPathPtr ensurePlatformPath(); |
| 155 #endif | |
| 156 | 135 |
| 157 void apply(void* info, PathApplierFunction) const; | 136 void apply(void* info, PathApplierFunction) const; |
| 158 void transform(const AffineTransform&); | 137 void transform(const AffineTransform&); |
| 159 | 138 |
| 160 void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRad
ius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const F
loatSize& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect); | 139 void addPathForRoundedRect(const FloatRect&, const FloatSize& topLeftRad
ius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, const F
loatSize& bottomRightRadius, RoundedRectStrategy = PreferNativeRoundedRect); |
| 161 void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeft
Radius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, cons
t FloatSize& bottomRightRadius); | 140 void addBeziersForRoundedRect(const FloatRect&, const FloatSize& topLeft
Radius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius, cons
t FloatSize& bottomRightRadius); |
| 162 | 141 |
| 163 #if USE(CG) | 142 #if USE(CG) |
| 164 void platformAddPathForRoundedRect(const FloatRect&, const FloatSize& to
pLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius,
const FloatSize& bottomRightRadius); | 143 void platformAddPathForRoundedRect(const FloatRect&, const FloatSize& to
pLeftRadius, const FloatSize& topRightRadius, const FloatSize& bottomLeftRadius,
const FloatSize& bottomRightRadius); |
| 165 #endif | 144 #endif |
| 166 | 145 |
| 167 #if PLATFORM(BLACKBERRY) | |
| 168 Path(const SkPath&); | |
| 169 #endif | |
| 170 | |
| 171 private: | 146 private: |
| 172 PlatformPathPtr m_path; | 147 PlatformPathPtr m_path; |
| 173 }; | 148 }; |
| 174 | 149 |
| 175 } | 150 } |
| 176 | 151 |
| 177 #endif | 152 #endif |
| OLD | NEW |