[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-06 16:47:20
Message-ID: 1144342040.367656.3321.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 527031 by wildfox:

Make rendering text work by letting render_svg_text layout
it's children - just a _first_ start. Still not perfect.

Though the clipping problem is gone and text can be painted
everywhere now...

CCMAIL: buis@kde.org


 M  +13 -17    render_svg_text.cpp  
 M  +1 -2      render_svg_text.h  


--- branches/work/khtml-svg/rendering/render_svg_text.cpp #527030:527031
@@ -44,16 +44,6 @@
     return QMatrix().translate(0, -offset);
 }
 
-QMatrix RenderSVGText::translationForAttributes()
-{
-    KSVG::SVGTextElementImpl *text = static_cast<KSVG::SVGTextElementImpl \
                *>(element());
-
-    float xOffset = text->x()->baseVal()->getFirst() ? \
                text->x()->baseVal()->getFirst()->value() : 0;
-    float yOffset = text->y()->baseVal()->getFirst() ? \
                text->y()->baseVal()->getFirst()->value() : 0;
-
-    return QMatrix().translate(xOffset, yOffset);
-}
-
 void RenderSVGText::paint(PaintInfo &paintInfo, int parentX, int parentY)
 {
     KRenderingDevice *device = KRenderingDevice::self();
@@ -69,12 +59,19 @@
     }
     else
         paintInfo.p->save();
+
+    // Get our rendering location...
+    KSVG::SVGTextElementImpl *text = static_cast<KSVG::SVGTextElementImpl \
*>(element()); +
+    float xOffset = text->x()->baseVal()->getFirst() ? \
text->x()->baseVal()->getFirst()->value() : 0; +    float yOffset = \
text->y()->baseVal()->getFirst() ? text->y()->baseVal()->getFirst()->value() : 0; +
+    xOffset += parentX;
+    yOffset += parentY;
     
     context->concatCTM(localTransform());
-    context->concatCTM(QMatrix().translate(parentX, parentY));
-    context->concatCTM(translationForAttributes());
     context->concatCTM(translationTopToBaseline());
-    
+   
     QRectF boundingBox(0, 0, width(), height());
     const KSVG::SVGRenderStyle *svgStyle = style()->svgStyle();
 
@@ -89,7 +86,7 @@
 
         if(fillPaintServer->setup(context, this, APPLY_TO_FILL))
         {
-            RenderBlock::paint(paintInfo, 0, 0);
+            RenderBlock::paint(paintInfo, xOffset, yOffset);
             fillPaintServer->teardown(context, this, APPLY_TO_FILL);
         }
 
@@ -104,7 +101,7 @@
 
         if(strokePaintServer->setup(context, this, APPLY_TO_STROKE))
         {
-            RenderBlock::paint(paintInfo, 0, 0);
+            RenderBlock::paint(paintInfo, xOffset, yOffset);
             strokePaintServer->teardown(context, this, APPLY_TO_STROKE);
         }
 
@@ -123,8 +120,7 @@
 
 bool RenderSVGText::nodeAtPoint(NodeInfo &info, int _x, int _y, int _tx, int _ty, \
HitTestAction hitTestAction, bool inBox)  {
-    QMatrix totalTransform = translationForAttributes();
-    totalTransform *= translationTopToBaseline();
+    QMatrix totalTransform = translationTopToBaseline();
     totalTransform *= absoluteTransform();
 
     double localX, localY;
--- branches/work/khtml-svg/rendering/render_svg_text.h #527030:527031
@@ -44,12 +44,11 @@
         
         virtual QMatrix localTransform() const { return m_transform; }
         virtual void setLocalTransform(const QMatrix &transform) { m_transform = \
                transform; }
-        
+
         virtual bool nodeAtPoint(NodeInfo &info, int _x, int _y, int _tx, int _ty, \
HitTestAction hitTestAction, bool inBox);  
      private:
         QMatrix translationTopToBaseline();
-        QMatrix translationForAttributes();
 
         QMatrix m_transform;
     };    


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic