[webkit-changes] cvs commit: SVGSupport/ksvg2/svg
SVGCircleElementImpl.cpp SVGCircleElementImpl.h
SVGClipPathElementImpl.cpp SVGEllipseElementImpl.cpp
SVGEllipseElementImpl.h SVGImageElementImpl.cpp
SVGLineElementImpl.cpp SVGLineElementImpl.h
SVGPathElementImpl.cpp SVGPathElementImpl.h
SVGPolygonElementImpl.cpp SVGPolygonElementImpl.h
SVGPolylineElementImpl.cpp SVGPolylineElementImpl.h
SVGRectElementImpl.cpp SVGRectElementImpl.h
SVGStyledElementImpl.cpp SVGStyledElementImpl.h
Eric
eseidel at opensource.apple.com
Mon Dec 5 17:23:28 PST 2005
eseidel 05/12/05 17:23:28
Modified: . ChangeLog
WebCore.xcodeproj project.pbxproj
kcanvas KCanvasCreator.cpp KCanvasCreator.h KCanvasItem.cpp
KCanvasItem.h KCanvasMatrix.cpp KCanvasMatrix.h
KCanvasPath.cpp KCanvasPath.h KCanvasResources.cpp
KCanvasResources.h KCanvasTypes.h
kcanvas/device KRenderingDevice.cpp KRenderingDevice.h
kcanvas/device/quartz KCanvasItemQuartz.mm
KCanvasResourcesQuartz.mm KRenderingDeviceQuartz.h
KRenderingDeviceQuartz.mm QuartzSupport.h
QuartzSupport.mm
ksvg2/svg SVGCircleElementImpl.cpp SVGCircleElementImpl.h
SVGClipPathElementImpl.cpp
SVGEllipseElementImpl.cpp SVGEllipseElementImpl.h
SVGImageElementImpl.cpp SVGLineElementImpl.cpp
SVGLineElementImpl.h SVGPathElementImpl.cpp
SVGPathElementImpl.h SVGPolygonElementImpl.cpp
SVGPolygonElementImpl.h SVGPolylineElementImpl.cpp
SVGPolylineElementImpl.h SVGRectElementImpl.cpp
SVGRectElementImpl.h SVGStyledElementImpl.cpp
SVGStyledElementImpl.h
Added: kcanvas/device/quartz KCanvasPathQuartz.h
KCanvasPathQuartz.mm
Log:
Bug #: 5747
Submitted by: eseidel
Reviewed by: timo
5 test cases updated, no additional tests needed.
Removed KCPathData, KCPathDataList and KCanvasUserData.
Added KCanvasPath and KCanvasPathQuartz instead.
Updated methods to expect KCanvasPath* types and use RefPtr.
Removed no longer needed KCPathDataList -> KCanvasUserData routines
http://bugzilla.opendarwin.org/show_bug.cgi?id=5747
* WebCore.xcodeproj/project.pbxproj: added KCanvasPath(Quartz)
* kcanvas/KCanvasCreator.cpp:
(KCanvasCreator::createRoundedRectangle): updated to KCanvasPath*
(KCanvasCreator::createRectangle): updated to KCanvasPath*
(KCanvasCreator::createEllipse): updated to KCanvasPath*
(KCanvasCreator::createCircle): updated to KCanvasPath*
(KCanvasCreator::createLine): updated to KCanvasPath*
* kcanvas/KCanvasCreator.h:
* kcanvas/KCanvasItem.cpp:
(RenderPath::Private::Private): updated to KCanvasPath*
(RenderPath::~RenderPath):
(RenderPath::changePath):
(RenderPath::path): updated to KCanvasPath*
* kcanvas/KCanvasItem.h:
* kcanvas/KCanvasMatrix.cpp:
* kcanvas/KCanvasMatrix.h:
* kcanvas/KCanvasPath.cpp:
(operator<<): updated to call device->stringForPath()
* kcanvas/KCanvasPath.h:
(KCanvasPath::~KCanvasPath):
(KCClipDataList::addPath): updated to KCanvasPath*
* kcanvas/KCanvasResources.cpp:
(KCanvasClipper::addClipData): updated to KCanvasPath*
* kcanvas/KCanvasResources.h:
* kcanvas/KCanvasTypes.h:
* kcanvas/device/KRenderingDevice.cpp:
(KCanvasCommonArgs::path): updated to KCanvasPath*
(KCanvasCommonArgs::setPath): updated to KCanvasPath*
(KRenderingDevice::KRenderingDevice):
* kcanvas/device/KRenderingDevice.h:
* kcanvas/device/quartz/KCanvasItemQuartz.mm:
(KCanvasItemQuartz::paint): updated to KCanvasPath*
(KCanvasItemQuartz::bboxForPath): updated to KCanvasPath*
(KCanvasItemQuartz::hitsPath): updated to KCanvasPath*
* kcanvas/device/quartz/KCanvasPathQuartz.h: Added.
(KCanvasPathQuartz::cgPath): updated to KCanvasPath*
* kcanvas/device/quartz/KCanvasPathQuartz.mm: Added.
(KCanvasPathQuartz::KCanvasPathQuartz): added
(KCanvasPathQuartz::~KCanvasPathQuartz): added
(KCanvasPathQuartz::isEmpty): added
(KCanvasPathQuartz::moveTo): added
(KCanvasPathQuartz::lineTo): added
(KCanvasPathQuartz::curveTo): added
(KCanvasPathQuartz::closeSubpath): added
* kcanvas/device/quartz/KCanvasResourcesQuartz.mm:
(KCanvasClipperQuartz::applyClip): updated to KCanvasPath*
* kcanvas/device/quartz/KRenderingDeviceQuartz.h:
* kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
(KRenderingDeviceQuartz::createPath): added
(KRenderingDeviceQuartz::stringForPath): updated to KCanvasPath*
(KRenderingDeviceQuartz::createItem): updated to KCanvasPath*
* kcanvas/device/quartz/QuartzSupport.h:
* kcanvas/device/quartz/QuartzSupport.mm:
* ksvg2/svg/SVGCircleElementImpl.cpp:
(SVGCircleElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGCircleElementImpl.h:
* ksvg2/svg/SVGClipPathElementImpl.cpp:
(SVGClipPathElementImpl::canvasResource): updated to KCanvasPath*
* ksvg2/svg/SVGEllipseElementImpl.cpp:
(KSVG::SVGEllipseElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGEllipseElementImpl.h:
* ksvg2/svg/SVGImageElementImpl.cpp:
(SVGImageElementImpl::createRenderer): updated to KCanvasPath*
* ksvg2/svg/SVGLineElementImpl.cpp:
(SVGLineElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGLineElementImpl.h:
* ksvg2/svg/SVGPathElementImpl.cpp:
(KSVG::SVGPathElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGPathElementImpl.h:
* ksvg2/svg/SVGPolygonElementImpl.cpp:
(SVGPolygonElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGPolygonElementImpl.h:
* ksvg2/svg/SVGPolylineElementImpl.cpp:
(SVGPolylineElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGPolylineElementImpl.h:
* ksvg2/svg/SVGRectElementImpl.cpp:
(SVGRectElementImpl::toPathData): updated to KCanvasPath*
* ksvg2/svg/SVGRectElementImpl.h:
* ksvg2/svg/SVGStyledElementImpl.cpp:
(SVGStyledElementImpl::createRenderer): updated to KCanvasPath*
(SVGStyledElementImpl::updateCanvasItem): updated to KCanvasPath*
(SVGStyledElementImpl::pushAttributeContext):
* ksvg2/svg/SVGStyledElementImpl.h:
(KSVG::SVGStyledElementImpl::toPathData): updated to KCanvasPath*
Revision Changes Path
1.478 +97 -0 WebCore/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /cvs/root/WebCore/ChangeLog,v
retrieving revision 1.477
retrieving revision 1.478
diff -u -r1.477 -r1.478
--- ChangeLog 6 Dec 2005 01:10:31 -0000 1.477
+++ ChangeLog 6 Dec 2005 01:23:12 -0000 1.478
@@ -1,3 +1,100 @@
+2005-12-05 Eric Seidel <eseidel at apple.com>
+
+ Reviewed by timo.
+
+ 5 test cases updated, no additional tests needed.
+
+ Removed KCPathData, KCPathDataList and KCanvasUserData.
+ Added KCanvasPath and KCanvasPathQuartz instead.
+ Updated methods to expect KCanvasPath* types and use RefPtr.
+ Removed no longer needed KCPathDataList -> KCanvasUserData routines
+ http://bugzilla.opendarwin.org/show_bug.cgi?id=5747
+
+ * WebCore.xcodeproj/project.pbxproj: added KCanvasPath(Quartz)
+ * kcanvas/KCanvasCreator.cpp:
+ (KCanvasCreator::createRoundedRectangle): updated to KCanvasPath*
+ (KCanvasCreator::createRectangle): updated to KCanvasPath*
+ (KCanvasCreator::createEllipse): updated to KCanvasPath*
+ (KCanvasCreator::createCircle): updated to KCanvasPath*
+ (KCanvasCreator::createLine): updated to KCanvasPath*
+ * kcanvas/KCanvasCreator.h:
+ * kcanvas/KCanvasItem.cpp:
+ (RenderPath::Private::Private): updated to KCanvasPath*
+ (RenderPath::~RenderPath):
+ (RenderPath::changePath):
+ (RenderPath::path): updated to KCanvasPath*
+ * kcanvas/KCanvasItem.h:
+ * kcanvas/KCanvasMatrix.cpp:
+ * kcanvas/KCanvasMatrix.h:
+ * kcanvas/KCanvasPath.cpp:
+ (operator<<): updated to call device->stringForPath()
+ * kcanvas/KCanvasPath.h:
+ (KCanvasPath::~KCanvasPath):
+ (KCClipDataList::addPath): updated to KCanvasPath*
+ * kcanvas/KCanvasResources.cpp:
+ (KCanvasClipper::addClipData): updated to KCanvasPath*
+ * kcanvas/KCanvasResources.h:
+ * kcanvas/KCanvasTypes.h:
+ * kcanvas/device/KRenderingDevice.cpp:
+ (KCanvasCommonArgs::path): updated to KCanvasPath*
+ (KCanvasCommonArgs::setPath): updated to KCanvasPath*
+ (KRenderingDevice::KRenderingDevice):
+ * kcanvas/device/KRenderingDevice.h:
+ * kcanvas/device/quartz/KCanvasItemQuartz.mm:
+ (KCanvasItemQuartz::paint): updated to KCanvasPath*
+ (KCanvasItemQuartz::bboxForPath): updated to KCanvasPath*
+ (KCanvasItemQuartz::hitsPath): updated to KCanvasPath*
+ * kcanvas/device/quartz/KCanvasPathQuartz.h: Added.
+ (KCanvasPathQuartz::cgPath): updated to KCanvasPath*
+ * kcanvas/device/quartz/KCanvasPathQuartz.mm: Added.
+ (KCanvasPathQuartz::KCanvasPathQuartz): added
+ (KCanvasPathQuartz::~KCanvasPathQuartz): added
+ (KCanvasPathQuartz::isEmpty): added
+ (KCanvasPathQuartz::moveTo): added
+ (KCanvasPathQuartz::lineTo): added
+ (KCanvasPathQuartz::curveTo): added
+ (KCanvasPathQuartz::closeSubpath): added
+ * kcanvas/device/quartz/KCanvasResourcesQuartz.mm:
+ (KCanvasClipperQuartz::applyClip): updated to KCanvasPath*
+ * kcanvas/device/quartz/KRenderingDeviceQuartz.h:
+ * kcanvas/device/quartz/KRenderingDeviceQuartz.mm:
+ (KRenderingDeviceQuartz::createPath): added
+ (KRenderingDeviceQuartz::stringForPath): updated to KCanvasPath*
+ (KRenderingDeviceQuartz::createItem): updated to KCanvasPath*
+ * kcanvas/device/quartz/QuartzSupport.h:
+ * kcanvas/device/quartz/QuartzSupport.mm:
+ * ksvg2/svg/SVGCircleElementImpl.cpp:
+ (SVGCircleElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGCircleElementImpl.h:
+ * ksvg2/svg/SVGClipPathElementImpl.cpp:
+ (SVGClipPathElementImpl::canvasResource): updated to KCanvasPath*
+ * ksvg2/svg/SVGEllipseElementImpl.cpp:
+ (KSVG::SVGEllipseElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGEllipseElementImpl.h:
+ * ksvg2/svg/SVGImageElementImpl.cpp:
+ (SVGImageElementImpl::createRenderer): updated to KCanvasPath*
+ * ksvg2/svg/SVGLineElementImpl.cpp:
+ (SVGLineElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGLineElementImpl.h:
+ * ksvg2/svg/SVGPathElementImpl.cpp:
+ (KSVG::SVGPathElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGPathElementImpl.h:
+ * ksvg2/svg/SVGPolygonElementImpl.cpp:
+ (SVGPolygonElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGPolygonElementImpl.h:
+ * ksvg2/svg/SVGPolylineElementImpl.cpp:
+ (SVGPolylineElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGPolylineElementImpl.h:
+ * ksvg2/svg/SVGRectElementImpl.cpp:
+ (SVGRectElementImpl::toPathData): updated to KCanvasPath*
+ * ksvg2/svg/SVGRectElementImpl.h:
+ * ksvg2/svg/SVGStyledElementImpl.cpp:
+ (SVGStyledElementImpl::createRenderer): updated to KCanvasPath*
+ (SVGStyledElementImpl::updateCanvasItem): updated to KCanvasPath*
+ (SVGStyledElementImpl::pushAttributeContext):
+ * ksvg2/svg/SVGStyledElementImpl.h:
+ (KSVG::SVGStyledElementImpl::toPathData): updated to KCanvasPath*
+
2005-12-05 Darin Adler <darin at apple.com>
Reviewed by Eric.
1.51 +8 -0 WebCore/WebCore.xcodeproj/project.pbxproj
Index: project.pbxproj
===================================================================
RCS file: /cvs/root/WebCore/WebCore.xcodeproj/project.pbxproj,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -r1.50 -r1.51
--- project.pbxproj 4 Dec 2005 12:43:08 -0000 1.50
+++ project.pbxproj 6 Dec 2005 01:23:16 -0000 1.51
@@ -1238,6 +1238,8 @@
A890DF220930974800513F88 /* SVGStyledLocatableElementImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A890DF1E0930974800513F88 /* SVGStyledLocatableElementImpl.cpp */; };
A898F147088121E90075EFB2 /* htmlfactory.h in Headers */ = {isa = PBXBuildFile; fileRef = BCEF3433087B563E00BBF833 /* htmlfactory.h */; };
A898F148088121ED0075EFB2 /* htmlfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCEF3432087B563E00BBF833 /* htmlfactory.cpp */; };
+ A8ABC99B09445EC00013945F /* KCanvasPathQuartz.h in Headers */ = {isa = PBXBuildFile; fileRef = A8ABC99909445EC00013945F /* KCanvasPathQuartz.h */; };
+ A8ABC99C09445EC00013945F /* KCanvasPathQuartz.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8ABC99A09445EC00013945F /* KCanvasPathQuartz.mm */; };
A8BA5C70090CB077004D1180 /* render_button.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC42035A08FC334100B782E0 /* render_button.cpp */; };
A8BA5C71090CB07A004D1180 /* render_arena.h in Headers */ = {isa = PBXBuildFile; fileRef = 832557C3061E3172007B8054 /* render_arena.h */; };
A8BA5C72090CB07A004D1180 /* render_button.h in Headers */ = {isa = PBXBuildFile; fileRef = BC42035B08FC334100B782E0 /* render_button.h */; };
@@ -2214,6 +2216,8 @@
A890DF1C0930974800513F88 /* SVGStyledTransformableElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGStyledTransformableElementImpl.cpp; sourceTree = "<group>"; };
A890DF1D0930974800513F88 /* SVGStyledLocatableElementImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGStyledLocatableElementImpl.h; sourceTree = "<group>"; };
A890DF1E0930974800513F88 /* SVGStyledLocatableElementImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGStyledLocatableElementImpl.cpp; sourceTree = "<group>"; };
+ A8ABC99909445EC00013945F /* KCanvasPathQuartz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KCanvasPathQuartz.h; sourceTree = "<group>"; };
+ A8ABC99A09445EC00013945F /* KCanvasPathQuartz.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = KCanvasPathQuartz.mm; sourceTree = "<group>"; };
A8C0F6DD089701F100BA5114 /* DrawCanvasItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawCanvasItem.h; sourceTree = "<group>"; };
A8C0F6DE089701F100BA5114 /* DrawCanvasItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DrawCanvasItem.mm; sourceTree = "<group>"; };
A8C0F6DF089701F100BA5114 /* DrawCanvasItemPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawCanvasItemPrivate.h; sourceTree = "<group>"; };
@@ -3997,6 +4001,8 @@
A8C0FB75089701F800BA5114 /* KRenderingPaintServerQuartz.mm */,
A8C0FB76089701F800BA5114 /* QuartzSupport.h */,
A8C0FB77089701F800BA5114 /* QuartzSupport.mm */,
+ A8ABC99909445EC00013945F /* KCanvasPathQuartz.h */,
+ A8ABC99A09445EC00013945F /* KCanvasPathQuartz.mm */,
);
path = quartz;
sourceTree = "<group>";
@@ -5665,6 +5671,7 @@
A8C3296E093BB7B2000B9CAC /* SVGFESpotLightElementImpl.h in Headers */,
A8C32970093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.h in Headers */,
A8C32972093BB7B2000B9CAC /* SVGFEPointLightElementImpl.h in Headers */,
+ A8ABC99B09445EC00013945F /* KCanvasPathQuartz.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -7469,6 +7476,7 @@
A8C32971093BB7B2000B9CAC /* SVGFESpecularLightingElementImpl.cpp in Sources */,
A8C32973093BB7B2000B9CAC /* SVGFEPointLightElementImpl.cpp in Sources */,
A8C32D97093D8EA4000B9CAC /* XLinkNamesWrapper.cpp in Sources */,
+ A8ABC99C09445EC00013945F /* KCanvasPathQuartz.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
1.8 +41 -89 SVGSupport/kcanvas/KCanvasCreator.cpp
Index: KCanvasCreator.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasCreator.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- KCanvasCreator.cpp 21 Nov 2005 08:29:11 -0000 1.7
+++ KCanvasCreator.cpp 6 Dec 2005 01:23:18 -0000 1.8
@@ -51,12 +51,12 @@
return s_creator;
}
-KCPathDataList KCanvasCreator::createRoundedRectangle(float x, float y, float width, float height, float rx, float ry) const
+KCanvasPath* KCanvasCreator::createRoundedRectangle(float x, float y, float width, float height, float rx, float ry) const
{
- KCPathDataList list;
+ KCanvasPath* path = QPainter::renderingDevice()->createPath();
- if (width <= 0.0f || height <= 0.0f)
- return list;
+ if (width <= 0.0f || height <= 0.0f || !path)
+ return path;
double nrx = rx, nry = ry;
// If rx is greater than half of the width of the rectangle
@@ -69,52 +69,52 @@
if(nry > height / 2)
nry = height / 2;
- list.moveTo(x + nrx, y);
- list.curveTo(x + nrx * (1 - 0.552), y, x, y + nry * (1 - 0.552), x, y + nry);
+ path->moveTo(x + nrx, y);
+ path->curveTo(x + nrx * (1 - 0.552), y, x, y + nry * (1 - 0.552), x, y + nry);
if(nry < height / 2)
- list.lineTo(x, y + height - nry);
+ path->lineTo(x, y + height - nry);
- list.curveTo(x, y + height - nry * (1 - 0.552), x + nrx * (1 - 0.552), y + height, x + nrx, y + height);
+ path->curveTo(x, y + height - nry * (1 - 0.552), x + nrx * (1 - 0.552), y + height, x + nrx, y + height);
if(nrx < width / 2)
- list.lineTo(x + width - nrx, y + height);
+ path->lineTo(x + width - nrx, y + height);
- list.curveTo(x + width - nrx * (1 - 0.552), y + height, x + width, y + height - nry * (1 - 0.552), x + width, y + height - nry);
+ path->curveTo(x + width - nrx * (1 - 0.552), y + height, x + width, y + height - nry * (1 - 0.552), x + width, y + height - nry);
if(nry < height / 2)
- list.lineTo(x + width, y + nry);
+ path->lineTo(x + width, y + nry);
- list.curveTo(x + width, y + nry * (1 - 0.552), x + width - nrx * (1 - 0.552), y, x + width - nrx, y);
+ path->curveTo(x + width, y + nry * (1 - 0.552), x + width - nrx * (1 - 0.552), y, x + width - nrx, y);
if(nrx < width / 2)
- list.lineTo(x + nrx, y);
+ path->lineTo(x + nrx, y);
- list.closeSubpath();
- return list;
+ path->closeSubpath();
+ return path;
}
-KCPathDataList KCanvasCreator::createRectangle(float x, float y, float width, float height) const
+KCanvasPath* KCanvasCreator::createRectangle(float x, float y, float width, float height) const
{
- KCPathDataList list;
+ KCanvasPath* path = QPainter::renderingDevice()->createPath();
- if (width <= 0.0f || height <= 0.0f)
- return list;
+ if (width <= 0.0f || height <= 0.0f || !path)
+ return path;
- list.moveTo(x, y);
- list.lineTo(x + width, y);
- list.lineTo(x + width, y + height);
- list.lineTo(x, y + height);
- list.closeSubpath();
- return list;
+ path->moveTo(x, y);
+ path->lineTo(x + width, y);
+ path->lineTo(x + width, y + height);
+ path->lineTo(x, y + height);
+ path->closeSubpath();
+ return path;
}
-KCPathDataList KCanvasCreator::createEllipse(float cx, float cy, float rx, float ry) const
+KCanvasPath* KCanvasCreator::createEllipse(float cx, float cy, float rx, float ry) const
{
- KCPathDataList list;
+ KCanvasPath* path = QPainter::renderingDevice()->createPath();
- if (rx <= 0.0f || ry <= 0.0f)
- return list;
+ if (rx <= 0.0f || ry <= 0.0f || !path)
+ return path;
// Ellipse creation - nice & clean agg2 code
double x = cx, y = cy;
@@ -135,78 +135,30 @@
step++;
if(step == 1)
- list.moveTo(x, y);
+ path->moveTo(x, y);
else
- list.lineTo(x, y);
+ path->lineTo(x, y);
}
- list.closeSubpath();
- return list;
+ path->closeSubpath();
+ return path;
}
-KCPathDataList KCanvasCreator::createCircle(float cx, float cy, float r) const
+KCanvasPath* KCanvasCreator::createCircle(float cx, float cy, float r) const
{
return createEllipse(cx, cy, r, r);
}
-KCPathDataList KCanvasCreator::createLine(float x1, float y1, float x2, float y2) const
+KCanvasPath* KCanvasCreator::createLine(float x1, float y1, float x2, float y2) const
{
- KCPathDataList list;
+ KCanvasPath* path = QPainter::renderingDevice()->createPath();
- if (x1 == x2 && y1 == y2)
- return list;
+ if ((x1 == x2 && y1 == y2) || !path)
+ return path;
- list.moveTo(x1, y1);
- list.lineTo(x2, y2);
- return list;
-}
-
-KCanvasUserData KCanvasCreator::createCanvasPathData(KRenderingDevice *device, const KCPathDataList &pathData) const
-{
- device->startPath();
-
- int dataLength = pathData.count();
- if(dataLength == 0)
- {
- device->endPath();
- return device->currentPath();
- }
-
- KCPathDataList::ConstIterator it;
- KCPathDataList::ConstIterator end = pathData.end();
-
- // There are pure-moveto paths which reference
- // paint servers *bah* -> Do NOT render them!
- bool valid = false;
- for(it = pathData.begin(); it != end; ++it)
- {
- KCPathData data = *it;
-
- if(data.cmd == CMD_MOVE)
- device->moveTo(data.x3, data.y3);
- else if(data.cmd == CMD_LINE)
- {
- device->lineTo(data.x3, data.y3);
- valid = true;
- }
- else if(data.cmd == CMD_CLOSE_SUBPATH)
- device->closeSubpath();
- else
- {
- device->curveTo(data.x1, data.y1, data.x2, data.y2, data.x3, data.y3);
- valid = true;
- }
- }
-
- if(!valid)
- {
- device->endPath();
- device->deletePath(device->currentPath());
- device->startPath();
- }
-
- device->endPath();
- return device->currentPath();
+ path->moveTo(x1, y1);
+ path->lineTo(x2, y2);
+ return path;
}
// vim:ts=4:noet
1.5 +5 -13 SVGSupport/kcanvas/KCanvasCreator.h
Index: KCanvasCreator.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasCreator.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- KCanvasCreator.h 21 Nov 2005 08:29:11 -0000 1.4
+++ KCanvasCreator.h 6 Dec 2005 01:23:18 -0000 1.5
@@ -26,12 +26,6 @@
#include <kcanvas/KCanvasPath.h>
#include <kcanvas/KCanvasTypes.h>
-class RenderPath;
-namespace KSVG {
- class KCanvasRenderingStyle;
-}
-class KCanvasContainer;
-class KRenderingDevice;
class KCanvasCreator
{
public:
@@ -41,14 +35,12 @@
static KCanvasCreator *self();
// Canvas path creation
- KCPathDataList createRoundedRectangle(float x, float y, float width, float height, float rx, float ry) const;
- KCPathDataList createRectangle(float x, float y, float width, float height) const;
- KCPathDataList createEllipse(float cx, float cy, float rx, float ry) const;
- KCPathDataList createCircle(float cx, float cy, float r) const;
- KCPathDataList createLine(float x1, float y1, float x2, float y2) const;
+ KCanvasPath* createRoundedRectangle(float x, float y, float width, float height, float rx, float ry) const;
+ KCanvasPath* createRectangle(float x, float y, float width, float height) const;
+ KCanvasPath* createEllipse(float cx, float cy, float rx, float ry) const;
+ KCanvasPath* createCircle(float cx, float cy, float r) const;
+ KCanvasPath* createLine(float x1, float y1, float x2, float y2) const;
- // Canvas item creation
- KCanvasUserData createCanvasPathData(KRenderingDevice *device, const KCPathDataList &pathData) const;
private:
static KCanvasCreator *s_creator;
};
1.10 +4 -12 SVGSupport/kcanvas/KCanvasItem.cpp
Index: KCanvasItem.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasItem.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- KCanvasItem.cpp 27 Nov 2005 11:02:15 -0000 1.9
+++ KCanvasItem.cpp 6 Dec 2005 01:23:18 -0000 1.10
@@ -42,7 +42,6 @@
public:
Private()
{
- path = 0;
style = 0;
}
@@ -52,7 +51,7 @@
}
KSVG::KCanvasRenderingStyle *style;
- KCanvasUserData path;
+ RefPtr<KCanvasPath> path;
QRect fillBBox, strokeBbox;
QMatrix matrix;
@@ -67,8 +66,6 @@
RenderPath::~RenderPath()
{
- if(d->path)
- QPainter::renderingDevice()->deletePath(d->path);
delete d;
}
@@ -136,19 +133,14 @@
}
}
-void RenderPath::changePath(KCanvasUserData newPath)
+void RenderPath::changePath(KCanvasPath* newPath)
{
- ASSERT(newPath);
- QPainter::renderingDevice()->setCurrentPath(newPath);
- if (d->path)
- QPainter::renderingDevice()->deletePath(d->path);
-
d->path = newPath;
}
-KCanvasUserData RenderPath::path() const
+KCanvasPath* RenderPath::path() const
{
- return d->path;
+ return d->path.get();
}
KSVG::KCanvasRenderingStyle *RenderPath::canvasStyle() const
1.7 +2 -2 SVGSupport/kcanvas/KCanvasItem.h
Index: KCanvasItem.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasItem.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KCanvasItem.h 23 Nov 2005 15:14:05 -0000 1.6
+++ KCanvasItem.h 6 Dec 2005 01:23:18 -0000 1.7
@@ -58,9 +58,9 @@
void setupForDraw() const;
// Update
- void changePath(KCanvasUserData newPath);
+ void changePath(KCanvasPath* newPath);
- KCanvasUserData path() const;
+ KCanvasPath* path() const;
virtual void setStyle(khtml::RenderStyle *style);
KSVG::KCanvasRenderingStyle *canvasStyle() const;
1.6 +0 -25 SVGSupport/kcanvas/KCanvasMatrix.cpp
Index: KCanvasMatrix.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasMatrix.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- KCanvasMatrix.cpp 5 Oct 2005 05:36:45 -0000 1.5
+++ KCanvasMatrix.cpp 6 Dec 2005 01:23:18 -0000 1.6
@@ -280,31 +280,6 @@
*xScale = sx; *yScale = sy;
}
-KCPathDataList KCanvasMatrix::map(const KCPathDataList &pathData) const
-{
- KCPathDataList mapped;
- for(unsigned int i = 0; i < pathData.count(); i++)
- {
- KCPathDataList::ConstIterator it;
- KCPathDataList::ConstIterator end = pathData.end();
-
- for(it = pathData.begin(); it != end; ++it)
- {
- KCPathData data = *it;
-
- double x = 0.0, y = 0.0;
- m_matrix.map(data.x3, data.y3, &x, &y);
-
- if(data.cmd == CMD_MOVE)
- mapped.moveTo(x, y);
- else if(data.cmd == CMD_LINE)
- mapped.lineTo(x, y);
- }
- }
-
- return mapped;
-}
-
QMatrix KCanvasMatrix::qmatrix() const
{
return m_matrix;
1.5 +1 -5 SVGSupport/kcanvas/KCanvasMatrix.h
Index: KCanvasMatrix.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasMatrix.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- KCanvasMatrix.h 8 Sep 2005 08:03:10 -0000 1.4
+++ KCanvasMatrix.h 6 Dec 2005 01:23:18 -0000 1.5
@@ -31,7 +31,7 @@
OPS_POSTMUL = 2
} KCMatrixOperationMode;
-class KCPathDataList;
+class KCanvasPath;
class KCanvasMatrix
{
public:
@@ -92,10 +92,6 @@
// After this operation, the matrix has x and y scale of one ('1').
void removeScale(double *xScale, double *yScale);
- // Transform 'polydata' using current matrix.
- // (Only works for lineto/moveto operations!)
- KCPathDataList map(const KCPathDataList &pathData) const;
-
QMatrix qmatrix() const;
private:
1.4 +9 -44 SVGSupport/kcanvas/KCanvasPath.cpp
Index: KCanvasPath.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasPath.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- KCanvasPath.cpp 23 Nov 2005 15:14:05 -0000 1.3
+++ KCanvasPath.cpp 6 Dec 2005 01:23:18 -0000 1.4
@@ -24,26 +24,13 @@
*/
#include "config.h"
-#include "KCanvasPath.h"
+
+#include <qpainter.h>
#include <qtextstream.h>
-#include "KCanvasTreeDebug.h"
-//KCPathCommand
-QTextStream &operator<<(QTextStream &ts, KCPathCommand cmd)
-{
- switch (cmd)
- {
- case CMD_MOVE:
- ts << "MOVE"; break;
- case CMD_LINE:
- ts << "LINE"; break;
- case CMD_CURVE:
- ts << "CURVE"; break;
- case CMD_CLOSE_SUBPATH:
- ts << "CLOSE_SUBPATH"; break;
- }
- return ts;
-}
+#include "KCanvasPath.h"
+#include "KCanvasTreeDebug.h"
+#include "KRenderingDevice.h"
//KCWindRule
QTextStream &operator<<(QTextStream &ts, KCWindRule rule)
@@ -58,34 +45,12 @@
return ts;
}
-//KCPathData
-QTextStream &operator<<(QTextStream &ts, const KCPathData &d)
-{
- ts << "{cmd=" << d.cmd;
- switch(d.cmd)
- {
- case CMD_CURVE:
- ts << " x1="<< d.x1 << " y1=" << d.y1
- << " x2="<< d.x2 << " y2=" << d.y2;
- /* fallthrough */
- case CMD_LINE:
- case CMD_MOVE:
- ts << " x3="<< d.x3 << " y3=" << d.y3;
- break;
- case CMD_CLOSE_SUBPATH:
- /*empty*/
- break;
- }
- ts << "}";
- return ts;
-}
-
//KCClipData
QTextStream &operator<<(QTextStream &ts, const KCClipData &d)
{
- ts << "[winding=" << d.rule << "]";
- if (d.bbox)
- ts << " [bounding box mode=" << d.bbox << "]";
- ts << " [path=" << d.path << "]";
+ ts << "[winding=" << d.windRule << "]";
+ if (d.bboxUnits)
+ ts << " [bounding box mode=" << d.bboxUnits << "]";
+ ts << " [path=" << QPainter::renderingDevice()->stringForPath(d.path.get()) << "]";
return ts;
}
1.7 +23 -52 SVGSupport/kcanvas/KCanvasPath.h
Index: KCanvasPath.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasPath.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KCanvasPath.h 23 Nov 2005 15:14:05 -0000 1.6
+++ KCanvasPath.h 6 Dec 2005 01:23:18 -0000 1.7
@@ -1,4 +1,5 @@
/*
+ Copyright (C) 2005 Apple Computer, Inc.
Copyright (C) 2004, 2005 Nikolas Zimmermann <wildfox at kde.org>
2004, 2005 Rob Buis <buis at kde.org>
@@ -24,6 +25,9 @@
#define KCanvasPath_H
#include <q3valuelist.h>
+#include <kxmlcore/RefPtr.h>
+#include <kxmlcore/Assertions.h>
+#include "misc/shared.h"
class QTextStream;
@@ -44,59 +48,25 @@
CMD_CLOSE_SUBPATH = 3
} KCPathCommand;
-QTextStream &operator<<(QTextStream &ts, KCPathCommand cmd);
-
-struct KCPathData
-{
- KCPathCommand cmd : 2;
-
- double x1, x2, x3;
- double y1, y2, y3;
-};
-
-QTextStream &operator<<(QTextStream &ts, const KCPathData &d);
-
-class KCPathDataList : public Q3ValueList<KCPathData>
+class KCanvasPath : public khtml::Shared<KCanvasPath>
{
public:
- KCPathDataList() { }
-
- inline void moveTo(double x, double y)
- {
- KCPathData data; data.cmd = CMD_MOVE;
- data.x3 = x; data.y3 = y;
- append(data);
- }
-
- inline void lineTo(double x, double y)
- {
- KCPathData data; data.cmd = CMD_LINE;
- data.x3 = x; data.y3 = y;
- append(data);
- }
-
- inline void curveTo(double x1, double y1, double x2, double y2, double x3, double y3)
- {
- KCPathData data; data.cmd = CMD_CURVE;
- data.x1 = x1; data.y1 = y1;
- data.x2 = x2; data.y2 = y2;
- data.x3 = x3; data.y3 = y3;
- append(data);
- }
-
- inline void closeSubpath()
- {
- KCPathData data; data.cmd = CMD_CLOSE_SUBPATH;
- append(data);
- }
+ virtual ~KCanvasPath() { }
+
+ virtual bool isEmpty() const = 0;
+
+ virtual void moveTo(float x, float y) = 0;
+ virtual void lineTo(float x, float y) = 0;
+ virtual void curveTo(float x1, float y1, float x2, float y2, float x3, float y3) = 0;
+ virtual void closeSubpath() = 0;
};
// Clipping paths
struct KCClipData
{
- KCWindRule rule : 1;
- bool bbox : 1;
- KCPathDataList path;
+ KCWindRule windRule : 1;
+ bool bboxUnits : 1;
+ RefPtr<KCanvasPath> path;
};
QTextStream &operator<<(QTextStream &ts, const KCClipData &d);
@@ -106,13 +76,14 @@
public:
KCClipDataList() { }
- inline void addPath(const KCPathDataList &pathData, KCWindRule rule, bool bbox)
+ inline void addPath(KCanvasPath *pathData, KCWindRule windRule, bool bboxUnits)
{
- KCClipData data;
- data.rule = rule;
- data.bbox = bbox;
- data.path = pathData;
- append(data);
+ ASSERT(pathData);
+ KCClipData clipData;
+ clipData.windRule = windRule;
+ clipData.bboxUnits = bboxUnits;
+ clipData.path = pathData;
+ append(clipData);
}
};
1.12 +2 -2 SVGSupport/kcanvas/KCanvasResources.cpp
Index: KCanvasResources.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasResources.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- KCanvasResources.cpp 29 Nov 2005 02:03:55 -0000 1.11
+++ KCanvasResources.cpp 6 Dec 2005 01:23:19 -0000 1.12
@@ -102,9 +102,9 @@
m_clipData.clear();
}
-void KCanvasClipper::addClipData(const KCPathDataList &path, KCWindRule rule, bool bbox)
+void KCanvasClipper::addClipData(KCanvasPath* path, KCWindRule rule, bool bboxUnits)
{
- m_clipData.addPath(path, rule, bbox);
+ m_clipData.addPath(path, rule, bboxUnits);
}
KCClipDataList KCanvasClipper::clipData() const
1.11 +1 -1 SVGSupport/kcanvas/KCanvasResources.h
Index: KCanvasResources.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasResources.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- KCanvasResources.h 29 Nov 2005 02:03:55 -0000 1.10
+++ KCanvasResources.h 6 Dec 2005 01:23:19 -0000 1.11
@@ -79,7 +79,7 @@
virtual bool isClipper() const { return true; }
void resetClipData();
- void addClipData(const KCPathDataList &path, KCWindRule rule, bool bbox);
+ void addClipData(KCanvasPath *path, KCWindRule rule, bool bboxUnits);
KCClipDataList clipData() const;
1.6 +6 -20 SVGSupport/kcanvas/KCanvasTypes.h
Index: KCanvasTypes.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/KCanvasTypes.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- KCanvasTypes.h 21 Nov 2005 08:29:11 -0000 1.5
+++ KCanvasTypes.h 6 Dec 2005 01:23:19 -0000 1.6
@@ -23,45 +23,31 @@
#ifndef KCanvasTypes_H
#define KCanvasTypes_H
-#include <q3ptrlist.h>
-
-// Some default constants
-
-// Holds any ptr under a nice synonym :)
-typedef void *KCanvasUserData;
-
-#ifdef APPLE_CHANGES
-class KCanvasPrivateUserData {
-
-};
-
-typedef Q3PtrList<KCanvasPrivateUserData> KCanvasUserDataList;
-#else
-typedef Q3PtrList<void> KCanvasUserDataList;
-#endif
+#include <kxmlcore/RefPtr.h>
// aka "what to draw"
namespace KSVG {
class KCanvasRenderingStyle;
}
+
+class KCanvasPath;
class KCanvasCommonArgs
{
public:
KCanvasCommonArgs();
~KCanvasCommonArgs();
- KCanvasUserData path() const;
- void setPath(KCanvasUserData path);
+ KCanvasPath* path() const;
+ void setPath(KCanvasPath* path);
KSVG::KCanvasRenderingStyle *canvasStyle() const;
void setStyle(KSVG::KCanvasRenderingStyle *style);
private:
- KCanvasUserData m_path;
+ RefPtr<KCanvasPath> m_path;
KSVG::KCanvasRenderingStyle *m_style;
};
-
#endif
// vim:ts=4:noet
1.6 +3 -14 SVGSupport/kcanvas/device/KRenderingDevice.cpp
Index: KRenderingDevice.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/KRenderingDevice.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- KRenderingDevice.cpp 21 Nov 2005 08:29:13 -0000 1.5
+++ KRenderingDevice.cpp 6 Dec 2005 01:23:21 -0000 1.6
@@ -33,12 +33,12 @@
{
}
-KCanvasUserData KCanvasCommonArgs::path() const
+KCanvasPath* KCanvasCommonArgs::path() const
{
- return m_path;
+ return m_path.get();
}
-void KCanvasCommonArgs::setPath(KCanvasUserData path)
+void KCanvasCommonArgs::setPath(KCanvasPath* path)
{
m_path = path;
}
@@ -55,18 +55,12 @@
KRenderingDevice::KRenderingDevice()
{
- m_currentPath = 0;
}
KRenderingDevice::~KRenderingDevice()
{
}
-KCanvasUserData KRenderingDevice::currentPath() const
-{
- return m_currentPath;
-}
-
KRenderingDeviceContext *KRenderingDevice::currentContext() const
{
return m_contextStack.current();
@@ -82,9 +76,4 @@
m_contextStack.push(context);
}
-void KRenderingDevice::setCurrentPath(KCanvasUserData path)
-{
- m_currentPath = path;
-}
-
// vim:ts=4:noet
1.7 +3 -23 SVGSupport/kcanvas/device/KRenderingDevice.h
Index: KRenderingDevice.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/KRenderingDevice.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KRenderingDevice.h 22 Nov 2005 23:04:27 -0000 1.6
+++ KRenderingDevice.h 6 Dec 2005 01:23:21 -0000 1.7
@@ -60,10 +60,6 @@
// after the canvas target, it may be overwritten.
virtual bool isBuffered() const = 0;
- // Returns a pointer to the last constructed vector path
- // Call it after startPath()....endPath() to get the result!
- KCanvasUserData currentPath() const;
-
// Global rendering device context
KRenderingDeviceContext *currentContext() const;
@@ -71,35 +67,19 @@
virtual void pushContext(KRenderingDeviceContext *context);
virtual KRenderingDeviceContext *contextForImage(KCanvasImage *image) const = 0;
-
- // Vector path creation
- virtual void deletePath(KCanvasUserData path) = 0;
- virtual void startPath() = 0;
- virtual void endPath() = 0;
-
- virtual void moveTo(double x, double y) = 0;
- virtual void lineTo(double x, double y) = 0;
- virtual void curveTo(double x1, double y1, double x2, double y2, double x3, double y3) = 0;
- virtual void closeSubpath() = 0;
- virtual QString stringForPath(KCanvasUserData path) = 0;
+ virtual QString stringForPath(const KCanvasPath* path) = 0;
// Creation tools
virtual KCanvasResource *createResource(const KCResourceType &type) const = 0;
virtual KCanvasFilterEffect *createFilterEffect(const KCFilterEffectType &type) const = 0;
virtual KRenderingPaintServer *createPaintServer(const KCPaintServerType &type) const = 0;
- virtual RenderPath *createItem(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node, KCanvasUserData path) const = 0;
+ virtual RenderPath *createItem(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node, KCanvasPath* path) const = 0;
virtual KCanvasContainer *createContainer(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node) const = 0;
-
-
-protected: // To be used by from inherited endPath()
- friend class RenderPath;
-
- void setCurrentPath(KCanvasUserData path);
+ virtual KCanvasPath* createPath() const = 0;
private:
- KCanvasUserData m_currentPath;
Q3PtrStack<KRenderingDeviceContext> m_contextStack;
};
1.14 +4 -4 SVGSupport/kcanvas/device/quartz/KCanvasItemQuartz.mm
Index: KCanvasItemQuartz.mm
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KCanvasItemQuartz.mm,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- KCanvasItemQuartz.mm 29 Nov 2005 11:20:42 -0000 1.13
+++ KCanvasItemQuartz.mm 6 Dec 2005 01:23:21 -0000 1.14
@@ -35,6 +35,7 @@
#import "KRenderingStrokePainter.h"
#import "KCanvasMatrix.h"
+#import "KCanvasPathQuartz.h"
#import "KRenderingDeviceQuartz.h"
#import "KCanvasFilterQuartz.h"
#import "KCanvasResourcesQuartz.h"
@@ -203,7 +204,7 @@
RenderPath::setupForDraw();
- CGMutablePathRef cgPath = static_cast<KCanvasQuartzPathData *>(path())->path;
+ CGPathRef cgPath = static_cast<KCanvasPathQuartz*>(path())->cgPath();
ASSERT(cgPath != 0);
CGAffineTransform transform = CGAffineTransform(localTransform());
@@ -288,8 +289,7 @@
QRect KCanvasItemQuartz::bboxForPath(bool includeStroke) const
{
- KCanvasQuartzPathData *pathData = static_cast<KCanvasQuartzPathData *>(path());
- CGMutablePathRef cgPath = pathData->path;
+ CGPathRef cgPath = static_cast<KCanvasPathQuartz*>(path())->cgPath();
ASSERT(cgPath != 0);
CGRect bbox;
@@ -317,7 +317,7 @@
bool KCanvasItemQuartz::hitsPath(const QPoint &hitPoint, bool fill) const
{
- CGMutablePathRef cgPath = static_cast<KCanvasQuartzPathData *>(path())->path;
+ CGPathRef cgPath = static_cast<KCanvasPathQuartz*>(path())->cgPath();
ASSERT(cgPath != 0);
bool hitSuccess = false;
1.12 +13 -43 SVGSupport/kcanvas/device/quartz/KCanvasResourcesQuartz.mm
Index: KCanvasResourcesQuartz.mm
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KCanvasResourcesQuartz.mm,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- KCanvasResourcesQuartz.mm 29 Nov 2005 11:20:42 -0000 1.11
+++ KCanvasResourcesQuartz.mm 6 Dec 2005 01:23:22 -0000 1.12
@@ -31,40 +31,13 @@
#import "SVGRenderStyle.h"
#import "KCanvasMatrix.h"
+#import "KCanvasPathQuartz.h"
#import "KRenderingDeviceQuartz.h"
#import "KCanvasFilterQuartz.h"
#import "QuartzSupport.h"
#import <kxmlcore/Assertions.h>
-CGPathRef CGPathFromKCPathDataList(KCPathDataList pathData)
-{
- CGMutablePathRef path = CGPathCreateMutable();
-
- KCPathDataList::ConstIterator it = pathData.begin();
- KCPathDataList::ConstIterator end = pathData.end();
- for(; it != end; ++it)
- {
- KCPathData data = *it;
-
- switch (data.cmd) {
- case CMD_MOVE:
- CGPathMoveToPoint(path, NULL, data.x3, data.y3);
- break;
- case CMD_LINE:
- CGPathAddLineToPoint(path, NULL, data.x3, data.y3);
- break;
- case CMD_CURVE:
- CGPathAddCurveToPoint(path, NULL, data.x1, data.y1, data.x2, data.y2, data.x3, data.y3);
- break;
- case CMD_CLOSE_SUBPATH:
- CGPathCloseSubpath(path);
- break;
- }
- }
- return path;
-}
-
void KCanvasContainerQuartz::calcMinMaxWidth()
{
KHTMLAssert( !minMaxKnown());
@@ -217,16 +190,13 @@
void KCanvasClipperQuartz::applyClip(CGContextRef context, CGRect relativeBBox) const
{
- // FIXME: until the path representation is fixed in
- // KCanvas, we have to convert a KCPathDataList to a CGPath
-
if (m_clipData.count() < 1) {
NSLog(@"WARNING: Applying empty clipper, ignoring.");
return;
}
BOOL heterogenousClipRules = NO;
- KCWindRule clipRule = m_clipData[0].rule;
+ KCWindRule clipRule = m_clipData[0].windRule;
CGContextBeginPath(context);
@@ -234,21 +204,21 @@
for (unsigned int x = 0; x < m_clipData.count(); x++) {
KCClipData data = m_clipData[x];
- if (data.rule != clipRule)
+ if (data.windRule != clipRule)
heterogenousClipRules = YES;
-
- CGPathRef clipPath = CGPathFromKCPathDataList(data.path);
+ KCanvasPathQuartz *path = static_cast<KCanvasPathQuartz*>(data.path.get());
+ CGPathRef clipPath = static_cast<KCanvasPathQuartz*>(path)->cgPath();
if (CGPathIsEmpty(clipPath)) // FIXME: occasionally we get empty clip paths...
NSLog(@"WARNING: Asked to clip an empty path, ignoring.");
- if (data.bbox) {
- CGPathRef transformedPath = CGPathApplyTransform(clipPath, bboxTransform);
- CGPathRelease(clipPath);
- clipPath = transformedPath;
- }
- CGContextAddPath(context, clipPath);
- CGPathRelease(clipPath);
+ if (data.bboxUnits) {
+ CGMutablePathRef transformedPath = CGPathCreateMutable();
+ CGPathAddPath(transformedPath, &bboxTransform, clipPath);
+ CGContextAddPath(context, transformedPath);
+ CGPathRelease(transformedPath);
+ } else
+ CGContextAddPath(context, clipPath);
}
if (m_clipData.count()) {
@@ -260,7 +230,7 @@
NSLog(@"WARNING: Quartz does not yet support heterogenous clip rules, clipping will be incorrect.");
if (!CGContextIsPathEmpty(context)) {
- if (m_clipData[0].rule == RULE_EVENODD)
+ if (clipRule == RULE_EVENODD)
CGContextEOClip(context);
else
CGContextClip(context);
1.7 +3 -34 SVGSupport/kcanvas/device/quartz/KRenderingDeviceQuartz.h
Index: KRenderingDeviceQuartz.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KRenderingDeviceQuartz.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- KRenderingDeviceQuartz.h 22 Nov 2005 23:04:27 -0000 1.6
+++ KRenderingDeviceQuartz.h 6 Dec 2005 01:23:22 -0000 1.7
@@ -61,7 +61,6 @@
class KRenderingDeviceQuartz : public KRenderingDevice
{
-Q_OBJECT
public:
KRenderingDeviceQuartz() { }
virtual ~KRenderingDeviceQuartz() { }
@@ -76,27 +75,16 @@
CGContextRef currentCGContext() const;
virtual KRenderingDeviceContext *contextForImage(KCanvasImage *) const;
- // Vector path creation
- virtual void deletePath(KCanvasUserData path);
- virtual void startPath();
- virtual void endPath();
-
- virtual void moveTo(double x, double y);
- virtual void lineTo(double x, double y);
- virtual void curveTo(double x1, double y1, double x2, double y2, double x3, double y3);
- virtual void closeSubpath();
-
- KCanvasUserData pathForRect(const QRect &) const;
-
- virtual QString stringForPath(KCanvasUserData path);
+ virtual QString stringForPath(const KCanvasPath* path);
// Resource creation
virtual KCanvasResource *createResource(const KCResourceType &type) const;
virtual KRenderingPaintServer *createPaintServer(const KCPaintServerType &type) const;
virtual KCanvasFilterEffect *createFilterEffect(const KCFilterEffectType &type) const;
+ virtual KCanvasPath* createPath() const;
// item creation
- virtual RenderPath *createItem(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node, KCanvasUserData path) const;
+ virtual RenderPath *createItem(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node, KCanvasPath* path) const;
virtual KCanvasContainer *createContainer(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node) const;
// filters (mostly debugging)
@@ -106,23 +94,4 @@
static void KRenderingDeviceQuartz::setHardwareRenderingEnabled(bool enabled);
};
-// Wraps NSBezierPaths for c++ consumption
-class KCanvasQuartzPathData
-{
-public:
- KCanvasQuartzPathData();
-
- ~KCanvasQuartzPathData();
-
- CGMutablePathRef path;
- bool hasValidBBox;
- CGRect bbox;
-};
-
-class KCanvasQuartzUserData : public KCanvasPrivateUserData {
-public:
- KCanvasQuartzUserData();
- ~KCanvasQuartzUserData();
-};
-
#endif
1.8 +8 -77 SVGSupport/kcanvas/device/quartz/KRenderingDeviceQuartz.mm
Index: KRenderingDeviceQuartz.mm
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/KRenderingDeviceQuartz.mm,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- KRenderingDeviceQuartz.mm 28 Nov 2005 23:33:59 -0000 1.7
+++ KRenderingDeviceQuartz.mm 6 Dec 2005 01:23:22 -0000 1.8
@@ -25,6 +25,7 @@
#include "config.h"
+#import "KCanvasPathQuartz.h"
#import "KRenderingDeviceQuartz.h"
#import "KCanvasResourcesQuartz.h"
#import "KCanvasFilterQuartz.h"
@@ -41,18 +42,6 @@
#import "KWQLogging.h"
-
-KCanvasQuartzPathData::KCanvasQuartzPathData()
-{
- path = CGPathCreateMutable();
- hasValidBBox = false;
-}
-
-KCanvasQuartzPathData::~KCanvasQuartzPathData()
-{
- CGPathRelease(path);
-}
-
KRenderingDeviceContextQuartz::KRenderingDeviceContextQuartz(CGContextRef context) : m_cgContext(CGContextRetain(context)), m_nsGraphicsContext(0)
{
ASSERT(m_cgContext);
@@ -154,10 +143,6 @@
return poppedContext;
}
-
-#pragma mark -
-#pragma mark Path Management
-
KRenderingDeviceContext *KRenderingDeviceQuartz::contextForImage(KCanvasImage *image) const
{
KCanvasImageQuartz *quartzImage = static_cast<KCanvasImageQuartz *>(image);
@@ -173,75 +158,21 @@
return new KRenderingDeviceContextQuartz(CGLayerGetContext(cgLayer));
}
-void KRenderingDeviceQuartz::deletePath(KCanvasUserData pathData)
-{
- KCanvasQuartzPathData *data = static_cast<KCanvasQuartzPathData *>(pathData);
- ASSERT(data != 0);
-
- delete data;
-}
-
-void KRenderingDeviceQuartz::startPath()
-{
- setCurrentPath(new KCanvasQuartzPathData());
-}
-
-void KRenderingDeviceQuartz::endPath()
-{
- // NOOP for Quartz.
-}
-
-void KRenderingDeviceQuartz::moveTo(double x, double y)
-{
- CGMutablePathRef path = static_cast<KCanvasQuartzPathData *>(currentPath())->path;
- ASSERT(path != 0);
-
- CGPathMoveToPoint(path,NULL,x, y);
-}
-
-void KRenderingDeviceQuartz::lineTo(double x, double y)
-{
- KCanvasQuartzPathData *pathData = static_cast<KCanvasQuartzPathData *>(currentPath());
- CGMutablePathRef path = pathData->path;
- ASSERT(path != 0);
-
- CGPathAddLineToPoint(path,NULL,x, y);
- pathData->hasValidBBox = false;
-}
-
-void KRenderingDeviceQuartz::curveTo(double x1, double y1, double x2, double y2, double endX, double endY)
-{
- KCanvasQuartzPathData *pathData = static_cast<KCanvasQuartzPathData *>(currentPath());
- CGMutablePathRef path = pathData->path;
- ASSERT(path != 0);
-
- CGPathAddCurveToPoint(path, NULL, x1, y1, x2, y2, endX, endY);
- pathData->hasValidBBox = false;
-}
-
-void KRenderingDeviceQuartz::closeSubpath()
-{
- CGMutablePathRef path = static_cast<KCanvasQuartzPathData *>(currentPath())->path;
- ASSERT(path != 0);
-
- CGPathCloseSubpath(path);
-}
+#pragma mark -
+#pragma mark Path Management
-KCanvasUserData KRenderingDeviceQuartz::pathForRect(const QRect &rect) const
+KCanvasPath* KRenderingDeviceQuartz::createPath() const
{
- KCanvasQuartzPathData *data = new KCanvasQuartzPathData();
- CGPathAddRect(data->path, NULL, CGRectMake(rect.x(),rect.y(),rect.width(),rect.height()));
- return data;
+ return new KCanvasPathQuartz();
}
-QString KRenderingDeviceQuartz::stringForPath(KCanvasUserData path)
+QString KRenderingDeviceQuartz::stringForPath(const KCanvasPath *path)
{
QString result;
if (path) {
- CGMutablePathRef cgPath = static_cast<KCanvasQuartzPathData *>(path)->path;
+ CGPathRef cgPath = static_cast<const KCanvasPathQuartz *>(path)->cgPath();
CFStringRef pathString = CFStringFromCGPath(cgPath);
result = QString::fromCFString(pathString);
- CFRelease(pathString);
}
return result;
}
@@ -268,7 +199,7 @@
return new (arena) KCanvasContainerQuartz(node);
}
-RenderPath *KRenderingDeviceQuartz::createItem(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node, KCanvasUserData path) const
+RenderPath *KRenderingDeviceQuartz::createItem(RenderArena *arena, khtml::RenderStyle *style, KSVG::SVGStyledElementImpl *node, KCanvasPath* path) const
{
RenderPath *item = new (arena) KCanvasItemQuartz(style, node);
item->changePath(path);
1.5 +0 -1 SVGSupport/kcanvas/device/quartz/QuartzSupport.h
Index: QuartzSupport.h
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/QuartzSupport.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- QuartzSupport.h 29 Nov 2005 02:03:56 -0000 1.4
+++ QuartzSupport.h 6 Dec 2005 01:23:22 -0000 1.5
@@ -34,7 +34,6 @@
CFStringRef CFStringFromCGPath(CGPathRef path);
CFStringRef CFStringFromCGAffineTransform(CGAffineTransform t);
CGAffineTransform CGAffineTransformMakeMapBetweenRects(CGRect source, CGRect dest);
-CGPathRef CGPathApplyTransform(CGPathRef path, CGAffineTransform transform);
void applyStrokeStyleToContext(CGContextRef context, KSVG::KCanvasRenderingStyle *style);
1.6 +0 -41 SVGSupport/kcanvas/device/quartz/QuartzSupport.mm
Index: QuartzSupport.mm
===================================================================
RCS file: /cvs/root/SVGSupport/kcanvas/device/quartz/QuartzSupport.mm,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- QuartzSupport.mm 21 Nov 2005 08:29:16 -0000 1.5
+++ QuartzSupport.mm 6 Dec 2005 01:23:22 -0000 1.6
@@ -48,47 +48,6 @@
return transform;
}
-typedef struct {
- CGAffineTransform transform;
- CGMutablePathRef resultPath;
-} CGPathTransformCallbackData;
-
-void CGPathTransformCallback(void *info, const CGPathElement *element)
-{
- CGPathTransformCallbackData *data = (CGPathTransformCallbackData *)info;
- CGAffineTransform transform = data->transform;
- CGMutablePathRef resultPath = data->resultPath;
-
- CGPoint *points = element->points;
-
- switch (element->type) {
- case kCGPathElementMoveToPoint:
- CGPathMoveToPoint(resultPath, &transform, points[0].x, points[0].y);
- break;
- case kCGPathElementAddLineToPoint:
- CGPathAddLineToPoint(resultPath, &transform, points[0].x, points[0].y);
- break;
- case kCGPathElementAddQuadCurveToPoint:
- CGPathAddQuadCurveToPoint(resultPath, &transform, points[0].x, points[0].y, points[1].x, points[1].y);
- break;
- case kCGPathElementAddCurveToPoint:
- CGPathAddCurveToPoint(resultPath, &transform, points[0].x, points[0].y, points[1].x, points[1].y, points[2].x, points[2].y);
- case kCGPathElementCloseSubpath:
- CGPathCloseSubpath(resultPath);
- }
-}
-
-// FIXME: HACK this should be replace by a call to
-// CGPathAddPath(<#CGMutablePathRef path1#>,<#const CGAffineTransform * m#>,<#CGPathRef path2#>)
-CGPathRef CGPathApplyTransform(CGPathRef path, CGAffineTransform transform)
-{
- CGPathTransformCallbackData data;
- data.transform = transform;
- data.resultPath = CGPathCreateMutable();
- CGPathApply(path, &data, CGPathTransformCallback);
- return data.resultPath;
-}
-
void applyStrokeStyleToContext(CGContextRef context, KSVG::KCanvasRenderingStyle *style)
{
/* Shouldn't all these be in the stroke painter? */
1.1 SVGSupport/kcanvas/device/quartz/KCanvasPathQuartz.h
Index: KCanvasPathQuartz.h
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <kcanvas/KCanvasPath.h>
typedef struct CGPath *CGMutablePathRef;
typedef const struct CGPath *CGPathRef;
class KCanvasPathQuartz : public KCanvasPath {
public:
KCanvasPathQuartz();
virtual ~KCanvasPathQuartz();
virtual bool isEmpty() const;
virtual void moveTo(float x, float y);
virtual void lineTo(float x, float y);
virtual void curveTo(float x1, float y1, float x2, float y2, float x3, float y3);
virtual void closeSubpath();
CGPathRef cgPath() const { return m_cgPath; }
private:
CGMutablePathRef m_cgPath;
};
1.1 SVGSupport/kcanvas/device/quartz/KCanvasPathQuartz.mm
Index: KCanvasPathQuartz.mm
===================================================================
/*
* Copyright (C) 2005 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "KCanvasPathQuartz.h"
KCanvasPathQuartz::KCanvasPathQuartz()
{
m_cgPath = CGPathCreateMutable();
}
KCanvasPathQuartz::~KCanvasPathQuartz()
{
CGPathRelease(m_cgPath);
}
bool KCanvasPathQuartz::isEmpty() const
{
return CGPathIsEmpty(m_cgPath);
}
void KCanvasPathQuartz::moveTo(float x, float y)
{
CGPathMoveToPoint(m_cgPath, 0, x, y);
}
void KCanvasPathQuartz::lineTo(float x, float y)
{
CGPathAddLineToPoint(m_cgPath, 0, x, y);
}
void KCanvasPathQuartz::curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
{
CGPathAddCurveToPoint(m_cgPath, 0, x1, y1, x2, y2, x3, y3);
}
void KCanvasPathQuartz::closeSubpath()
{
CGPathCloseSubpath(m_cgPath);
}
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGCircleElementImpl.cpp
Index: SVGCircleElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGCircleElementImpl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGCircleElementImpl.cpp 26 Nov 2005 22:19:05 -0000 1.8
+++ SVGCircleElementImpl.cpp 6 Dec 2005 01:23:23 -0000 1.9
@@ -75,7 +75,7 @@
}
}
-KCPathDataList SVGCircleElementImpl::toPathData() const
+KCanvasPath* SVGCircleElementImpl::toPathData() const
{
float _cx = cx()->baseVal()->value(), _cy = cy()->baseVal()->value();
float _r = r()->baseVal()->value();
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGCircleElementImpl.h
Index: SVGCircleElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGCircleElementImpl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGCircleElementImpl.h 3 Dec 2005 01:32:33 -0000 1.8
+++ SVGCircleElementImpl.h 6 Dec 2005 01:23:23 -0000 1.9
@@ -50,7 +50,7 @@
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual bool rendererIsNeeded(khtml::RenderStyle *) { return true; }
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
virtual const SVGStyledElementImpl *pushAttributeContext(const SVGStyledElementImpl *context);
1.12 +2 -1 SVGSupport/ksvg2/svg/SVGClipPathElementImpl.cpp
Index: SVGClipPathElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGClipPathElementImpl.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- SVGClipPathElementImpl.cpp 27 Nov 2005 11:02:21 -0000 1.11
+++ SVGClipPathElementImpl.cpp 6 Dec 2005 01:23:23 -0000 1.12
@@ -95,7 +95,8 @@
if (e && e->isStyled()) {
SVGStyledElementImpl *styled = static_cast<SVGStyledElementImpl *>(e);
khtml::RenderStyle *pathStyle = getDocument()->styleSelector()->styleForElement(styled, clipPathStyle);
- m_clipper->addClipData(styled->toPathData(), (KCWindRule) pathStyle->svgStyle()->clipRule(), bbox);
+ if (KCanvasPath* pathData = styled->toPathData())
+ m_clipper->addClipData(pathData, (KCWindRule) pathStyle->svgStyle()->clipRule(), bbox);
pathStyle->deref(canvas()->renderArena());
}
}
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGEllipseElementImpl.cpp
Index: SVGEllipseElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGEllipseElementImpl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGEllipseElementImpl.cpp 26 Nov 2005 22:19:06 -0000 1.8
+++ SVGEllipseElementImpl.cpp 6 Dec 2005 01:23:23 -0000 1.9
@@ -82,7 +82,7 @@
}
}
-KCPathDataList SVGEllipseElementImpl::toPathData() const
+KCanvasPath* SVGEllipseElementImpl::toPathData() const
{
float _cx = cx()->baseVal()->value(), _cy = cy()->baseVal()->value();
float _rx = rx()->baseVal()->value(), _ry = ry()->baseVal()->value();
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGEllipseElementImpl.h
Index: SVGEllipseElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGEllipseElementImpl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGEllipseElementImpl.h 3 Dec 2005 01:32:34 -0000 1.8
+++ SVGEllipseElementImpl.h 6 Dec 2005 01:23:24 -0000 1.9
@@ -51,7 +51,7 @@
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual bool rendererIsNeeded(khtml::RenderStyle *) { return true; }
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
virtual const SVGStyledElementImpl *pushAttributeContext(const SVGStyledElementImpl *context);
1.13 +5 -6 SVGSupport/ksvg2/svg/SVGImageElementImpl.cpp
Index: SVGImageElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGImageElementImpl.cpp,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SVGImageElementImpl.cpp 27 Nov 2005 11:02:26 -0000 1.12
+++ SVGImageElementImpl.cpp 6 Dec 2005 01:23:24 -0000 1.13
@@ -48,7 +48,7 @@
#include <kcanvas/KCanvasCreator.h>
#include <kcanvas/KCanvasContainer.h>
#include <kcanvas/KCanvasImage.h>
-#include "KCanvasRenderingStyle.h"
+#include <kcanvas/KCanvasPath.h>
#include <kcanvas/device/KRenderingDevice.h>
#include <kcanvas/device/KRenderingFillPainter.h>
#include <kcanvas/device/KRenderingPaintServerImage.h>
@@ -143,12 +143,11 @@
float _width = width()->baseVal()->value(), _height = height()->baseVal()->value();
// Use dummy rect
- KCPathDataList pathData = KCanvasCreator::self()->createRectangle(_x, _y, _width, _height);
- if(pathData.isEmpty())
+ RefPtr<KCanvasPath> pathData = KCanvasCreator::self()->createRectangle(_x, _y, _width, _height);
+ if (!pathData || pathData->isEmpty())
return 0;
-
- KCanvasUserData path = KCanvasCreator::self()->createCanvasPathData(QPainter::renderingDevice(), pathData);
- return QPainter::renderingDevice()->createItem(arena, style, this, path);
+
+ return QPainter::renderingDevice()->createItem(arena, style, this, pathData.get());
}
void SVGImageElementImpl::attach()
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGLineElementImpl.cpp
Index: SVGLineElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGLineElementImpl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGLineElementImpl.cpp 26 Nov 2005 22:19:12 -0000 1.8
+++ SVGLineElementImpl.cpp 6 Dec 2005 01:23:24 -0000 1.9
@@ -82,7 +82,7 @@
}
}
-KCPathDataList SVGLineElementImpl::toPathData() const
+KCanvasPath* SVGLineElementImpl::toPathData() const
{
float _x1 = x1()->baseVal()->value(), _y1 = y1()->baseVal()->value();
float _x2 = x2()->baseVal()->value(), _y2 = y2()->baseVal()->value();
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGLineElementImpl.h
Index: SVGLineElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGLineElementImpl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGLineElementImpl.h 3 Dec 2005 01:32:39 -0000 1.8
+++ SVGLineElementImpl.h 6 Dec 2005 01:23:24 -0000 1.9
@@ -51,7 +51,7 @@
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual bool rendererIsNeeded(khtml::RenderStyle *) { return true; }
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
virtual const SVGStyledElementImpl *pushAttributeContext(const SVGStyledElementImpl *context);
1.10 +9 -7 SVGSupport/ksvg2/svg/SVGPathElementImpl.cpp
Index: SVGPathElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPathElementImpl.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SVGPathElementImpl.cpp 29 Nov 2005 11:20:47 -0000 1.9
+++ SVGPathElementImpl.cpp 6 Dec 2005 01:23:24 -0000 1.10
@@ -45,6 +45,7 @@
#include <kcanvas/KCanvas.h>
#include <kcanvas/KCanvasCreator.h>
+#include <kcanvas/device/KRenderingDevice.h>
namespace KSVG {
@@ -378,14 +379,15 @@
return 0;
}
-KCPathDataList SVGPathElementImpl::toPathData() const
+// FIXME: This probably belongs on SVGPathSegListImpl instead. -- ecs 12/5/05
+KCanvasPath* SVGPathElementImpl::toPathData() const
{
// TODO : also support non-normalized mode, at least in dom structure
- KCPathDataList pathData;
int len = pathSegList()->numberOfItems();
if(len < 1)
- return pathData;
+ return 0;
+ KCanvasPath* pathData = QPainter::renderingDevice()->createPath();
for(int i = 0; i < len; ++i)
{
SVGPathSegImpl *p = pathSegList()->getItem(i);
@@ -394,25 +396,25 @@
case PATHSEG_MOVETO_ABS:
{
SVGPathSegMovetoAbsImpl *moveTo = static_cast<SVGPathSegMovetoAbsImpl *>(p);
- pathData.moveTo(moveTo->x(), moveTo->y());
+ pathData->moveTo(moveTo->x(), moveTo->y());
break;
}
case PATHSEG_LINETO_ABS:
{
SVGPathSegLinetoAbsImpl *lineTo = static_cast<SVGPathSegLinetoAbsImpl *>(p);
- pathData.lineTo(lineTo->x(), lineTo->y());
+ pathData->lineTo(lineTo->x(), lineTo->y());
break;
}
case PATHSEG_CURVETO_CUBIC_ABS:
{
SVGPathSegCurvetoCubicAbsImpl *curveTo = static_cast<SVGPathSegCurvetoCubicAbsImpl *>(p);
- pathData.curveTo(curveTo->x1(), curveTo->y1(),
+ pathData->curveTo(curveTo->x1(), curveTo->y1(),
curveTo->x2(), curveTo->y2(),
curveTo->x(), curveTo->y());
break;
}
case PATHSEG_CLOSEPATH:
- pathData.closeSubpath();
+ pathData->closeSubpath();
default:
break;
}
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGPathElementImpl.h
Index: SVGPathElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPathElementImpl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGPathElementImpl.h 3 Dec 2005 01:32:40 -0000 1.8
+++ SVGPathElementImpl.h 6 Dec 2005 01:23:24 -0000 1.9
@@ -101,7 +101,7 @@
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual bool rendererIsNeeded(khtml::RenderStyle *) { return true; }
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
private:
mutable RefPtr<SVGPathSegListImpl> m_pathSegList;
1.7 +9 -9 SVGSupport/ksvg2/svg/SVGPolygonElementImpl.cpp
Index: SVGPolygonElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPolygonElementImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGPolygonElementImpl.cpp 21 Nov 2005 08:29:41 -0000 1.6
+++ SVGPolygonElementImpl.cpp 6 Dec 2005 01:23:24 -0000 1.7
@@ -26,6 +26,7 @@
#include <kcanvas/KCanvas.h>
#include <kcanvas/KCanvasCreator.h>
+#include <kcanvas/device/KRenderingDevice.h>
using namespace KSVG;
@@ -38,21 +39,20 @@
{
}
-KCPathDataList SVGPolygonElementImpl::toPathData() const
+KCanvasPath* SVGPolygonElementImpl::toPathData() const
{
- KCPathDataList polyData;
int len = points()->numberOfItems();
if(len < 1)
- return polyData;
-
- polyData.moveTo(points()->getItem(0)->x(), points()->getItem(0)->y());
- for(int i = 1; i < len; ++i)
- {
+ return 0;
+
+ KCanvasPath* polyData = QPainter::renderingDevice()->createPath();
+ polyData->moveTo(points()->getItem(0)->x(), points()->getItem(0)->y());
+ for (int i = 1; i < len; ++i) {
SVGPointImpl *p = points()->getItem(i);
- polyData.lineTo(p->x(), p->y());
+ polyData->lineTo(p->x(), p->y());
}
- polyData.closeSubpath();
+ polyData->closeSubpath();
return polyData;
}
1.6 +1 -1 SVGSupport/ksvg2/svg/SVGPolygonElementImpl.h
Index: SVGPolygonElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPolygonElementImpl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGPolygonElementImpl.h 21 Nov 2005 08:29:41 -0000 1.5
+++ SVGPolygonElementImpl.h 6 Dec 2005 01:23:24 -0000 1.6
@@ -33,7 +33,7 @@
SVGPolygonElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGPolygonElementImpl();
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
};
};
1.7 +7 -7 SVGSupport/ksvg2/svg/SVGPolylineElementImpl.cpp
Index: SVGPolylineElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPolylineElementImpl.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- SVGPolylineElementImpl.cpp 21 Nov 2005 08:29:41 -0000 1.6
+++ SVGPolylineElementImpl.cpp 6 Dec 2005 01:23:24 -0000 1.7
@@ -26,6 +26,7 @@
#include <kcanvas/KCanvas.h>
#include <kcanvas/KCanvasCreator.h>
+#include <kcanvas/device/KRenderingDevice.h>
using namespace KSVG;
@@ -38,18 +39,17 @@
{
}
-KCPathDataList SVGPolylineElementImpl::toPathData() const
+KCanvasPath* SVGPolylineElementImpl::toPathData() const
{
- KCPathDataList polyData;
int len = points()->numberOfItems();
if(len < 1)
- return polyData;
+ return 0;
- polyData.moveTo(points()->getItem(0)->x(), points()->getItem(0)->y());
- for(int i = 1; i < len; ++i)
- {
+ KCanvasPath* polyData = QPainter::renderingDevice()->createPath();
+ polyData->moveTo(points()->getItem(0)->x(), points()->getItem(0)->y());
+ for (int i = 1; i < len; ++i) {
SVGPointImpl *p = points()->getItem(i);
- polyData.lineTo(p->x(), p->y());
+ polyData->lineTo(p->x(), p->y());
}
return polyData;
1.6 +1 -1 SVGSupport/ksvg2/svg/SVGPolylineElementImpl.h
Index: SVGPolylineElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGPolylineElementImpl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- SVGPolylineElementImpl.h 21 Nov 2005 08:29:41 -0000 1.5
+++ SVGPolylineElementImpl.h 6 Dec 2005 01:23:24 -0000 1.6
@@ -33,7 +33,7 @@
SVGPolylineElementImpl(const KDOM::QualifiedName& tagName, KDOM::DocumentImpl *doc);
virtual ~SVGPolylineElementImpl();
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
};
};
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGRectElementImpl.cpp
Index: SVGRectElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGRectElementImpl.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGRectElementImpl.cpp 26 Nov 2005 22:19:15 -0000 1.8
+++ SVGRectElementImpl.cpp 6 Dec 2005 01:23:25 -0000 1.9
@@ -100,7 +100,7 @@
}
}
-KCPathDataList SVGRectElementImpl::toPathData() const
+KCanvasPath* SVGRectElementImpl::toPathData() const
{
float _x = x()->baseVal()->value(), _y = y()->baseVal()->value();
float _width = width()->baseVal()->value(), _height = height()->baseVal()->value();
1.9 +1 -1 SVGSupport/ksvg2/svg/SVGRectElementImpl.h
Index: SVGRectElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGRectElementImpl.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- SVGRectElementImpl.h 3 Dec 2005 01:32:40 -0000 1.8
+++ SVGRectElementImpl.h 6 Dec 2005 01:23:25 -0000 1.9
@@ -55,7 +55,7 @@
virtual void parseMappedAttribute(KDOM::MappedAttributeImpl *attr);
virtual bool rendererIsNeeded(khtml::RenderStyle *) { return true; }
- virtual KCPathDataList toPathData() const;
+ virtual KCanvasPath* toPathData() const;
virtual const SVGStyledElementImpl *pushAttributeContext(const SVGStyledElementImpl *context);
1.15 +5 -10 SVGSupport/ksvg2/svg/SVGStyledElementImpl.cpp
Index: SVGStyledElementImpl.cpp
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGStyledElementImpl.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- SVGStyledElementImpl.cpp 29 Nov 2005 11:20:47 -0000 1.14
+++ SVGStyledElementImpl.cpp 6 Dec 2005 01:23:25 -0000 1.15
@@ -70,11 +70,10 @@
khtml::RenderObject *SVGStyledElementImpl::createRenderer(RenderArena *arena, khtml::RenderStyle *style)
{
- KCPathDataList pathData = toPathData();
- if (pathData.isEmpty())
+ RefPtr<KCanvasPath> pathData = toPathData();
+ if (!pathData || pathData->isEmpty())
return 0;
- KCanvasUserData path = KCanvasCreator::self()->createCanvasPathData(QPainter::renderingDevice(), pathData);
- return QPainter::renderingDevice()->createItem(arena, style, this, path);
+ return QPainter::renderingDevice()->createItem(arena, style, this, pathData.get());
}
void SVGStyledElementImpl::parseMappedAttribute(KDOM::MappedAttributeImpl *attr)
@@ -155,8 +154,7 @@
&& parentElement->childShouldCreateRenderer(this))
renderSection = true;
- KCanvasUserData newPath = KCanvasCreator::self()->createCanvasPathData(QPainter::renderingDevice(), toPathData());
- renderPath->changePath(newPath);
+ renderPath->changePath(toPathData());
if(renderSection)
renderPath->setNeedsLayout(true);
@@ -167,10 +165,7 @@
const SVGStyledElementImpl *SVGStyledElementImpl::pushAttributeContext(const SVGStyledElementImpl *)
{
if(canvas())
- {
- KCanvasUserData newPath = KCanvasCreator::self()->createCanvasPathData(QPainter::renderingDevice(), toPathData());
- static_cast<RenderPath *>(renderer())->changePath(newPath);
- }
+ static_cast<RenderPath *>(renderer())->changePath(toPathData());
return 0;
}
1.13 +1 -1 SVGSupport/ksvg2/svg/SVGStyledElementImpl.h
Index: SVGStyledElementImpl.h
===================================================================
RCS file: /cvs/root/SVGSupport/ksvg2/svg/SVGStyledElementImpl.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- SVGStyledElementImpl.h 3 Dec 2005 01:32:41 -0000 1.12
+++ SVGStyledElementImpl.h 6 Dec 2005 01:23:25 -0000 1.13
@@ -57,7 +57,7 @@
// These need to be implemented.
virtual bool rendererIsNeeded(khtml::RenderStyle *) { return false; }
- virtual KCPathDataList toPathData() const { return KCPathDataList(); }
+ virtual KCanvasPath* toPathData() const { return 0; }
virtual khtml::RenderObject *createRenderer(RenderArena *arena, khtml::RenderStyle *style);
virtual KCanvasResource *canvasResource() { return 0; }
More information about the webkit-changes
mailing list