[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/work/khtml-svg/rendering
From: Nikolas Zimmermann <wildfox () kde ! org>
Date: 2006-04-03 22:12:31
Message-ID: 1144102351.150387.15063.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 526125 by wildfox:
Several cleanups here, consistency etc...
M +24 -33 render_svg_image.cpp
M +16 -8 render_svg_image.h
M +2 -2 render_svg_path.h
--- branches/work/khtml-svg/rendering/render_svg_image.cpp #526124:526125
@@ -20,22 +20,17 @@
Boston, MA 02111-1307, USA.
*/
-#include "render_svg_image.h"
+#include "rendering/kcanvas/KCanvasMatrix.h"
+#include "rendering/kcanvas/device/KRenderingDevice.h"
-//#include "svg/misc/KCanvasRenderingStyle.h"
-
-#include "device/KRenderingDevice.h"
-
#include "svg/SVGImageElementImpl.h"
#include "svg/SVGAnimatedLengthImpl.h"
-#include "KCanvasMatrix.h"
-//#include "KCanvasResourcesQt.h"
-//#include "KCanvasMaskerQt.h"
+#include "render_svg_image.h"
-using namespace KSVG;
+using namespace khtml;
-RenderSVGImage::RenderSVGImage(SVGImageElementImpl *impl)
+RenderSVGImage::RenderSVGImage(KSVG::SVGImageElementImpl *impl)
: RenderImage(impl)
{
}
@@ -44,21 +39,23 @@
{
}
-void RenderSVGImage::paint(PaintInfo& paintInfo, int parentX, int parentY)
+void RenderSVGImage::paint(PaintInfo &paintInfo, int parentX, int parentY)
{
- //if (paintInfo.p->paintingDisabled() || (paintInfo.phase != \
PaintActionForeground)) || style()->visibility() == KHTML::HIDDEN)
- // return;
+ if(paintInfo.phase != PaintActionForeground || style()->visibility() == \
khtml::HIDDEN) + return;
KRenderingDevice *renderingDevice = KRenderingDevice::self();
KRenderingDeviceContext *context = renderingDevice->currentContext();
+
bool shouldPopContext = false;
- if (!context) {
+ if(!context)
+ {
// Need to push a device context on the stack if empty.
-// context = paintInfo.p->createRenderingDeviceContext();
- context = renderingDevice->createRenderingDeviceContext(paintInfo.p);
+ context = renderingDevice->createRenderingDeviceContext(paintInfo.p);
renderingDevice->pushContext(context);
shouldPopContext = true;
- } else
+ }
+ else
paintInfo.p->save();
context->concatCTM(QMatrix().translate(parentX, parentY));
@@ -66,37 +63,31 @@
translateForAttributes();
QRectF boundingBox(0, 0, width(), height());
- const SVGRenderStyle *svgStyle = style()->svgStyle();
+ const KSVG::SVGRenderStyle *svgStyle = style()->svgStyle();
- //if (KCanvasClipper *clipper = getClipperById(document(), \
svgStyle->clipPath().mid(1)))
- // clipper->applyClip(boundingBox);
-
- //if (KCanvasMasker *masker = getMaskerById(document(), \
svgStyle->maskElement().mid(1)))
- // masker->applyMask(boundingBox);
-
- //KCanvasFilter *filter = getFilterById(document(), svgStyle->filter().mid(1));
- //if (filter)
- // filter->prepareFilter(boundingBox);
+ if(KCanvasClipper *clipper = getClipperById(document(), \
svgStyle->clipPath().mid(1))) + clipper->applyClip(boundingBox);
khtml::RenderImage::paint(paintInfo, 0, 0);
- //if (filter)
- // filter->applyFilter(boundingBox);
-
// restore drawing state
- if (shouldPopContext) {
+ if(shouldPopContext)
+ {
renderingDevice->popContext();
delete context;
- } else
+ }
+ else
paintInfo.p->restore();
}
void RenderSVGImage::translateForAttributes()
{
KRenderingDeviceContext *context = KRenderingDevice::self()->currentContext();
- SVGImageElementImpl *image = static_cast<SVGImageElementImpl *>(node());
+ KSVG::SVGImageElementImpl *image = static_cast<KSVG::SVGImageElementImpl \
*>(node()); +
float xOffset = image->x()->baseVal() ? image->x()->baseVal()->value() : 0;
float yOffset = image->y()->baseVal() ? image->y()->baseVal()->value() : 0;
+
context->concatCTM(QMatrix().translate(xOffset, yOffset));
}
--- branches/work/khtml-svg/rendering/render_svg_image.h #526124:526125
@@ -20,26 +20,34 @@
Boston, MA 02111-1307, USA.
*/
-#ifndef KCanvas_RenderSVGImage_H
-#define KCanvas_RenderSVGImage_H
+#ifndef RenderSVGImage_H
+#define RenderSVGImage_H
+#include <QMatrix>
+
#include "render_image.h"
-#include <qmatrix.h>
namespace KSVG
{
- class SVGImageElementImpl;
- class RenderSVGImage : public khtml::RenderImage {
+ class SVGStyledElementImpl;
+};
+
+namespace khtml
+{
+ class RenderSVGImage : public khtml::RenderImage
+ {
public:
- RenderSVGImage(SVGImageElementImpl *impl);
+ RenderSVGImage(KSVG::SVGImageElementImpl *impl);
virtual ~RenderSVGImage();
virtual QMatrix localTransform() const { return m_transform; }
- virtual void setLocalTransform(const QMatrix& transform) { m_transform = \
transform; } + virtual void setLocalTransform(const QMatrix &transform) { \
m_transform = transform; }
- virtual void paint(PaintInfo& paintInfo, int parentX, int parentY);
+ virtual void paint(PaintInfo &paintInfo, int parentX, int parentY);
+
private:
void translateForAttributes();
+
QMatrix m_transform;
};
}
--- branches/work/khtml-svg/rendering/render_svg_path.h #526124:526125
@@ -21,8 +21,8 @@
Boston, MA 02111-1307, USA.
*/
-#ifndef RenderPath_H
-#define RenderPath_H
+#ifndef RenderSVGPath_H
+#define RenderSVGPath_H
#include <QRect>
#include <QRectF>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic