r17288 by jghali - some refactoring of graphics related function :

scribus-commit scribus-commit at lists.scribus.net
Fri Feb 10 22:20:30 UTC 2012


Author: jghali
Date: Fri Feb 10 22:20:30 2012
New Revision: 17288

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17288
Log:
some refactoring of graphics related function :
- improve readability by removing some unnecessary indentation levels
- split ScPainter::drawVPath() functions
- remove unused fillPathText() and strokePathText() function from ScPainter

Modified:
    trunk/Scribus/scribus/pageitem_group.cpp
    trunk/Scribus/scribus/pageitem_imageframe.cpp
    trunk/Scribus/scribus/pageitem_line.cpp
    trunk/Scribus/scribus/pageitem_polyline.cpp
    trunk/Scribus/scribus/pageitem_spiral.cpp
    trunk/Scribus/scribus/pageitem_symbol.cpp
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/scpageoutput.h
    trunk/Scribus/scribus/scpainter.cpp
    trunk/Scribus/scribus/scpainter.h
    trunk/Scribus/scribus/scpainterex_ps2.cpp
    trunk/Scribus/scribus/scpainterex_ps2.h
    trunk/Scribus/scribus/scpainterexbase.h

Modified: trunk/Scribus/scribus/pageitem_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/pageitem_group.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_group.cpp (original)
+++ trunk/Scribus/scribus/pageitem_group.cpp Fri Feb 10 22:20:30 2012
@@ -112,147 +112,146 @@
 
 void PageItem_Group::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
-	if (!m_Doc->RePos)
-	{
-		if (!groupItemList.isEmpty())
+	if (m_Doc->RePos)
+		return;
+
+	if (groupItemList.isEmpty())
+	{
+		if (m_Doc->guidesPrefs().framesShown)
 		{
 			p->save();
-			if (imageFlippedH())
+			p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			p->drawLine(FPoint(0, 0), FPoint(Width, Height));
+			p->drawLine(FPoint(0, Height), FPoint(Width, 0));
+			p->setFont(QApplication::font());
+			p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+			p->drawLine(FPoint(Width, 0), FPoint(Width, Height));
+			p->drawLine(FPoint(Width, Height), FPoint(0, Height));
+			p->drawLine(FPoint(0, Height), FPoint(0, 0));
+			p->setBrush(QColor(255, 255, 255));
+			p->setBrushOpacity(0.0);
+			p->drawText(QRectF(0.0, 0.0, Width, Height), "Empty Group");
+			p->restore();
+		}
+		return;
+	}
+
+	p->save();
+	if (imageFlippedH())
+	{
+		p->translate(Width, 0);
+		p->scale(-1, 1);
+	}
+	if (imageFlippedV())
+	{
+		p->translate(0, Height);
+		p->scale(1, -1);
+	}
+	if ((maskType() == 1) || (maskType() == 2) || (maskType() == 4) || (maskType() == 5))
+	{
+		if ((maskType() == 1) || (maskType() == 2))
+			p->setMaskMode(1);
+		else
+			p->setMaskMode(3);
+		if ((!gradientMask().isEmpty()) && (!m_Doc->docGradients.contains(gradientMask())))
+			gradientMaskVal = "";
+		if (!(gradientMask().isEmpty()) && (m_Doc->docGradients.contains(gradientMask())))
+			mask_gradient = m_Doc->docGradients[gradientMask()];
+		p->mask_gradient = mask_gradient;
+		if ((maskType() == 1) || (maskType() == 4))
+			p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew);
+		else
+			p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew);
+	}
+	else if ((maskType() == 3) || (maskType() == 6) || (maskType() == 7) || (maskType() == 8))
+	{
+		if ((patternMask().isEmpty()) || (!m_Doc->docPatterns.contains(patternMask())))
+			p->setMaskMode(0);
+		else
+		{
+			double scw = Width / groupWidth;
+			double sch = Height / groupHeight;
+			p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
+			if (maskType() == 3)
+				p->setMaskMode(2);
+			else if (maskType() == 6)
+				p->setMaskMode(4);
+			else if (maskType() == 7)
+				p->setMaskMode(5);
+			else
+				p->setMaskMode(6);
+		}
+	}
+	else
+		p->setMaskMode(0);
+	p->setFillRule(fillRule);
+	p->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
+	p->setMaskMode(0);
+	p->scale(Width / groupWidth, Height / groupHeight);
+	for (int em = 0; em < groupItemList.count(); ++em)
+	{
+		PageItem* embedded = groupItemList.at(em);
+		p->save();
+		p->translate(embedded->gXpos, embedded->gYpos);
+		embedded->isEmbedded = true;
+		embedded->invalidateLayout();
+		embedded->DrawObj(p, QRectF());
+		embedded->isEmbedded = false;
+		p->restore();
+		if (m_Doc->guidesPrefs().framesShown)
+		{
+			p->save();
+			double x = embedded->xPos();
+			double y = embedded->yPos();
+			embedded->setXYPos(embedded->gXpos, embedded->gYpos, true);
+			embedded->DrawObj_Decoration(p);
+			embedded->setXYPos(x, y, true);
+			p->restore();
+		}
+		if (m_Doc->layerOutline(LayerID))
+		{
+			p->save();
+			p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			p->setFillMode(ScPainter::None);
+			p->setBrushOpacity(1.0);
+			p->setPenOpacity(1.0);
+			p->setupPolygon(&PoLine);
+			p->strokePath();
+			p->restore();
+		}
+	}
+	for (int em = 0; em < groupItemList.count(); ++em)
+	{
+		PageItem* embedded = groupItemList.at(em);
+		if (!embedded->isTableItem)
+			continue;
+		p->save();
+		p->translate(embedded->gXpos, embedded->gYpos);
+		p->rotate(embedded->rotation());
+		embedded->isEmbedded = true;
+		embedded->invalidateLayout();
+		if ((embedded->lineColor() != CommonStrings::None) && (embedded->lineWidth() != 0.0))
+		{
+			QColor tmp;
+			embedded->SetQColor(&tmp, embedded->lineColor(), embedded->lineShade());
+			if ((embedded->TopLine) || (embedded->RightLine) || (embedded->BottomLine) || (embedded->LeftLine))
 			{
-				p->translate(Width, 0);
-				p->scale(-1, 1);
+				p->setPen(tmp, embedded->lineWidth(), embedded->PLineArt, Qt::SquareCap, embedded->PLineJoin);
+				if (embedded->TopLine)
+					p->drawLine(FPoint(0.0, 0.0), FPoint(embedded->width(), 0.0));
+				if (embedded->RightLine)
+					p->drawLine(FPoint(embedded->width(), 0.0), FPoint(embedded->width(), embedded->height()));
+				if (embedded->BottomLine)
+					p->drawLine(FPoint(embedded->width(), embedded->height()), FPoint(0.0, embedded->height()));
+				if (embedded->LeftLine)
+					p->drawLine(FPoint(0.0, embedded->height()), FPoint(0.0, 0.0));
 			}
-			if (imageFlippedV())
-			{
-				p->translate(0, Height);
-				p->scale(1, -1);
-			}
-			if ((maskType() == 1) || (maskType() == 2) || (maskType() == 4) || (maskType() == 5))
-			{
-				if ((maskType() == 1) || (maskType() == 2))
-					p->setMaskMode(1);
-				else
-					p->setMaskMode(3);
-				if ((!gradientMask().isEmpty()) && (!m_Doc->docGradients.contains(gradientMask())))
-					gradientMaskVal = "";
-				if (!(gradientMask().isEmpty()) && (m_Doc->docGradients.contains(gradientMask())))
-					mask_gradient = m_Doc->docGradients[gradientMask()];
-				p->mask_gradient = mask_gradient;
-				if ((maskType() == 1) || (maskType() == 4))
-					p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew);
-				else
-					p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew);
-			}
-			else if ((maskType() == 3) || (maskType() == 6) || (maskType() == 7) || (maskType() == 8))
-			{
-				if ((patternMask().isEmpty()) || (!m_Doc->docPatterns.contains(patternMask())))
-					p->setMaskMode(0);
-				else
-				{
-					double scw = Width / groupWidth;
-					double sch = Height / groupHeight;
-					p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
-					if (maskType() == 3)
-						p->setMaskMode(2);
-					else if (maskType() == 6)
-						p->setMaskMode(4);
-					else if (maskType() == 7)
-						p->setMaskMode(5);
-					else
-						p->setMaskMode(6);
-				}
-			}
-			else
-				p->setMaskMode(0);
-			p->setFillRule(fillRule);
-			p->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
-			p->setMaskMode(0);
-			p->scale(Width / groupWidth, Height / groupHeight);
-			for (int em = 0; em < groupItemList.count(); ++em)
-			{
-				PageItem* embedded = groupItemList.at(em);
-				p->save();
-				p->translate(embedded->gXpos, embedded->gYpos);
-				embedded->isEmbedded = true;
-				embedded->invalidateLayout();
-				embedded->DrawObj(p, QRectF());
-				embedded->isEmbedded = false;
-				p->restore();
-				if (m_Doc->guidesPrefs().framesShown)
-				{
-					p->save();
-					double x = embedded->xPos();
-					double y = embedded->yPos();
-					embedded->setXYPos(embedded->gXpos, embedded->gYpos, true);
-					embedded->DrawObj_Decoration(p);
-					embedded->setXYPos(x, y, true);
-					p->restore();
-				}
-				if (m_Doc->layerOutline(LayerID))
-				{
-					p->save();
-					p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-					p->setFillMode(ScPainter::None);
-					p->setBrushOpacity(1.0);
-					p->setPenOpacity(1.0);
-					p->setupPolygon(&PoLine);
-					p->strokePath();
-					p->restore();
-				}
-			}
-			for (int em = 0; em < groupItemList.count(); ++em)
-			{
-				PageItem* embedded = groupItemList.at(em);
-				if (!embedded->isTableItem)
-					continue;
-				p->save();
-				p->translate(embedded->gXpos, embedded->gYpos);
-				p->rotate(embedded->rotation());
-				embedded->isEmbedded = true;
-				embedded->invalidateLayout();
-				if ((embedded->lineColor() != CommonStrings::None) && (embedded->lineWidth() != 0.0))
-				{
-					QColor tmp;
-					embedded->SetQColor(&tmp, embedded->lineColor(), embedded->lineShade());
-					if ((embedded->TopLine) || (embedded->RightLine) || (embedded->BottomLine) || (embedded->LeftLine))
-					{
-						p->setPen(tmp, embedded->lineWidth(), embedded->PLineArt, Qt::SquareCap, embedded->PLineJoin);
-						if (embedded->TopLine)
-							p->drawLine(FPoint(0.0, 0.0), FPoint(embedded->width(), 0.0));
-						if (embedded->RightLine)
-							p->drawLine(FPoint(embedded->width(), 0.0), FPoint(embedded->width(), embedded->height()));
-						if (embedded->BottomLine)
-							p->drawLine(FPoint(embedded->width(), embedded->height()), FPoint(0.0, embedded->height()));
-						if (embedded->LeftLine)
-							p->drawLine(FPoint(0.0, embedded->height()), FPoint(0.0, 0.0));
-					}
-				}
-				embedded->isEmbedded = false;
-				p->restore();
-			}
-			p->endLayer();
-			p->restore();
-		}
-		else
-		{
-			if (m_Doc->guidesPrefs().framesShown)
-			{
-				p->save();
-				p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-				p->drawLine(FPoint(0, 0), FPoint(Width, Height));
-				p->drawLine(FPoint(0, Height), FPoint(Width, 0));
-				p->setFont(QApplication::font());
-				p->drawLine(FPoint(0, 0), FPoint(Width, 0));
-				p->drawLine(FPoint(Width, 0), FPoint(Width, Height));
-				p->drawLine(FPoint(Width, Height), FPoint(0, Height));
-				p->drawLine(FPoint(0, Height), FPoint(0, 0));
-				p->setBrush(QColor(255, 255, 255));
-				p->setBrushOpacity(0.0);
-				p->drawText(QRectF(0.0, 0.0, Width, Height), "Empty Group");
-				p->restore();
-			}
-		}
-	}
+		}
+		embedded->isEmbedded = false;
+		p->restore();
+	}
+	p->endLayer();
+	p->restore();
 }
 
 void PageItem_Group::applicableActions(QStringList & actionList)

Modified: trunk/Scribus/scribus/pageitem_imageframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/pageitem_imageframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_imageframe.cpp (original)
+++ trunk/Scribus/scribus/pageitem_imageframe.cpp Fri Feb 10 22:20:30 2012
@@ -68,144 +68,143 @@
 
 void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
-	if(!m_Doc->RePos)
-	{
-		if (!m_Doc->layerOutline(LayerID))
-		{
-			p->setFillRule(true);
-			if ((fillColor() != CommonStrings::None) || (GrType != 0))
-			{
-				p->setupPolygon(&PoLine);
-				p->fillPath();
-			}
-			p->save();
-			if (Pfile.isEmpty())
-			{
-				if ((Frame) && (m_Doc->guidesPrefs().framesShown))
+	if (m_Doc->RePos)
+		return;
+	if (m_Doc->layerOutline(LayerID))
+		return;
+
+	p->setFillRule(true);
+	if ((fillColor() != CommonStrings::None) || (GrType != 0))
+	{
+		p->setupPolygon(&PoLine);
+		p->fillPath();
+	}
+	p->save();
+	if (Pfile.isEmpty())
+	{
+		if ((Frame) && (m_Doc->guidesPrefs().framesShown))
+		{
+			p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			p->drawLine(FPoint(0, 0), FPoint(Width, Height));
+			p->drawLine(FPoint(0, Height), FPoint(Width, 0));
+		}
+	}
+	else
+	{
+		//If we are missing our image, draw a red cross in the frame
+		if ((!PicArt) || (!PictureIsAvailable))
+		{
+			if ((Frame) && (m_Doc->guidesPrefs().framesShown))
+			{
+				p->setBrush(Qt::white);
+				QString htmlText = "";
+				QFileInfo fi = QFileInfo(Pfile);
+				if (PictureIsAvailable)
 				{
 					p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-					p->drawLine(FPoint(0, 0), FPoint(Width, Height));
-					p->drawLine(FPoint(0, Height), FPoint(Width, 0));
-				}
-			}
-			else
-			{
-				//If we are missing our image, draw a red cross in the frame
-				if ((!PicArt) || (!PictureIsAvailable))
-				{
-					if ((Frame) && (m_Doc->guidesPrefs().framesShown))
+					if (isInlineImage)
+						htmlText.append( tr("Embedded Image") + "\n");
+					else
+						htmlText.append( tr("File:") + " " + fi.fileName() + "\n");
+					htmlText.append( tr("Original PPI:") + " " + QString::number(qRound(pixm.imgInfo.xres))+" x "+QString::number(qRound(pixm.imgInfo.yres)) + "\n");
+					htmlText.append( tr("Actual PPI:") + " " + QString::number(qRound(72.0 / imageXScale()))+" x "+ QString::number(qRound(72.0 / imageYScale())) + "\n");
+					htmlText.append( tr("Size:") + " " + QString::number(OrigW) + " x " + QString::number(OrigH) + "\n");
+					htmlText.append( tr("Colorspace:") + " ");
+					QString cSpace;
+					QString ext = fi.suffix().toLower();
+					if ((extensionIndicatesPDF(ext) || extensionIndicatesEPSorPS(ext)) && (pixm.imgInfo.type != ImageType7))
+						htmlText.append( tr("Unknown"));
+					else
+						htmlText.append(colorSpaceText(pixm.imgInfo.colorspace));
+					if (pixm.imgInfo.numberOfPages > 1)
 					{
-						p->setBrush(Qt::white);
-						QString htmlText = "";
-						QFileInfo fi = QFileInfo(Pfile);
-						if (PictureIsAvailable)
-						{
-							p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-							if (isInlineImage)
-								htmlText.append( tr("Embedded Image") + "\n");
-							else
-								htmlText.append( tr("File:") + " " + fi.fileName() + "\n");
-							htmlText.append( tr("Original PPI:") + " " + QString::number(qRound(pixm.imgInfo.xres))+" x "+QString::number(qRound(pixm.imgInfo.yres)) + "\n");
-							htmlText.append( tr("Actual PPI:") + " " + QString::number(qRound(72.0 / imageXScale()))+" x "+ QString::number(qRound(72.0 / imageYScale())) + "\n");
-							htmlText.append( tr("Size:") + " " + QString::number(OrigW) + " x " + QString::number(OrigH) + "\n");
-							htmlText.append( tr("Colorspace:") + " ");
-							QString cSpace;
-							QString ext = fi.suffix().toLower();
-							if ((extensionIndicatesPDF(ext) || extensionIndicatesEPSorPS(ext)) && (pixm.imgInfo.type != ImageType7))
-								htmlText.append( tr("Unknown"));
-							else
-								htmlText.append(colorSpaceText(pixm.imgInfo.colorspace));
-							if (pixm.imgInfo.numberOfPages > 1)
-							{
-								htmlText.append("\n");
-								if (pixm.imgInfo.actualPageNumber > 0)
-									htmlText.append( tr("Page:") + " " + QString::number(pixm.imgInfo.actualPageNumber) + "/" + QString::number(pixm.imgInfo.numberOfPages));
-								else
-									htmlText.append( tr("Pages:") + " " + QString::number(pixm.imgInfo.numberOfPages));
-							}
-						}
+						htmlText.append("\n");
+						if (pixm.imgInfo.actualPageNumber > 0)
+							htmlText.append( tr("Page:") + " " + QString::number(pixm.imgInfo.actualPageNumber) + "/" + QString::number(pixm.imgInfo.numberOfPages));
 						else
-						{
-							p->setPen(Qt::red, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-							htmlText = fi.fileName();
-						}
-						p->drawLine(FPoint(0, 0), FPoint(Width, Height));
-						p->drawLine(FPoint(0, Height), FPoint(Width, 0));
-						p->setFont(QApplication::font());
-						p->drawText(QRectF(0.0, 0.0, Width, Height), htmlText);
+							htmlText.append( tr("Pages:") + " " + QString::number(pixm.imgInfo.numberOfPages));
 					}
 				}
 				else
 				{
-					p->setupPolygon(&PoLine);
-					p->setClipPath();
-					if (imageFlippedH())
-					{
-						p->translate(Width, 0);
-						p->scale(-1, 1);
-					}
-					if (imageFlippedV())
-					{
-						p->translate(0, Height);
-						p->scale(1, -1);
-					}
-					if (imageClip.size() != 0)
-					{
-						p->setupPolygon(&imageClip);
-						p->setClipPath();
-					}
-					p->translate(LocalX*LocalScX, LocalY*LocalScY);
-					p->rotate(LocalRot);
-					double mscalex = 1.0 / LocalScX;
-					double mscaley = 1.0 / LocalScY;
-					p->scale(LocalScX, LocalScY);
-					if (pixm.imgInfo.lowResType != 0)
-					{
-						p->scale(pixm.imgInfo.lowResScale, pixm.imgInfo.lowResScale);
-						mscalex *= 1.0 / pixm.imgInfo.lowResScale;
-						mscaley *= 1.0 / pixm.imgInfo.lowResScale;
-					}
-					if ((GrMask == 1) || (GrMask == 2) || (GrMask == 4) || (GrMask == 5))
-					{
-						if ((GrMask == 1) || (GrMask == 2))
-							p->setMaskMode(1);
-						else
-							p->setMaskMode(3);
-						if ((!gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientMaskVal)))
-							gradientMaskVal = "";
-						if (!(gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(gradientMaskVal)))
-							mask_gradient = m_Doc->docGradients[gradientMaskVal];
-						p->mask_gradient = mask_gradient;
-						if ((GrMask == 1) || (GrMask == 4))
-							p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX * mscalex, GrMaskStartY * mscaley), FPoint(GrMaskEndX * mscalex, GrMaskEndY * mscaley), FPoint(GrMaskStartX * mscalex, GrMaskStartY * mscaley), GrMaskScale, GrMaskSkew);
-						else
-							p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX * mscalex, GrMaskStartY * mscaley), FPoint(GrMaskEndX * mscalex, GrMaskEndY * mscaley), FPoint(GrMaskFocalX * mscalex, GrMaskFocalY * mscaley), GrMaskScale, GrMaskSkew);
-					}
-					else if ((GrMask == 3) || (GrMask == 6) || (GrMask == 7) || (GrMask == 8))
-					{
-						if ((patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternMaskVal)))
-							p->setMaskMode(0);
-						else
-						{
-							p->setPatternMask(&m_Doc->docPatterns[patternMaskVal], patternMaskScaleX * mscalex, patternMaskScaleY * mscaley, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
-							if (GrMask == 3)
-								p->setMaskMode(2);
-							else if (GrMask == 6)
-								p->setMaskMode(4);
-							else if (GrMask == 7)
-								p->setMaskMode(5);
-							else
-								p->setMaskMode(6);
-						}
-					}
+					p->setPen(Qt::red, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+					htmlText = fi.fileName();
+				}
+				p->drawLine(FPoint(0, 0), FPoint(Width, Height));
+				p->drawLine(FPoint(0, Height), FPoint(Width, 0));
+				p->setFont(QApplication::font());
+				p->drawText(QRectF(0.0, 0.0, Width, Height), htmlText);
+			}
+		}
+		else
+		{
+			p->setupPolygon(&PoLine);
+			p->setClipPath();
+			if (imageFlippedH())
+			{
+				p->translate(Width, 0);
+				p->scale(-1, 1);
+			}
+			if (imageFlippedV())
+			{
+				p->translate(0, Height);
+				p->scale(1, -1);
+			}
+			if (imageClip.size() != 0)
+			{
+				p->setupPolygon(&imageClip);
+				p->setClipPath();
+			}
+			p->translate(LocalX*LocalScX, LocalY*LocalScY);
+			p->rotate(LocalRot);
+			double mscalex = 1.0 / LocalScX;
+			double mscaley = 1.0 / LocalScY;
+			p->scale(LocalScX, LocalScY);
+			if (pixm.imgInfo.lowResType != 0)
+			{
+				p->scale(pixm.imgInfo.lowResScale, pixm.imgInfo.lowResScale);
+				mscalex *= 1.0 / pixm.imgInfo.lowResScale;
+				mscaley *= 1.0 / pixm.imgInfo.lowResScale;
+			}
+			if ((GrMask == 1) || (GrMask == 2) || (GrMask == 4) || (GrMask == 5))
+			{
+				if ((GrMask == 1) || (GrMask == 2))
+					p->setMaskMode(1);
+				else
+					p->setMaskMode(3);
+				if ((!gradientMaskVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientMaskVal)))
+					gradientMaskVal = "";
+				if (!(gradientMaskVal.isEmpty()) && (m_Doc->docGradients.contains(gradientMaskVal)))
+					mask_gradient = m_Doc->docGradients[gradientMaskVal];
+				p->mask_gradient = mask_gradient;
+				if ((GrMask == 1) || (GrMask == 4))
+					p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX * mscalex, GrMaskStartY * mscaley), FPoint(GrMaskEndX * mscalex, GrMaskEndY * mscaley), FPoint(GrMaskStartX * mscalex, GrMaskStartY * mscaley), GrMaskScale, GrMaskSkew);
+				else
+					p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX * mscalex, GrMaskStartY * mscaley), FPoint(GrMaskEndX * mscalex, GrMaskEndY * mscaley), FPoint(GrMaskFocalX * mscalex, GrMaskFocalY * mscaley), GrMaskScale, GrMaskSkew);
+			}
+			else if ((GrMask == 3) || (GrMask == 6) || (GrMask == 7) || (GrMask == 8))
+			{
+				if ((patternMaskVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternMaskVal)))
+					p->setMaskMode(0);
+				else
+				{
+					p->setPatternMask(&m_Doc->docPatterns[patternMaskVal], patternMaskScaleX * mscalex, patternMaskScaleY * mscaley, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
+					if (GrMask == 3)
+						p->setMaskMode(2);
+					else if (GrMask == 6)
+						p->setMaskMode(4);
+					else if (GrMask == 7)
+						p->setMaskMode(5);
 					else
-						p->setMaskMode(0);
-					p->drawImage(pixm.qImagePtr());
+						p->setMaskMode(6);
 				}
 			}
-			p->restore();
-		}
-	}
+			else
+				p->setMaskMode(0);
+			p->drawImage(pixm.qImagePtr());
+		}
+	}
+	p->restore();
 }
 
 void PageItem_ImageFrame::clearContents()

Modified: trunk/Scribus/scribus/pageitem_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/pageitem_line.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_line.cpp (original)
+++ trunk/Scribus/scribus/pageitem_line.cpp Fri Feb 10 22:20:30 2012
@@ -49,94 +49,94 @@
 
 void PageItem_Line::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
-	if (!m_Doc->RePos)
+	if (m_Doc->RePos)
+		return;
+
+	if (m_Doc->layerOutline(LayerID))
+		p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+	else
 	{
-		if (m_Doc->layerOutline(LayerID))
-			p->drawLine(FPoint(0, 0), FPoint(Width, 0));
-		else
+		if (NamedLStyle.isEmpty())
 		{
-			if (NamedLStyle.isEmpty())
+			if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
 			{
-				if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
+				if (patternStrokePath)
 				{
-					if (patternStrokePath)
-					{
-						QPainterPath guidePath;
-						guidePath.moveTo(0, 0);
-						guidePath.lineTo(Width, 0);
-						DrawStrokePattern(p, guidePath);
-					}
-					else
-					{
-						p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
-						p->setStrokeMode(ScPainter::Pattern);
-						p->drawLine(FPoint(0, 0), FPoint(Width, 0));
-					}
+					QPainterPath guidePath;
+					guidePath.moveTo(0, 0);
+					guidePath.lineTo(Width, 0);
+					DrawStrokePattern(p, guidePath);
 				}
-				else if (GrTypeStroke > 0)
+				else
 				{
-					if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
-						gradientStrokeVal = "";
-					if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
-						stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
-					if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
-					{
-						if (lineColor() != CommonStrings::None)
-						{
-							p->setBrush(strokeQColor);
-							p->setStrokeMode(ScPainter::Solid);
-						}
-						else
-							p->setStrokeMode(ScPainter::None);
-					}
-					else
-					{
-						p->setStrokeMode(ScPainter::Gradient);
-						p->stroke_gradient = stroke_gradient;
-						if (GrTypeStroke == 6)
-							p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
-						else
-							p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
-					}
-					p->drawLine(FPoint(0, 0), FPoint(Width, 0));
-				}
-				else if (lineColor() != CommonStrings::None)
-				{
-					p->setStrokeMode(ScPainter::Solid);
+					p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+					p->setStrokeMode(ScPainter::Pattern);
 					p->drawLine(FPoint(0, 0), FPoint(Width, 0));
 				}
 			}
-			else
+			else if (GrTypeStroke > 0)
+			{
+				if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
+					gradientStrokeVal = "";
+				if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
+					stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
+				if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+				{
+					if (lineColor() != CommonStrings::None)
+					{
+						p->setBrush(strokeQColor);
+						p->setStrokeMode(ScPainter::Solid);
+					}
+					else
+						p->setStrokeMode(ScPainter::None);
+				}
+				else
+				{
+					p->setStrokeMode(ScPainter::Gradient);
+					p->stroke_gradient = stroke_gradient;
+					if (GrTypeStroke == 6)
+						p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
+					else
+						p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
+				}
+				p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+			}
+			else if (lineColor() != CommonStrings::None)
 			{
 				p->setStrokeMode(ScPainter::Solid);
-				multiLine ml = m_Doc->MLineStyles[NamedLStyle];
-				QColor tmp;
-				for (int it = ml.size()-1; it > -1; it--)
+				p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+			}
+		}
+		else
+		{
+			p->setStrokeMode(ScPainter::Solid);
+			multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+			QColor tmp;
+			for (int it = ml.size()-1; it > -1; it--)
+			{
+				if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
 				{
-					if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
-					{
-						SetQColor(&tmp, ml[it].Color, ml[it].Shade);
-						p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
-						p->drawLine(FPoint(0, 0), FPoint(Width, 0));
-					}
+					SetQColor(&tmp, ml[it].Color, ml[it].Shade);
+					p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
+					p->drawLine(FPoint(0, 0), FPoint(Width, 0));
 				}
 			}
 		}
-		if (m_startArrowIndex != 0)
-		{
-			QTransform arrowTrans;
-			arrowTrans.translate(0, 0);
-			arrowTrans.scale(-1,1);
-			arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
-			drawArrow(p, arrowTrans, m_startArrowIndex);
-		}
-		if (m_endArrowIndex != 0)
-		{
-			QTransform arrowTrans;
-			arrowTrans.translate(Width, 0);
-			arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
-			drawArrow(p, arrowTrans, m_endArrowIndex);
-		}
+	}
+	if (m_startArrowIndex != 0)
+	{
+		QTransform arrowTrans;
+		arrowTrans.translate(0, 0);
+		arrowTrans.scale(-1,1);
+		arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
+		drawArrow(p, arrowTrans, m_startArrowIndex);
+	}
+	if (m_endArrowIndex != 0)
+	{
+		QTransform arrowTrans;
+		arrowTrans.translate(Width, 0);
+		arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
+		drawArrow(p, arrowTrans, m_endArrowIndex);
 	}
 }
 

Modified: trunk/Scribus/scribus/pageitem_polyline.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/pageitem_polyline.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_polyline.cpp (original)
+++ trunk/Scribus/scribus/pageitem_polyline.cpp Fri Feb 10 22:20:30 2012
@@ -52,151 +52,151 @@
 
 void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
-	if (!m_Doc->RePos && PoLine.size()>=4)
+	if (m_Doc->RePos || PoLine.size() < 4)
+		return;
+
+	if (!m_Doc->layerOutline(LayerID))
 	{
-		if (!m_Doc->layerOutline(LayerID))
-		{
-			if ((fillColor() != CommonStrings::None) || (GrType != 0))
-			{
-				FPointArray cli;
-				FPoint Start;
-				bool firstp = true;
-				for (uint n = 0; n < PoLine.size()-3; n += 4)
-				{
-					if (firstp)
-					{
-						Start = PoLine.point(n);
-						firstp = false;
-					}
-					if (PoLine.point(n).x() > 900000)
-					{
-						cli.addPoint(PoLine.point(n-2));
-						cli.addPoint(PoLine.point(n-2));
-						cli.addPoint(Start);
-						cli.addPoint(Start);
-						cli.setMarker();
-						firstp = true;
-						continue;
-					}
-					cli.addPoint(PoLine.point(n));
-					cli.addPoint(PoLine.point(n+1));
-					cli.addPoint(PoLine.point(n+2));
-					cli.addPoint(PoLine.point(n+3));
-				}
-				if (cli.size() > 2)
-				{
-					FPoint l1 = cli.point(cli.size()-2);
-					cli.addPoint(l1);
-					cli.addPoint(l1);
+		if ((fillColor() != CommonStrings::None) || (GrType != 0))
+		{
+			FPointArray cli;
+			FPoint Start;
+			bool firstp = true;
+			for (uint n = 0; n < PoLine.size()-3; n += 4)
+			{
+				if (firstp)
+				{
+					Start = PoLine.point(n);
+					firstp = false;
+				}
+				if (PoLine.point(n).x() > 900000)
+				{
+					cli.addPoint(PoLine.point(n-2));
+					cli.addPoint(PoLine.point(n-2));
 					cli.addPoint(Start);
 					cli.addPoint(Start);
-				}
-				p->setupPolygon(&cli);
-				p->fillPath();
-			}
-			p->setupPolygon(&PoLine, false);
-			if (NamedLStyle.isEmpty())
-			{
-				if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
-				{
-					if (patternStrokePath)
+					cli.setMarker();
+					firstp = true;
+					continue;
+				}
+				cli.addPoint(PoLine.point(n));
+				cli.addPoint(PoLine.point(n+1));
+				cli.addPoint(PoLine.point(n+2));
+				cli.addPoint(PoLine.point(n+3));
+			}
+			if (cli.size() > 2)
+			{
+				FPoint l1 = cli.point(cli.size()-2);
+				cli.addPoint(l1);
+				cli.addPoint(l1);
+				cli.addPoint(Start);
+				cli.addPoint(Start);
+			}
+			p->setupPolygon(&cli);
+			p->fillPath();
+		}
+		p->setupPolygon(&PoLine, false);
+		if (NamedLStyle.isEmpty())
+		{
+			if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
+			{
+				if (patternStrokePath)
+				{
+					QPainterPath guidePath = PoLine.toQPainterPath(false);
+					DrawStrokePattern(p, guidePath);
+				}
+				else
+				{
+					p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+					p->setStrokeMode(ScPainter::Pattern);
+					p->strokePath();
+				}
+			}
+			else if (GrTypeStroke > 0)
+			{
+				if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
+					gradientStrokeVal = "";
+				if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
+					stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
+				if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+				{
+					if (lineColor() != CommonStrings::None)
 					{
-						QPainterPath guidePath = PoLine.toQPainterPath(false);
-						DrawStrokePattern(p, guidePath);
+						p->setBrush(strokeQColor);
+						p->setStrokeMode(ScPainter::Solid);
 					}
 					else
-					{
-						p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
-						p->setStrokeMode(ScPainter::Pattern);
-						p->strokePath();
-					}
-				}
-				else if (GrTypeStroke > 0)
-				{
-					if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
-						gradientStrokeVal = "";
-					if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
-						stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
-					if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
-					{
-						if (lineColor() != CommonStrings::None)
-						{
-							p->setBrush(strokeQColor);
-							p->setStrokeMode(ScPainter::Solid);
-						}
-						else
-							p->setStrokeMode(ScPainter::None);
-					}
+						p->setStrokeMode(ScPainter::None);
+				}
+				else
+				{
+					p->setStrokeMode(ScPainter::Gradient);
+					p->stroke_gradient = stroke_gradient;
+					if (GrTypeStroke == 6)
+						p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
 					else
-					{
-						p->setStrokeMode(ScPainter::Gradient);
-						p->stroke_gradient = stroke_gradient;
-						if (GrTypeStroke == 6)
-							p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
-						else
-							p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
-					}
+						p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
+				}
+				p->strokePath();
+			}
+			else if (lineColor() != CommonStrings::None)
+			{
+				p->setStrokeMode(ScPainter::Solid);
+				p->strokePath();
+			}
+		}
+		else
+		{
+			p->setStrokeMode(ScPainter::Solid);
+			multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+			QColor tmp;
+			for (int it = ml.size()-1; it > -1; it--)
+			{
+				if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
+				{
+					SetQColor(&tmp, ml[it].Color, ml[it].Shade);
+					p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
 					p->strokePath();
 				}
-				else if (lineColor() != CommonStrings::None)
-				{
-					p->setStrokeMode(ScPainter::Solid);
-					p->strokePath();
-				}
-			}
-			else
-			{
-				p->setStrokeMode(ScPainter::Solid);
-				multiLine ml = m_Doc->MLineStyles[NamedLStyle];
-				QColor tmp;
-				for (int it = ml.size()-1; it > -1; it--)
-				{
-					if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
-					{
-						SetQColor(&tmp, ml[it].Color, ml[it].Shade);
-						p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
-						p->strokePath();
-					}
-				}
-			}
-		}
-		if (m_startArrowIndex != 0)
-		{
-			FPoint Start = PoLine.point(0);
-			for (uint xx = 1; xx < PoLine.size(); xx += 2)
-			{
-				FPoint Vector = PoLine.point(xx);
-				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
-				{
-					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(Start.x(), Start.y());
-					arrowTrans.rotate(r);
-					arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
-					drawArrow(p, arrowTrans, m_startArrowIndex);
-					break;
-				}
-			}
-		}
-		if (m_endArrowIndex != 0)
-		{
-			FPoint End = PoLine.point(PoLine.size()-2);
-			for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
-			{
-				FPoint Vector = PoLine.point(xx);
-				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
-				{
-					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(End.x(), End.y());
-					arrowTrans.rotate(r);
-					arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
-					drawArrow(p, arrowTrans, m_endArrowIndex);
-					break;
-				}
 			}
 		}
 	}
+	if (m_startArrowIndex != 0)
+	{
+		FPoint Start = PoLine.point(0);
+		for (uint xx = 1; xx < PoLine.size(); xx += 2)
+		{
+			FPoint Vector = PoLine.point(xx);
+			if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
+			{
+				double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(Start.x(), Start.y());
+				arrowTrans.rotate(r);
+				arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
+				drawArrow(p, arrowTrans, m_startArrowIndex);
+				break;
+			}
+		}
+	}
+	if (m_endArrowIndex != 0)
+	{
+		FPoint End = PoLine.point(PoLine.size()-2);
+		for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
+		{
+			FPoint Vector = PoLine.point(xx);
+			if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
+			{
+				double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(End.x(), End.y());
+				arrowTrans.rotate(r);
+				arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
+				drawArrow(p, arrowTrans, m_endArrowIndex);
+				break;
+			}
+		}
+	}
 }
 
 void PageItem_PolyLine::applicableActions(QStringList & actionList)

Modified: trunk/Scribus/scribus/pageitem_spiral.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/pageitem_spiral.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_spiral.cpp (original)
+++ trunk/Scribus/scribus/pageitem_spiral.cpp Fri Feb 10 22:20:30 2012
@@ -58,148 +58,148 @@
 
 void PageItem_Spiral::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
-	if (!m_Doc->RePos && PoLine.size()>=4)
-	{
-		if (!m_Doc->layerOutline(LayerID))
-		{
-			if ((fillColor() != CommonStrings::None) || (GrType != 0))
-			{
-				FPointArray cli;
-				FPoint Start;
-				bool firstp = true;
-				for (uint n = 0; n < PoLine.size()-3; n += 4)
-				{
-					if (firstp)
-					{
-						Start = PoLine.point(n);
-						firstp = false;
-					}
-					if (PoLine.point(n).x() > 900000)
-					{
-						cli.addPoint(PoLine.point(n-2));
-						cli.addPoint(PoLine.point(n-2));
-						cli.addPoint(Start);
-						cli.addPoint(Start);
-						cli.setMarker();
-						firstp = true;
-						continue;
-					}
-					cli.addPoint(PoLine.point(n));
-					cli.addPoint(PoLine.point(n+1));
-					cli.addPoint(PoLine.point(n+2));
-					cli.addPoint(PoLine.point(n+3));
-				}
-				if (cli.size() > 2)
-				{
-					FPoint l1 = cli.point(cli.size()-2);
-					cli.addPoint(l1);
-					cli.addPoint(l1);
+	if (m_Doc->RePos || PoLine.size() < 4)
+		return;
+
+	if (!m_Doc->layerOutline(LayerID))
+	{
+		if ((fillColor() != CommonStrings::None) || (GrType != 0))
+		{
+			FPointArray cli;
+			FPoint Start;
+			bool firstp = true;
+			for (uint n = 0; n < PoLine.size()-3; n += 4)
+			{
+				if (firstp)
+				{
+					Start = PoLine.point(n);
+					firstp = false;
+				}
+				if (PoLine.point(n).x() > 900000)
+				{
+					cli.addPoint(PoLine.point(n-2));
+					cli.addPoint(PoLine.point(n-2));
 					cli.addPoint(Start);
 					cli.addPoint(Start);
-				}
-				p->setupPolygon(&cli);
-				p->fillPath();
-			}
-			p->setupPolygon(&PoLine, false);
-			if (NamedLStyle.isEmpty())
-			{
-				if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
-				{
-					if (patternStrokePath)
+					cli.setMarker();
+					firstp = true;
+					continue;
+				}
+				cli.addPoint(PoLine.point(n));
+				cli.addPoint(PoLine.point(n+1));
+				cli.addPoint(PoLine.point(n+2));
+				cli.addPoint(PoLine.point(n+3));
+			}
+			if (cli.size() > 2)
+			{
+				FPoint l1 = cli.point(cli.size()-2);
+				cli.addPoint(l1);
+				cli.addPoint(l1);
+				cli.addPoint(Start);
+				cli.addPoint(Start);
+			}
+			p->setupPolygon(&cli);
+			p->fillPath();
+		}
+		p->setupPolygon(&PoLine, false);
+		if (NamedLStyle.isEmpty())
+		{
+			if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)))
+			{
+				if (patternStrokePath)
+				{
+					QPainterPath guidePath = PoLine.toQPainterPath(false);
+					DrawStrokePattern(p, guidePath);
+				}
+				else
+				{
+					p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
+					p->setStrokeMode(ScPainter::Pattern);
+					p->strokePath();
+				}
+			}
+			else if (GrTypeStroke > 0)
+			{
+				if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
+					gradientStrokeVal = "";
+				if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
+					stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
+				if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
+				{
+					if (lineColor() != CommonStrings::None)
 					{
-						QPainterPath guidePath = PoLine.toQPainterPath(false);
-						DrawStrokePattern(p, guidePath);
+						p->setBrush(strokeQColor);
+						p->setStrokeMode(ScPainter::Solid);
 					}
 					else
-					{
-						p->setPattern(&m_Doc->docPatterns[patternStrokeVal], patternStrokeScaleX, patternStrokeScaleY, patternStrokeOffsetX, patternStrokeOffsetY, patternStrokeRotation, patternStrokeSkewX, patternStrokeSkewY, patternStrokeMirrorX, patternStrokeMirrorY);
-						p->setStrokeMode(ScPainter::Pattern);
-						p->strokePath();
-					}
-				}
-				else if (GrTypeStroke > 0)
-				{
-					if ((!gradientStrokeVal.isEmpty()) && (!m_Doc->docGradients.contains(gradientStrokeVal)))
-						gradientStrokeVal = "";
-					if (!(gradientStrokeVal.isEmpty()) && (m_Doc->docGradients.contains(gradientStrokeVal)))
-						stroke_gradient = m_Doc->docGradients[gradientStrokeVal];
-					if (stroke_gradient.Stops() < 2) // fall back to solid stroking if there are not enough colorstops in the gradient.
-					{
-						if (lineColor() != CommonStrings::None)
-						{
-							p->setBrush(strokeQColor);
-							p->setStrokeMode(ScPainter::Solid);
-						}
-						else
-							p->setStrokeMode(ScPainter::None);
-					}
+						p->setStrokeMode(ScPainter::None);
+				}
+				else
+				{
+					p->setStrokeMode(ScPainter::Gradient);
+					p->stroke_gradient = stroke_gradient;
+					if (GrTypeStroke == 6)
+						p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
 					else
-					{
-						p->setStrokeMode(ScPainter::Gradient);
-						p->stroke_gradient = stroke_gradient;
-						if (GrTypeStroke == 6)
-							p->setGradient(VGradient::linear, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeStartX, GrStrokeStartY), GrStrokeScale, GrStrokeSkew);
-						else
-							p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
-					}
+						p->setGradient(VGradient::radial, FPoint(GrStrokeStartX, GrStrokeStartY), FPoint(GrStrokeEndX, GrStrokeEndY), FPoint(GrStrokeFocalX, GrStrokeFocalY), GrStrokeScale, GrStrokeSkew);
+				}
+				p->strokePath();
+			}
+			else if (lineColor() != CommonStrings::None)
+			{
+				p->setStrokeMode(ScPainter::Solid);
+				p->strokePath();
+			}
+		}
+		else
+		{
+			p->setStrokeMode(ScPainter::Solid);
+			multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+			QColor tmp;
+			for (int it = ml.size()-1; it > -1; it--)
+			{
+				if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
+				{
+					SetQColor(&tmp, ml[it].Color, ml[it].Shade);
+					p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
 					p->strokePath();
 				}
-				else if (lineColor() != CommonStrings::None)
-				{
-					p->setStrokeMode(ScPainter::Solid);
-					p->strokePath();
-				}
-			}
-			else
-			{
-				p->setStrokeMode(ScPainter::Solid);
-				multiLine ml = m_Doc->MLineStyles[NamedLStyle];
-				QColor tmp;
-				for (int it = ml.size()-1; it > -1; it--)
-				{
-					if (ml[it].Color != CommonStrings::None) // && (ml[it].Width != 0))
-					{
-						SetQColor(&tmp, ml[it].Color, ml[it].Shade);
-						p->setPen(tmp, ml[it].Width, static_cast<Qt::PenStyle>(ml[it].Dash), static_cast<Qt::PenCapStyle>(ml[it].LineEnd), static_cast<Qt::PenJoinStyle>(ml[it].LineJoin));
-						p->strokePath();
-					}
-				}
-			}
-		}
-		if (m_startArrowIndex != 0)
-		{
-			FPoint Start = PoLine.point(0);
-			for (uint xx = 1; xx < PoLine.size(); xx += 2)
-			{
-				FPoint Vector = PoLine.point(xx);
-				if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
-				{
-					double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(Start.x(), Start.y());
-					arrowTrans.rotate(r);
-					arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
-					drawArrow(p, arrowTrans, m_startArrowIndex);
-					break;
-				}
-			}
-		}
-		if (m_endArrowIndex != 0)
-		{
-			FPoint End = PoLine.point(PoLine.size()-2);
-			for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
-			{
-				FPoint Vector = PoLine.point(xx);
-				if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
-				{
-					double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
-					QTransform arrowTrans;
-					arrowTrans.translate(End.x(), End.y());
-					arrowTrans.rotate(r);
-					arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
-					drawArrow(p, arrowTrans, m_endArrowIndex);
-					break;
-				}
+			}
+		}
+	}
+	if (m_startArrowIndex != 0)
+	{
+		FPoint Start = PoLine.point(0);
+		for (uint xx = 1; xx < PoLine.size(); xx += 2)
+		{
+			FPoint Vector = PoLine.point(xx);
+			if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
+			{
+				double r = atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(Start.x(), Start.y());
+				arrowTrans.rotate(r);
+				arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
+				drawArrow(p, arrowTrans, m_startArrowIndex);
+				break;
+			}
+		}
+	}
+	if (m_endArrowIndex != 0)
+	{
+		FPoint End = PoLine.point(PoLine.size()-2);
+		for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
+		{
+			FPoint Vector = PoLine.point(xx);
+			if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
+			{
+				double r = atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI);
+				QTransform arrowTrans;
+				arrowTrans.translate(End.x(), End.y());
+				arrowTrans.rotate(r);
+				arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
+				drawArrow(p, arrowTrans, m_endArrowIndex);
+				break;
 			}
 		}
 	}

Modified: trunk/Scribus/scribus/pageitem_symbol.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/pageitem_symbol.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_symbol.cpp (original)
+++ trunk/Scribus/scribus/pageitem_symbol.cpp Fri Feb 10 22:20:30 2012
@@ -53,136 +53,135 @@
 
 void PageItem_Symbol::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
-	if (!m_Doc->RePos)
+	if (m_Doc->RePos)
+		return;
+
+	if ((patternVal.isEmpty()) || (!m_Doc->docPatterns.contains(patternVal)))
 	{
-		if ((!patternVal.isEmpty()) && (m_Doc->docPatterns.contains(patternVal)))
+		if (m_Doc->guidesPrefs().framesShown)
 		{
 			p->save();
-			if (imageFlippedH())
+			p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			p->drawLine(FPoint(0, 0), FPoint(Width, Height));
+			p->drawLine(FPoint(0, Height), FPoint(Width, 0));
+			p->setFont(QApplication::font());
+			p->drawLine(FPoint(0, 0), FPoint(Width, 0));
+			p->drawLine(FPoint(Width, 0), FPoint(Width, Height));
+			p->drawLine(FPoint(Width, Height), FPoint(0, Height));
+			p->drawLine(FPoint(0, Height), FPoint(0, 0));
+			p->setBrush(QColor(255, 255, 255));
+			p->setBrushOpacity(0.0);
+			p->drawText(QRectF(0.0, 0.0, Width, Height), "Empty Symbol");
+			p->restore();
+		}
+		return;
+	}
+
+	p->save();
+	if (imageFlippedH())
+	{
+		p->translate(Width, 0);
+		p->scale(-1, 1);
+	}
+	if (imageFlippedV())
+	{
+		p->translate(0, Height);
+		p->scale(1, -1);
+	}
+	if ((maskType() == 1) || (maskType() == 2) || (maskType() == 4) || (maskType() == 5))
+	{
+		if ((maskType() == 1) || (maskType() == 2))
+			p->setMaskMode(1);
+		else
+			p->setMaskMode(3);
+		if ((!gradientMask().isEmpty()) && (!m_Doc->docGradients.contains(gradientMask())))
+			gradientMaskVal = "";
+		if (!(gradientMask().isEmpty()) && (m_Doc->docGradients.contains(gradientMask())))
+			mask_gradient = m_Doc->docGradients[gradientMask()];
+		p->mask_gradient = mask_gradient;
+		if ((maskType() == 1) || (maskType() == 4))
+			p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew);
+		else
+			p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew);
+	}
+	else if ((maskType() == 3) || (maskType() == 6) || (maskType() == 7) || (maskType() == 8))
+	{
+		if ((patternMask().isEmpty()) || (!m_Doc->docPatterns.contains(patternMask())))
+			p->setMaskMode(0);
+		else
+		{
+			double scw = Width / groupWidth;
+			double sch = Height / groupHeight;
+			p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
+			if (maskType() == 3)
+				p->setMaskMode(2);
+			else if (maskType() == 6)
+				p->setMaskMode(4);
+			else if (maskType() == 7)
+				p->setMaskMode(5);
+			else
+				p->setMaskMode(6);
+		}
+	}
+	else
+		p->setMaskMode(0);
+	p->setFillRule(fillRule);
+	p->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
+	p->setMaskMode(0);
+	ScPattern pat = m_Doc->docPatterns[patternVal];
+	p->scale(Width / pat.width, Height / pat.height);
+//		p->translate(pat.items.at(0)->gXpos, pat.items.at(0)->gYpos);
+	for (int em = 0; em < pat.items.count(); ++em)
+	{
+		PageItem* embedded = pat.items.at(em);
+		p->save();
+		p->translate(embedded->gXpos, embedded->gYpos);
+		embedded->isEmbedded = true;
+		embedded->invalid = true;
+		embedded->DrawObj(p, QRectF());
+		embedded->isEmbedded = false;
+		p->restore();
+	}
+	for (int em = 0; em < pat.items.count(); ++em)
+	{
+		PageItem* embedded = pat.items.at(em);
+		if (!embedded->isTableItem)
+			continue;
+		p->save();
+		p->translate(embedded->gXpos, embedded->gYpos);
+		p->rotate(embedded->rotation());
+		embedded->isEmbedded = true;
+		embedded->invalid = true;
+		if ((embedded->lineColor() != CommonStrings::None) && (embedded->lineWidth() != 0.0))
+		{
+			QColor tmp;
+			embedded->SetQColor(&tmp, embedded->lineColor(), embedded->lineShade());
+			if ((embedded->TopLine) || (embedded->RightLine) || (embedded->BottomLine) || (embedded->LeftLine))
 			{
-				p->translate(Width, 0);
-				p->scale(-1, 1);
-			}
-			if (imageFlippedV())
-			{
-				p->translate(0, Height);
-				p->scale(1, -1);
-			}
-			if ((maskType() == 1) || (maskType() == 2) || (maskType() == 4) || (maskType() == 5))
-			{
-				if ((maskType() == 1) || (maskType() == 2))
-					p->setMaskMode(1);
-				else
-					p->setMaskMode(3);
-				if ((!gradientMask().isEmpty()) && (!m_Doc->docGradients.contains(gradientMask())))
-					gradientMaskVal = "";
-				if (!(gradientMask().isEmpty()) && (m_Doc->docGradients.contains(gradientMask())))
-					mask_gradient = m_Doc->docGradients[gradientMask()];
-				p->mask_gradient = mask_gradient;
-				if ((maskType() == 1) || (maskType() == 4))
-					p->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew);
-				else
-					p->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew);
-			}
-			else if ((maskType() == 3) || (maskType() == 6) || (maskType() == 7) || (maskType() == 8))
-			{
-				if ((patternMask().isEmpty()) || (!m_Doc->docPatterns.contains(patternMask())))
-					p->setMaskMode(0);
-				else
-				{
-					double scw = Width / groupWidth;
-					double sch = Height / groupHeight;
-					p->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
-					if (maskType() == 3)
-						p->setMaskMode(2);
-					else if (maskType() == 6)
-						p->setMaskMode(4);
-					else if (maskType() == 7)
-						p->setMaskMode(5);
-					else
-						p->setMaskMode(6);
-				}
-			}
-			else
-				p->setMaskMode(0);
-			p->setFillRule(fillRule);
-			p->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
-			p->setMaskMode(0);
-			ScPattern pat = m_Doc->docPatterns[patternVal];
-			p->scale(Width / pat.width, Height / pat.height);
-	//		p->translate(pat.items.at(0)->gXpos, pat.items.at(0)->gYpos);
-			for (int em = 0; em < pat.items.count(); ++em)
-			{
-				PageItem* embedded = pat.items.at(em);
-				p->save();
-				p->translate(embedded->gXpos, embedded->gYpos);
-				embedded->isEmbedded = true;
-				embedded->invalid = true;
-				embedded->DrawObj(p, QRectF());
-				embedded->isEmbedded = false;
-				p->restore();
-			}
-			for (int em = 0; em < pat.items.count(); ++em)
-			{
-				PageItem* embedded = pat.items.at(em);
-				if (!embedded->isTableItem)
-					continue;
-				p->save();
-				p->translate(embedded->gXpos, embedded->gYpos);
-				p->rotate(embedded->rotation());
-				embedded->isEmbedded = true;
-				embedded->invalid = true;
-				if ((embedded->lineColor() != CommonStrings::None) && (embedded->lineWidth() != 0.0))
-				{
-					QColor tmp;
-					embedded->SetQColor(&tmp, embedded->lineColor(), embedded->lineShade());
-					if ((embedded->TopLine) || (embedded->RightLine) || (embedded->BottomLine) || (embedded->LeftLine))
-					{
-						p->setPen(tmp, embedded->lineWidth(), embedded->PLineArt, Qt::SquareCap, embedded->PLineJoin);
-						if (embedded->TopLine)
-							p->drawLine(FPoint(0.0, 0.0), FPoint(embedded->width(), 0.0));
-						if (embedded->RightLine)
-							p->drawLine(FPoint(embedded->width(), 0.0), FPoint(embedded->width(), embedded->height()));
-						if (embedded->BottomLine)
-							p->drawLine(FPoint(embedded->width(), embedded->height()), FPoint(0.0, embedded->height()));
-						if (embedded->LeftLine)
-							p->drawLine(FPoint(0.0, embedded->height()), FPoint(0.0, 0.0));
-					}
-				}
-				embedded->isEmbedded = false;
-				p->restore();
-			}
-			p->endLayer();
-			p->restore();
-			if (m_Doc->layerOutline(LayerID))
-			{
-				p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-				p->setFillMode(ScPainter::None);
-				p->setBrushOpacity(1.0);
-				p->setPenOpacity(1.0);
-				p->setupPolygon(&PoLine);
-				p->strokePath();
+				p->setPen(tmp, embedded->lineWidth(), embedded->PLineArt, Qt::SquareCap, embedded->PLineJoin);
+				if (embedded->TopLine)
+					p->drawLine(FPoint(0.0, 0.0), FPoint(embedded->width(), 0.0));
+				if (embedded->RightLine)
+					p->drawLine(FPoint(embedded->width(), 0.0), FPoint(embedded->width(), embedded->height()));
+				if (embedded->BottomLine)
+					p->drawLine(FPoint(embedded->width(), embedded->height()), FPoint(0.0, embedded->height()));
+				if (embedded->LeftLine)
+					p->drawLine(FPoint(0.0, embedded->height()), FPoint(0.0, 0.0));
 			}
 		}
-		else
-		{
-			if (m_Doc->guidesPrefs().framesShown)
-			{
-				p->save();
-				p->setPen(Qt::black, 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-				p->drawLine(FPoint(0, 0), FPoint(Width, Height));
-				p->drawLine(FPoint(0, Height), FPoint(Width, 0));
-				p->setFont(QApplication::font());
-				p->drawLine(FPoint(0, 0), FPoint(Width, 0));
-				p->drawLine(FPoint(Width, 0), FPoint(Width, Height));
-				p->drawLine(FPoint(Width, Height), FPoint(0, Height));
-				p->drawLine(FPoint(0, Height), FPoint(0, 0));
-				p->setBrush(QColor(255, 255, 255));
-				p->setBrushOpacity(0.0);
-				p->drawText(QRectF(0.0, 0.0, Width, Height), "Empty Symbol");
-				p->restore();
-			}
-		}
+		embedded->isEmbedded = false;
+		p->restore();
+	}
+	p->endLayer();
+	p->restore();
+	if (m_Doc->layerOutline(LayerID))
+	{
+		p->setPen(m_Doc->layerMarker(LayerID), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+		p->setFillMode(ScPainter::None);
+		p->setBrushOpacity(1.0);
+		p->setPenOpacity(1.0);
+		p->setupPolygon(&PoLine);
+		p->strokePath();
 	}
 }
 

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp (original)
+++ trunk/Scribus/scribus/scpageoutput.cpp Fri Feb 10 22:20:30 2012
@@ -14,6 +14,7 @@
 #include "cmsettings.h"
 #include "commonstrings.h"
 #include "pageitem.h"
+#include "pageitem_group.h"
 #include "pageitem_imageframe.h"
 #include "pageitem_line.h"
 #include "pageitem_pathtext.h"
@@ -280,17 +281,19 @@
 {
 	drawItem_Pre(item, painter);
 	PageItem::ItemType itemType = item->itemType();
-	if( itemType == PageItem::ImageFrame )
+	if (itemType == PageItem::Group)
+		drawItem_Group( (PageItem_Group*) item, painter, clip);
+	else if (itemType == PageItem::ImageFrame)
 		drawItem_ImageFrame( (PageItem_ImageFrame*) item, painter, clip);
-	else if( itemType == PageItem::Line )
+	else if (itemType == PageItem::Line)
 		drawItem_Line( (PageItem_Line*) item, painter, clip);
-	else if( itemType == PageItem::PathText )
+	else if (itemType == PageItem::PathText)
 		drawItem_PathText(  (PageItem_PathText*) item, painter, clip);
-	else if( itemType == PageItem::Polygon )
+	else if (itemType == PageItem::Polygon)
 		drawItem_Polygon( (PageItem_Polygon*) item, painter, clip);
-	else if( itemType == PageItem::PolyLine )
+	else if (itemType == PageItem::PolyLine)
 		drawItem_PolyLine( (PageItem_PolyLine*) item, painter, clip);
-	else if( itemType == PageItem::TextFrame )
+	else if (itemType == PageItem::TextFrame)
 		drawItem_TextFrame( (PageItem_TextFrame*) item, painter, clip);
 	drawItem_Post(item, painter);
 }
@@ -926,6 +929,107 @@
 
 }
 
+void ScPageOutput::drawItem_Group( PageItem_Group* item, ScPainterExBase* painter, const QRect& clip )
+{
+	if (item->groupItemList.isEmpty())
+		return;
+
+	painter->save();
+	if (item->imageFlippedH())
+	{
+		painter->translate(item->width(), 0);
+		painter->scale(-1, 1);
+	}
+	if (item->imageFlippedV())
+	{
+		painter->translate(0, item->height());
+		painter->scale(1, -1);
+	}
+	/*if ((maskType() == 1) || (maskType() == 2) || (maskType() == 4) || (maskType() == 5))
+	{
+		if ((maskType() == 1) || (maskType() == 2))
+			painter->setMaskMode(1);
+		else
+			painter->setMaskMode(3);
+		if ((!gradientMask().isEmpty()) && (!m_Doc->docGradients.contains(gradientMask())))
+			gradientMaskVal = "";
+		if (!(gradientMask().isEmpty()) && (m_Doc->docGradients.contains(gradientMask())))
+			mask_gradient = m_Doc->docGradients[gradientMask()];
+		painter->mask_gradient = mask_gradient;
+		if ((maskType() == 1) || (maskType() == 4))
+			painter->setGradientMask(VGradient::linear, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskStartX, GrMaskStartY), GrMaskScale, GrMaskSkew);
+		else
+			painter->setGradientMask(VGradient::radial, FPoint(GrMaskStartX, GrMaskStartY), FPoint(GrMaskEndX, GrMaskEndY), FPoint(GrMaskFocalX, GrMaskFocalY), GrMaskScale, GrMaskSkew);
+	}
+	else if ((maskType() == 3) || (maskType() == 6) || (maskType() == 7) || (maskType() == 8))
+	{
+		if ((patternMask().isEmpty()) || (!m_Doc->docPatterns.contains(patternMask())))
+			painter->setMaskMode(0);
+		else
+		{
+			double scw = Width / groupWidth;
+			double sch = Height / groupHeight;
+			painter->setPatternMask(&m_Doc->docPatterns[patternMask()], patternMaskScaleX * scw, patternMaskScaleY * sch, patternMaskOffsetX, patternMaskOffsetY, patternMaskRotation, patternMaskSkewX, patternMaskSkewY, patternMaskMirrorX, patternMaskMirrorY);
+			if (maskType() == 3)
+				painter->setMaskMode(2);
+			else if (maskType() == 6)
+				painter->setMaskMode(4);
+			else if (maskType() == 7)
+				painter->setMaskMode(5);
+			else
+				painter->setMaskMode(6);
+		}
+	}
+	else*/
+		painter->setMaskMode(0);
+	painter->setFillRule(item->fillRule);
+	//painter->beginLayer(1.0 - fillTransparency(), fillBlendmode(), &PoLine);
+	painter->setMaskMode(0);
+	painter->scale(item->width() / item->groupWidth, item->height() / item->groupHeight);
+	for (int em = 0; em < item->groupItemList.count(); ++em)
+	{
+		PageItem* embedded = item->groupItemList.at(em);
+		painter->save();
+		painter->translate(embedded->gXpos, embedded->gYpos);
+		embedded->isEmbedded = true;
+		embedded->invalidateLayout();
+		drawItem(embedded, painter, QRect());
+		embedded->isEmbedded = false;
+		painter->restore();
+	}
+	for (int em = 0; em < item->groupItemList.count(); ++em)
+	{
+		PageItem* embedded = item->groupItemList.at(em);
+		if (!embedded->isTableItem)
+			continue;
+		painter->save();
+		painter->translate(embedded->gXpos, embedded->gYpos);
+		painter->rotate(embedded->rotation());
+		embedded->isEmbedded = true;
+		embedded->invalidateLayout();
+		if ((embedded->lineColor() != CommonStrings::None) && (embedded->lineWidth() != 0.0))
+		{
+			if ((embedded->TopLine) || (embedded->RightLine) || (embedded->BottomLine) || (embedded->LeftLine))
+			{
+				ScColorShade colorShade(m_doc->PageColors[embedded->lineColor()], embedded->lineShade());
+				painter->setPen(colorShade, embedded->lineWidth(), embedded->PLineArt, Qt::SquareCap, embedded->PLineJoin);
+				if (embedded->TopLine)
+					painter->drawLine(FPoint(0.0, 0.0), FPoint(embedded->width(), 0.0));
+				if (embedded->RightLine)
+					painter->drawLine(FPoint(embedded->width(), 0.0), FPoint(embedded->width(), embedded->height()));
+				if (embedded->BottomLine)
+					painter->drawLine(FPoint(embedded->width(), embedded->height()), FPoint(0.0, embedded->height()));
+				if (embedded->LeftLine)
+					painter->drawLine(FPoint(0.0, embedded->height()), FPoint(0.0, 0.0));
+			}
+		}
+		embedded->isEmbedded = false;
+		painter->restore();
+	}
+	//painter->endLayer();
+	painter->restore();
+}
+
 void ScPageOutput::drawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, const QRect& clip  )
 {
 	ScPainterExBase::ImageMode mode = ScPainterExBase::rgbImages;

Modified: trunk/Scribus/scribus/scpageoutput.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpageoutput.h
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.h (original)
+++ trunk/Scribus/scribus/scpageoutput.h Fri Feb 10 22:20:30 2012
@@ -71,6 +71,7 @@
 	virtual void drawPattern(PageItem* item, ScPainterExBase* painter, const QRect& clip);
 	virtual void drawStrokePattern(PageItem* item, ScPainterExBase* painter, const QPainterPath& path);
 	
+	virtual void drawItem_Group( PageItem_Group* item, ScPainterExBase* painter, const QRect& clip );
 	virtual void drawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, const QRect& clip );
 	virtual void drawItem_Line( PageItem_Line* item, ScPainterExBase* painter, const QRect& clip);
 	virtual void drawItem_PathText( PageItem_PathText* item, ScPainterExBase* painter, const QRect& clip );

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp (original)
+++ trunk/Scribus/scribus/scpainter.cpp Fri Feb 10 22:20:30 2012
@@ -650,29 +650,17 @@
 	gradPatchP4 = p4;
 }
 
-void ScPainter::fillTextPath()
-{
-	drawVPath( 0 );
-}
-
-void ScPainter::strokeTextPath()
+void ScPainter::fillPath()
+{
+	if( fillMode != 0)
+		fillPathHelper();
+}
+
+void ScPainter::strokePath()
 {
 //	if( LineWidth == 0 )
 //		return;
-	drawVPath( 1 );
-}
-
-void ScPainter::fillPath()
-{
-	if( fillMode != 0)
-		drawVPath( 0 );
-}
-
-void ScPainter::strokePath()
-{
-//	if( LineWidth == 0 )
-//		return;
-	drawVPath( 1 );
+	strokePathHelper();
 }
 
 QColor ScPainter::pen()
@@ -930,446 +918,340 @@
 	return pat;
 }
 
-void ScPainter::drawVPath( int mode )
+void ScPainter::fillPathHelper()
 {
 	cairo_save( m_cr );
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
-	if (mode == 0)
+	if( m_fillRule )
+		cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_EVEN_ODD);
+	else
+		cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_WINDING);
+	if (fillMode == 1)
 	{
-		if( m_fillRule )
-			cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_EVEN_ODD);
+		double r, g, b;
+		m_fill.getRgbF(&r, &g, &b);
+		if (maskMode > 0)
+		{
+			cairo_pattern_t *pat = getMaskPattern();
+			cairo_set_source_rgb( m_cr, r, g, b );
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+			setRasterOp(m_blendModeFill);
+#endif
+			cairo_clip_preserve(m_cr);
+			cairo_mask(m_cr, pat);
+			if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
+				cairo_surface_destroy(imageMask);
+			cairo_pattern_destroy(pat);
+		}
 		else
-			cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_WINDING);
-		if (fillMode == 1)
-		{
+		{
+			cairo_set_source_rgba( m_cr, r, g, b, fill_trans );
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+			setRasterOp(m_blendModeFill);
+#endif
+			cairo_fill_preserve(m_cr);
+		}
+	}
+	else if (fillMode == 2)
+	{
+		cairo_pattern_t *pat = NULL;
+		cairo_surface_t *img = NULL;
+		cairo_t *cr = NULL;
+// #ifdef HAVE_PRIVATE_CAIRO
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)  || HAVE_PRIVATE_CAIRO)
+		cairo_pattern_t *mpat = NULL;
+#endif
+		if (fill_gradient.type() == VGradient::fourcolor)
+		{
+//#ifdef HAVE_PRIVATE_CAIRO
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
+			double p1x = gradPatchP1.x();
+			double p1y = gradPatchP1.y();
+			double p2x = gradPatchP2.x();
+			double p2y = gradPatchP2.y();
+			double p3x = gradPatchP3.x();
+			double p3y = gradPatchP3.y();
+			double p4x = gradPatchP4.x();
+			double p4y = gradPatchP4.y();
+			img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
+			cr = cairo_create(img);
+			cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
+			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+			cairo_set_tolerance(cr, 0.5 );
+			double r, g, b, a;
+			mpat = cairo_pattern_create_mesh();
+			cairo_pattern_mesh_begin_patch(mpat);
+			cairo_pattern_mesh_move_to(mpat, p1x, p1y);
+			cairo_pattern_mesh_line_to(mpat, p2x, p2y);
+			cairo_pattern_mesh_line_to(mpat, p3x, p3y);
+			cairo_pattern_mesh_line_to(mpat, p4x, p4y);
+			cairo_pattern_mesh_line_to(mpat, p1x, p1y);
+			cairo_pattern_mesh_set_control_point(mpat, 0, gradControlP1.x(),  gradControlP1.y());
+			cairo_pattern_mesh_set_control_point(mpat, 1, gradControlP2.x(),  gradControlP2.y());
+			cairo_pattern_mesh_set_control_point(mpat, 2, gradControlP3.x(),  gradControlP3.y());
+			cairo_pattern_mesh_set_control_point(mpat, 3, gradControlP4.x(),  gradControlP4.y());
+			gradPatchColor1.getRgbF(&r, &g, &b, &a);
+			cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+			gradPatchColor2.getRgbF(&r, &g, &b, &a);
+			cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+			gradPatchColor3.getRgbF(&r, &g, &b, &a);
+			cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+			gradPatchColor4.getRgbF(&r, &g, &b, &a);
+			cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
+			cairo_pattern_mesh_end_patch(mpat);
+			cairo_pattern_set_filter(mpat, CAIRO_FILTER_GOOD);
+			cairo_set_source(cr, mpat);
+			cairo_paint_with_alpha(cr, 1.0);
+			pat = cairo_pattern_create_for_surface(img);
+			cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
+			cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
+#else
+			double r, g, b, a;
+			double acr = 0.0;
+			double acg = 0.0;
+			double acb = 0.0;
+			double aca = 0.0;
+			gradPatchColor1.getRgbF(&r, &g, &b, &a);
+			acr += r;
+			acg += g;
+			acb += b;
+			aca += a;
+			gradPatchColor2.getRgbF(&r, &g, &b, &a);
+			acr += r;
+			acg += g;
+			acb += b;
+			aca += a;
+			gradPatchColor3.getRgbF(&r, &g, &b, &a);
+			acr += r;
+			acg += g;
+			acb += b;
+			aca += a;
+			gradPatchColor4.getRgbF(&r, &g, &b, &a);
+			acr += r;
+			acg += g;
+			acb += b;
+			aca += a;
+			pat = cairo_pattern_create_rgba(acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
+#endif
+		}
+		else if (fill_gradient.type() == VGradient::diamond)
+		{
+// #ifdef HAVE_PRIVATE_CAIRO
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
+			double p1x = gradControlP1.x();
+			double p1y = gradControlP1.y();
+			double p2x = gradControlP2.x();
+			double p2y = gradControlP2.y();
+			double p3x = gradControlP3.x();
+			double p3y = gradControlP3.y();
+			double p4x = gradControlP4.x();
+			double p4y = gradControlP4.y();
+			img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, gradPatchP3.x(), gradPatchP3.y());
+			cr = cairo_create(img);
+			cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
+			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+			cairo_set_tolerance(cr, 0.5 );
+			double r, g, b, a;
+			QList<VColorStop*> colorStops = fill_gradient.colorStops();
+			QList<QColor> qStopColors;
+			QColor qStopColor;
+			for( int offset = 0 ; offset < colorStops.count() ; offset++ )
+			{
+				qStopColor = colorStops[ offset ]->color;
+				int h, s, v, sneu, vneu;
+				int shad = colorStops[offset]->shade;
+				qStopColor.getHsv(&h, &s, &v);
+				sneu = s * shad / 100;
+				vneu = 255 - ((255 - v) * shad / 100);
+				qStopColor.setHsv(h, sneu, vneu);
+				qStopColor.setAlphaF(colorStops[offset]->opacity);
+				qStopColors.append(qStopColor);
+			}
+			qStopColors[qStopColors.count()-1].getRgbF(&r, &g, &b, &a);
+			QPointF centerP = QPointF(gradControlP5.x(), gradControlP5.y());
+			QLineF edge1 = QLineF(centerP, QPointF(p1x, p1y));
+			QLineF edge2 = QLineF(centerP, QPointF(p2x, p2y));
+			QLineF edge3 = QLineF(centerP, QPointF(p3x, p3y));
+			QLineF edge4 = QLineF(centerP, QPointF(p4x, p4y));
+			QPointF p1 = edge1.pointAt(colorStops[colorStops.count()-1]->rampPoint);
+			QPointF p2 = edge2.pointAt(colorStops[colorStops.count()-1]->rampPoint);
+			QPointF p3 = edge3.pointAt(colorStops[colorStops.count()-1]->rampPoint);
+			QPointF p4 = edge4.pointAt(colorStops[colorStops.count()-1]->rampPoint);
+			cairo_set_source_rgba(cr, r, g, b, a);
+			cairo_paint_with_alpha(cr, 1.0);
+			cairo_set_operator(cr, CAIRO_OPERATOR_DEST_OUT);
+			cairo_new_path(cr);
+			cairo_move_to(cr, p1.x(), p1.y());
+			cairo_line_to(cr, p2.x(), p2.y());
+			cairo_line_to(cr, p3.x(), p3.y());
+			cairo_line_to(cr, p4.x(), p4.y());
+			cairo_close_path(cr);
+			cairo_set_source_rgba(cr, 0, 0, 0, 1);
+			cairo_fill(cr);
+			cairo_set_operator(cr, CAIRO_OPERATOR_ADD);
+			mpat = cairo_pattern_create_mesh();
+			for( int offset = 1 ; offset < colorStops.count() ; offset++ )
+			{
+				QLineF e1 = edge1;
+				QLineF e1s = edge1;
+				QLineF e2 = edge2;
+				QLineF e2s = edge2;
+				QLineF e3 = edge3;
+				QLineF e3s = edge3;
+				QLineF e4 = edge4;
+				QLineF e4s = edge4;
+				e1.setLength(edge1.length() * colorStops[ offset ]->rampPoint);
+				e2.setLength(edge2.length() * colorStops[ offset ]->rampPoint);
+				e3.setLength(edge3.length() * colorStops[ offset ]->rampPoint);
+				e4.setLength(edge4.length() * colorStops[ offset ]->rampPoint);
+				e1s.setLength(edge1.length() * colorStops[ offset - 1 ]->rampPoint);
+				e2s.setLength(edge2.length() * colorStops[ offset - 1 ]->rampPoint);
+				e3s.setLength(edge3.length() * colorStops[ offset - 1 ]->rampPoint);
+				e4s.setLength(edge4.length() * colorStops[ offset - 1 ]->rampPoint);
+				if (offset == 1)
+				{
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
+					cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
+					cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
+#ifdef HAVE_PRIVATE_CAIRO
+					cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
+#endif
+					qStopColors[0].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
+					cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
+					cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
+#ifdef HAVE_PRIVATE_CAIRO
+					cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
+#endif
+					qStopColors[0].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
+					cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
+					cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
+#ifdef HAVE_PRIVATE_CAIRO
+					cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
+#endif
+					qStopColors[0].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
+					cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
+					cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
+#ifdef HAVE_PRIVATE_CAIRO
+					cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
+#endif
+					qStopColors[0].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+				}
+				else
+				{
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, e1s.x2(), e1s.y2());
+					cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
+					cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
+					cairo_pattern_mesh_line_to(mpat, e2s.x2(), e2s.y2());
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[offset].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, e2s.x2(), e2s.y2());
+					cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
+					cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
+					cairo_pattern_mesh_line_to(mpat, e3s.x2(), e3s.y2());
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[offset].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, e3s.x2(), e3s.y2());
+					cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
+					cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
+					cairo_pattern_mesh_line_to(mpat, e4s.x2(), e4s.y2());
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[offset].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+					cairo_pattern_mesh_begin_patch(mpat);
+					cairo_pattern_mesh_move_to(mpat, e4s.x2(), e4s.y2());
+					cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
+					cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
+					cairo_pattern_mesh_line_to(mpat, e1s.x2(), e1s.y2());
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+					qStopColors[offset].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+					qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
+					cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
+					cairo_pattern_mesh_end_patch(mpat);
+				}
+			}
+			cairo_pattern_set_filter(mpat, CAIRO_FILTER_GOOD);
+			cairo_set_source(cr, mpat);
+			cairo_paint_with_alpha(cr, 1.0);
+			pat = cairo_pattern_create_for_surface(img);
+			cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
+			cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
+#else
 			double r, g, b;
 			m_fill.getRgbF(&r, &g, &b);
-			if (maskMode > 0)
-			{
-				cairo_pattern_t *pat = getMaskPattern();
-				cairo_set_source_rgb( m_cr, r, g, b );
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-				setRasterOp(m_blendModeFill);
-#endif
-				cairo_clip_preserve(m_cr);
-				cairo_mask(m_cr, pat);
-				if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
-					cairo_surface_destroy(imageMask);
-				cairo_pattern_destroy(pat);
-			}
-			else
-			{
-				cairo_set_source_rgba( m_cr, r, g, b, fill_trans );
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-				setRasterOp(m_blendModeFill);
-#endif
-				cairo_fill_preserve(m_cr);
-			}
-		}
-		else if (fillMode == 2)
-		{
-			cairo_pattern_t *pat = NULL;
-			cairo_surface_t *img = NULL;
-			cairo_t *cr = NULL;
-// #ifdef HAVE_PRIVATE_CAIRO
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)  || HAVE_PRIVATE_CAIRO)
-			cairo_pattern_t *mpat = NULL;
-#endif
-			if (fill_gradient.type() == VGradient::fourcolor)
-			{
-//#ifdef HAVE_PRIVATE_CAIRO
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
-				double p1x = gradPatchP1.x();
-				double p1y = gradPatchP1.y();
-				double p2x = gradPatchP2.x();
-				double p2y = gradPatchP2.y();
-				double p3x = gradPatchP3.x();
-				double p3y = gradPatchP3.y();
-				double p4x = gradPatchP4.x();
-				double p4y = gradPatchP4.y();
-				img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
-				cr = cairo_create(img);
-				cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
-				cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-				cairo_set_tolerance(cr, 0.5 );
-				double r, g, b, a;
-				mpat = cairo_pattern_create_mesh();
-				cairo_pattern_mesh_begin_patch(mpat);
-				cairo_pattern_mesh_move_to(mpat, p1x, p1y);
-				cairo_pattern_mesh_line_to(mpat, p2x, p2y);
-				cairo_pattern_mesh_line_to(mpat, p3x, p3y);
-				cairo_pattern_mesh_line_to(mpat, p4x, p4y);
-				cairo_pattern_mesh_line_to(mpat, p1x, p1y);
-				cairo_pattern_mesh_set_control_point(mpat, 0, gradControlP1.x(),  gradControlP1.y());
-				cairo_pattern_mesh_set_control_point(mpat, 1, gradControlP2.x(),  gradControlP2.y());
-				cairo_pattern_mesh_set_control_point(mpat, 2, gradControlP3.x(),  gradControlP3.y());
-				cairo_pattern_mesh_set_control_point(mpat, 3, gradControlP4.x(),  gradControlP4.y());
-				gradPatchColor1.getRgbF(&r, &g, &b, &a);
-				cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-				gradPatchColor2.getRgbF(&r, &g, &b, &a);
-				cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-				gradPatchColor3.getRgbF(&r, &g, &b, &a);
-				cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-				gradPatchColor4.getRgbF(&r, &g, &b, &a);
-				cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
-				cairo_pattern_mesh_end_patch(mpat);
-				cairo_pattern_set_filter(mpat, CAIRO_FILTER_GOOD);
-				cairo_set_source(cr, mpat);
-				cairo_paint_with_alpha(cr, 1.0);
-				pat = cairo_pattern_create_for_surface(img);
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
-#else
-				double r, g, b, a;
-				double acr = 0.0;
-				double acg = 0.0;
-				double acb = 0.0;
-				double aca = 0.0;
-				gradPatchColor1.getRgbF(&r, &g, &b, &a);
-				acr += r;
-				acg += g;
-				acb += b;
-				aca += a;
-				gradPatchColor2.getRgbF(&r, &g, &b, &a);
-				acr += r;
-				acg += g;
-				acb += b;
-				aca += a;
-				gradPatchColor3.getRgbF(&r, &g, &b, &a);
-				acr += r;
-				acg += g;
-				acb += b;
-				aca += a;
-				gradPatchColor4.getRgbF(&r, &g, &b, &a);
-				acr += r;
-				acg += g;
-				acb += b;
-				aca += a;
-				pat = cairo_pattern_create_rgba(acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
-#endif
-			}
-			else if (fill_gradient.type() == VGradient::diamond)
-			{
+			pat = cairo_pattern_create_rgba(r, g, b, 1.0);
+#endif
+		}
+		else if (fill_gradient.type() == VGradient::mesh)
+		{
 // #ifdef HAVE_PRIVATE_CAIRO
 #if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
-				double p1x = gradControlP1.x();
-				double p1y = gradControlP1.y();
-				double p2x = gradControlP2.x();
-				double p2y = gradControlP2.y();
-				double p3x = gradControlP3.x();
-				double p3y = gradControlP3.y();
-				double p4x = gradControlP4.x();
-				double p4y = gradControlP4.y();
-				img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, gradPatchP3.x(), gradPatchP3.y());
-				cr = cairo_create(img);
-				cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
-				cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-				cairo_set_tolerance(cr, 0.5 );
-				double r, g, b, a;
-				QList<VColorStop*> colorStops = fill_gradient.colorStops();
-				QList<QColor> qStopColors;
-				QColor qStopColor;
-				for( int offset = 0 ; offset < colorStops.count() ; offset++ )
+			double p3x = gradPatchP3.x();
+			double p3y = gradPatchP3.y();
+			img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
+			cr = cairo_create(img);
+			cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
+			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+			cairo_set_tolerance(cr, 0.5 );
+			double r, g, b, a;
+			mpat = cairo_pattern_create_mesh();
+			for (int grow = 0; grow < meshGradientArray.count()-1; grow++)
+			{
+				for (int gcol = 0; gcol < meshGradientArray[grow].count()-1; gcol++)
 				{
-					qStopColor = colorStops[ offset ]->color;
-					int h, s, v, sneu, vneu;
-					int shad = colorStops[offset]->shade;
-					qStopColor.getHsv(&h, &s, &v);
-					sneu = s * shad / 100;
-					vneu = 255 - ((255 - v) * shad / 100);
-					qStopColor.setHsv(h, sneu, vneu);
-					qStopColor.setAlphaF(colorStops[offset]->opacity);
-					qStopColors.append(qStopColor);
-				}
-				qStopColors[qStopColors.count()-1].getRgbF(&r, &g, &b, &a);
-				QPointF centerP = QPointF(gradControlP5.x(), gradControlP5.y());
-				QLineF edge1 = QLineF(centerP, QPointF(p1x, p1y));
-				QLineF edge2 = QLineF(centerP, QPointF(p2x, p2y));
-				QLineF edge3 = QLineF(centerP, QPointF(p3x, p3y));
-				QLineF edge4 = QLineF(centerP, QPointF(p4x, p4y));
-				QPointF p1 = edge1.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-				QPointF p2 = edge2.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-				QPointF p3 = edge3.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-				QPointF p4 = edge4.pointAt(colorStops[colorStops.count()-1]->rampPoint);
-				cairo_set_source_rgba(cr, r, g, b, a);
-				cairo_paint_with_alpha(cr, 1.0);
-				cairo_set_operator(cr, CAIRO_OPERATOR_DEST_OUT);
-				cairo_new_path(cr);
-				cairo_move_to(cr, p1.x(), p1.y());
-				cairo_line_to(cr, p2.x(), p2.y());
-				cairo_line_to(cr, p3.x(), p3.y());
-				cairo_line_to(cr, p4.x(), p4.y());
-				cairo_close_path(cr);
-				cairo_set_source_rgba(cr, 0, 0, 0, 1);
-				cairo_fill(cr);
-				cairo_set_operator(cr, CAIRO_OPERATOR_ADD);
-				mpat = cairo_pattern_create_mesh();
-				for( int offset = 1 ; offset < colorStops.count() ; offset++ )
-				{
-					QLineF e1 = edge1;
-					QLineF e1s = edge1;
-					QLineF e2 = edge2;
-					QLineF e2s = edge2;
-					QLineF e3 = edge3;
-					QLineF e3s = edge3;
-					QLineF e4 = edge4;
-					QLineF e4s = edge4;
-					e1.setLength(edge1.length() * colorStops[ offset ]->rampPoint);
-					e2.setLength(edge2.length() * colorStops[ offset ]->rampPoint);
-					e3.setLength(edge3.length() * colorStops[ offset ]->rampPoint);
-					e4.setLength(edge4.length() * colorStops[ offset ]->rampPoint);
-					e1s.setLength(edge1.length() * colorStops[ offset - 1 ]->rampPoint);
-					e2s.setLength(edge2.length() * colorStops[ offset - 1 ]->rampPoint);
-					e3s.setLength(edge3.length() * colorStops[ offset - 1 ]->rampPoint);
-					e4s.setLength(edge4.length() * colorStops[ offset - 1 ]->rampPoint);
-					if (offset == 1)
-					{
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
-						cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
-						cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
-#ifdef HAVE_PRIVATE_CAIRO
-						cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
-						qStopColors[0].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
-						cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
-						cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
-#ifdef HAVE_PRIVATE_CAIRO
-						cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
-						qStopColors[0].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
-						cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
-						cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
-#ifdef HAVE_PRIVATE_CAIRO
-						cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
-						qStopColors[0].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, centerP.x(), centerP.y());
-						cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
-						cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
-#ifdef HAVE_PRIVATE_CAIRO
-						cairo_pattern_mesh_line_to(mpat, centerP.x(), centerP.y());
-#endif
-						qStopColors[0].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-					}
-					else
-					{
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, e1s.x2(), e1s.y2());
-						cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
-						cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
-						cairo_pattern_mesh_line_to(mpat, e2s.x2(), e2s.y2());
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[offset].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, e2s.x2(), e2s.y2());
-						cairo_pattern_mesh_line_to(mpat, e2.x2(), e2.y2());
-						cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
-						cairo_pattern_mesh_line_to(mpat, e3s.x2(), e3s.y2());
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[offset].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, e3s.x2(), e3s.y2());
-						cairo_pattern_mesh_line_to(mpat, e3.x2(), e3.y2());
-						cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
-						cairo_pattern_mesh_line_to(mpat, e4s.x2(), e4s.y2());
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[offset].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, e4s.x2(), e4s.y2());
-						cairo_pattern_mesh_line_to(mpat, e4.x2(), e4.y2());
-						cairo_pattern_mesh_line_to(mpat, e1.x2(), e1.y2());
-						cairo_pattern_mesh_line_to(mpat, e1s.x2(), e1s.y2());
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						qStopColors[offset].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						qStopColors[offset-1].getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-					}
-				}
-				cairo_pattern_set_filter(mpat, CAIRO_FILTER_GOOD);
-				cairo_set_source(cr, mpat);
-				cairo_paint_with_alpha(cr, 1.0);
-				pat = cairo_pattern_create_for_surface(img);
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
-#else
-				double r, g, b;
-				m_fill.getRgbF(&r, &g, &b);
-				pat = cairo_pattern_create_rgba(r, g, b, 1.0);
-#endif
-			}
-			else if (fill_gradient.type() == VGradient::mesh)
-			{
-// #ifdef HAVE_PRIVATE_CAIRO
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
-				double p3x = gradPatchP3.x();
-				double p3y = gradPatchP3.y();
-				img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
-				cr = cairo_create(img);
-				cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
-				cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-				cairo_set_tolerance(cr, 0.5 );
-				double r, g, b, a;
-				mpat = cairo_pattern_create_mesh();
-				for (int grow = 0; grow < meshGradientArray.count()-1; grow++)
-				{
-					for (int gcol = 0; gcol < meshGradientArray[grow].count()-1; gcol++)
-					{
-						meshPoint mp1 = meshGradientArray[grow][gcol];
-						meshPoint mp2 = meshGradientArray[grow][gcol+1];
-						meshPoint mp3 = meshGradientArray[grow+1][gcol+1];
-						meshPoint mp4 = meshGradientArray[grow+1][gcol];
-						cairo_pattern_mesh_begin_patch(mpat);
-						cairo_pattern_mesh_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
-						cairo_pattern_mesh_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
-						cairo_pattern_mesh_curve_to(mpat, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
-						cairo_pattern_mesh_curve_to(mpat, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
-						cairo_pattern_mesh_curve_to(mpat, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
-						cairo_pattern_mesh_set_control_point(mpat, 0, mp1.controlColor.x(),  mp1.controlColor.y());
-						cairo_pattern_mesh_set_control_point(mpat, 1, mp2.controlColor.x(),  mp2.controlColor.y());
-						cairo_pattern_mesh_set_control_point(mpat, 2, mp3.controlColor.x(),  mp3.controlColor.y());
-						cairo_pattern_mesh_set_control_point(mpat, 3, mp4.controlColor.x(),  mp4.controlColor.y());
-						mp1.color.getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
-						mp2.color.getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
-						mp3.color.getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
-						mp4.color.getRgbF(&r, &g, &b, &a);
-						cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
-						cairo_pattern_mesh_end_patch(mpat);
-					}
-				}
-				cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
-				cairo_set_source(cr, mpat);
-				cairo_paint_with_alpha(cr, 1.0);
-				pat = cairo_pattern_create_for_surface(img);
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#else
-				double p3x = gradPatchP3.x();
-				double p3y = gradPatchP3.y();
-				img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
-				cr = cairo_create(img);
-				cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
-				cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-				cairo_set_tolerance(cr, 0.5 );
-				double r, g, b, a;
-				for (int grow = 0; grow < meshGradientArray.count()-1; grow++)
-				{
-					for (int gcol = 0; gcol < meshGradientArray[grow].count()-1; gcol++)
-					{
-						meshPoint mp1 = meshGradientArray[grow][gcol];
-						meshPoint mp2 = meshGradientArray[grow][gcol+1];
-						meshPoint mp3 = meshGradientArray[grow+1][gcol+1];
-						meshPoint mp4 = meshGradientArray[grow+1][gcol];
-						cairo_new_path( cr );
-						cairo_move_to(cr, mp1.gridPoint.x(), mp1.gridPoint.y());
-						cairo_curve_to(cr, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
-						cairo_curve_to(cr, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
-						cairo_curve_to(cr, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
-						cairo_curve_to(cr, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
-						cairo_close_path( cr );
-						double acr = 0.0;
-						double acg = 0.0;
-						double acb = 0.0;
-						double aca = 0.0;
-						mp1.color.getRgbF(&r, &g, &b, &a);
-						acr += r;
-						acg += g;
-						acb += b;
-						aca += a;
-						mp2.color.getRgbF(&r, &g, &b, &a);
-						acr += r;
-						acg += g;
-						acb += b;
-						aca += a;
-						mp3.color.getRgbF(&r, &g, &b, &a);
-						acr += r;
-						acg += g;
-						acb += b;
-						aca += a;
-						mp4.color.getRgbF(&r, &g, &b, &a);
-						acr += r;
-						acg += g;
-						acb += b;
-						aca += a;
-						cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);		
-						cairo_fill(cr);
-					}
-				}
-				pat = cairo_pattern_create_for_surface(img);
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#endif
-			}
-			else if (fill_gradient.type() == VGradient::freemesh)
-			{
-// #ifdef HAVE_PRIVATE_CAIRO
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
-				double p3x = gradPatchP3.x();
-				double p3y = gradPatchP3.y();
-				img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
-				cr = cairo_create(img);
-				cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
-				cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-				cairo_set_tolerance(cr, 0.5 );
-				double r, g, b, a;
-				mpat = cairo_pattern_create_mesh();
-				for (int col = 0; col < meshGradientPatches.count(); col++)
-				{
-					meshGradientPatch patch = meshGradientPatches[col];
-					meshPoint mp1 = patch.TL;
-					meshPoint mp2 = patch.TR;
-					meshPoint mp3 = patch.BR;
-					meshPoint mp4 = patch.BL;
+					meshPoint mp1 = meshGradientArray[grow][gcol];
+					meshPoint mp2 = meshGradientArray[grow][gcol+1];
+					meshPoint mp3 = meshGradientArray[grow+1][gcol+1];
+					meshPoint mp4 = meshGradientArray[grow+1][gcol];
 					cairo_pattern_mesh_begin_patch(mpat);
 					cairo_pattern_mesh_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
 					cairo_pattern_mesh_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
@@ -1390,28 +1272,30 @@
 					cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
 					cairo_pattern_mesh_end_patch(mpat);
 				}
-				cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
-				cairo_set_source(cr, mpat);
-				cairo_paint_with_alpha(cr, 1.0);
-				pat = cairo_pattern_create_for_surface(img);
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
+			}
+			cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
+			cairo_set_source(cr, mpat);
+			cairo_paint_with_alpha(cr, 1.0);
+			pat = cairo_pattern_create_for_surface(img);
+			cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
+			cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
 #else
-				double p3x = gradPatchP3.x();
-				double p3y = gradPatchP3.y();
-				img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
-				cr = cairo_create(img);
-				cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
-				cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
-				cairo_set_tolerance(cr, 0.5 );
-				double r, g, b, a;
-				for (int col = 0; col < meshGradientPatches.count(); col++)
+			double p3x = gradPatchP3.x();
+			double p3y = gradPatchP3.y();
+			img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
+			cr = cairo_create(img);
+			cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
+			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+			cairo_set_tolerance(cr, 0.5 );
+			double r, g, b, a;
+			for (int grow = 0; grow < meshGradientArray.count()-1; grow++)
+			{
+				for (int gcol = 0; gcol < meshGradientArray[grow].count()-1; gcol++)
 				{
-					meshGradientPatch patch = meshGradientPatches[col];
-					meshPoint mp1 = patch.TL;
-					meshPoint mp2 = patch.TR;
-					meshPoint mp3 = patch.BR;
-					meshPoint mp4 = patch.BL;
+					meshPoint mp1 = meshGradientArray[grow][gcol];
+					meshPoint mp2 = meshGradientArray[grow][gcol+1];
+					meshPoint mp3 = meshGradientArray[grow+1][gcol+1];
+					meshPoint mp4 = meshGradientArray[grow+1][gcol];
 					cairo_new_path( cr );
 					cairo_move_to(cr, mp1.gridPoint.x(), mp1.gridPoint.y());
 					cairo_curve_to(cr, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
@@ -1443,232 +1327,133 @@
 					acg += g;
 					acb += b;
 					aca += a;
-					cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
+					cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);		
 					cairo_fill(cr);
 				}
-				pat = cairo_pattern_create_for_surface(img);
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
-#endif
 			}
-			else
+			pat = cairo_pattern_create_for_surface(img);
+			cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
+			cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
+#endif
+		}
+		else if (fill_gradient.type() == VGradient::freemesh)
+		{
+// #ifdef HAVE_PRIVATE_CAIRO
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2) || HAVE_PRIVATE_CAIRO)
+			double p3x = gradPatchP3.x();
+			double p3y = gradPatchP3.y();
+			img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
+			cr = cairo_create(img);
+			cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
+			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+			cairo_set_tolerance(cr, 0.5 );
+			double r, g, b, a;
+			mpat = cairo_pattern_create_mesh();
+			for (int col = 0; col < meshGradientPatches.count(); col++)
 			{
-				bool   isFirst = true;
-				double rampPoint, lastPoint = 0.0;
-				double x1 = fill_gradient.origin().x();
-				double y1 = fill_gradient.origin().y();
-				double x2 = fill_gradient.vector().x();
-				double y2 = fill_gradient.vector().y();
-				double fx = fill_gradient.focalPoint().x();
-				double fy = fill_gradient.focalPoint().y();
-				if (fill_gradient.type() == VGradient::linear)
-					pat = cairo_pattern_create_linear (x1, y1,  x2, y2);
-				else
-					pat = cairo_pattern_create_radial (fx, fy, 0, x1, y1, sqrt(pow(x2 - x1, 2) + pow(y2 - y1,2)));
-				cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
-				cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
-				QList<VColorStop*> colorStops = fill_gradient.colorStops();
-				QColor qStopColor;
-				for( int offset = 0 ; offset < colorStops.count() ; offset++ )
-				{
-					qStopColor = colorStops[ offset ]->color;
-					rampPoint  = colorStops[ offset ]->rampPoint;
-					if ((lastPoint == rampPoint) && (!isFirst))
-						continue;
-					isFirst = false;
-					int h, s, v, sneu, vneu;
-					int shad = colorStops[offset]->shade;
-					qStopColor.getHsv(&h, &s, &v);
-					sneu = s * shad / 100;
-					vneu = 255 - ((255 - v) * shad / 100);
-					qStopColor.setHsv(h, sneu, vneu);
-					double a = colorStops[offset]->opacity;
-					double r, g, b;
-					qStopColor.getRgbF(&r, &g, &b);
-					cairo_pattern_add_color_stop_rgba (pat, colorStops[ offset ]->rampPoint, r, g, b, a);
-					lastPoint = rampPoint;
-				}
-				cairo_matrix_t matrix;
-				QTransform qmatrix;
-				if (fill_gradient.type() == VGradient::radial)
-				{
-					double rotEnd = xy2Deg(x2 - x1, y2 - y1);
-					qmatrix.translate(x1, y1);
-					qmatrix.rotate(rotEnd);
-					qmatrix.shear(gradientSkew, 0);
-					qmatrix.translate(0, y1 * (1.0 - gradientScale));
-					qmatrix.translate(-x1, -y1);
-					qmatrix.scale(1, gradientScale);
-				}
-				else
-				{
-					qmatrix.translate(x1, y1);
-					qmatrix.shear(-gradientSkew, 0);
-					qmatrix.translate(-x1, -y1);
-				}
-				cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
-				cairo_matrix_invert(&matrix);
-				cairo_pattern_set_matrix (pat, &matrix);
+				meshGradientPatch patch = meshGradientPatches[col];
+				meshPoint mp1 = patch.TL;
+				meshPoint mp2 = patch.TR;
+				meshPoint mp3 = patch.BR;
+				meshPoint mp4 = patch.BL;
+				cairo_pattern_mesh_begin_patch(mpat);
+				cairo_pattern_mesh_move_to(mpat, mp1.gridPoint.x(), mp1.gridPoint.y());
+				cairo_pattern_mesh_curve_to(mpat, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
+				cairo_pattern_mesh_curve_to(mpat, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
+				cairo_pattern_mesh_curve_to(mpat, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
+				cairo_pattern_mesh_curve_to(mpat, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
+				cairo_pattern_mesh_set_control_point(mpat, 0, mp1.controlColor.x(),  mp1.controlColor.y());
+				cairo_pattern_mesh_set_control_point(mpat, 1, mp2.controlColor.x(),  mp2.controlColor.y());
+				cairo_pattern_mesh_set_control_point(mpat, 2, mp3.controlColor.x(),  mp3.controlColor.y());
+				cairo_pattern_mesh_set_control_point(mpat, 3, mp4.controlColor.x(),  mp4.controlColor.y());
+				mp1.color.getRgbF(&r, &g, &b, &a);
+				cairo_pattern_mesh_set_corner_color_rgba(mpat, 0, r, g, b, a);
+				mp2.color.getRgbF(&r, &g, &b, &a);
+				cairo_pattern_mesh_set_corner_color_rgba(mpat, 1, r, g, b, a);
+				mp3.color.getRgbF(&r, &g, &b, &a);
+				cairo_pattern_mesh_set_corner_color_rgba(mpat, 2, r, g, b, a);
+				mp4.color.getRgbF(&r, &g, &b, &a);
+				cairo_pattern_mesh_set_corner_color_rgba(mpat, 3, r, g, b, a);
+				cairo_pattern_mesh_end_patch(mpat);
 			}
-			cairo_set_source (m_cr, pat);
-			cairo_clip_preserve (m_cr);
-			if (maskMode > 0)
+			cairo_pattern_set_filter(mpat, CAIRO_FILTER_BEST);
+			cairo_set_source(cr, mpat);
+			cairo_paint_with_alpha(cr, 1.0);
+			pat = cairo_pattern_create_for_surface(img);
+			cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
+			cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
+#else
+			double p3x = gradPatchP3.x();
+			double p3y = gradPatchP3.y();
+			img = cairo_surface_create_similar(cairo_get_target(m_cr), CAIRO_CONTENT_COLOR_ALPHA, p3x, p3y);
+			cr = cairo_create(img);
+			cairo_set_fill_rule(cr, CAIRO_FILL_RULE_EVEN_ODD);
+			cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
+			cairo_set_tolerance(cr, 0.5 );
+			double r, g, b, a;
+			for (int col = 0; col < meshGradientPatches.count(); col++)
 			{
-				cairo_pattern_t *patM = getMaskPattern();
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-				setRasterOp(m_blendModeFill);
-#endif
-				cairo_mask(m_cr, patM);
-				if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
-					cairo_surface_destroy(imageMask);
-				cairo_pattern_destroy (patM);
+				meshGradientPatch patch = meshGradientPatches[col];
+				meshPoint mp1 = patch.TL;
+				meshPoint mp2 = patch.TR;
+				meshPoint mp3 = patch.BR;
+				meshPoint mp4 = patch.BL;
+				cairo_new_path( cr );
+				cairo_move_to(cr, mp1.gridPoint.x(), mp1.gridPoint.y());
+				cairo_curve_to(cr, mp1.controlRight.x(), mp1.controlRight.y(), mp2.controlLeft.x(), mp2.controlLeft.y(), mp2.gridPoint.x(), mp2.gridPoint.y());
+				cairo_curve_to(cr, mp2.controlBottom.x(), mp2.controlBottom.y(), mp3.controlTop.x(), mp3.controlTop.y(), mp3.gridPoint.x(), mp3.gridPoint.y());
+				cairo_curve_to(cr, mp3.controlLeft.x(), mp3.controlLeft.y(), mp4.controlRight.x(), mp4.controlRight.y(), mp4.gridPoint.x(), mp4.gridPoint.y());
+				cairo_curve_to(cr, mp4.controlTop.x(), mp4.controlTop.y(), mp1.controlBottom.x(), mp1.controlBottom.y(), mp1.gridPoint.x(), mp1.gridPoint.y());
+				cairo_close_path( cr );
+				double acr = 0.0;
+				double acg = 0.0;
+				double acb = 0.0;
+				double aca = 0.0;
+				mp1.color.getRgbF(&r, &g, &b, &a);
+				acr += r;
+				acg += g;
+				acb += b;
+				aca += a;
+				mp2.color.getRgbF(&r, &g, &b, &a);
+				acr += r;
+				acg += g;
+				acb += b;
+				aca += a;
+				mp3.color.getRgbF(&r, &g, &b, &a);
+				acr += r;
+				acg += g;
+				acb += b;
+				aca += a;
+				mp4.color.getRgbF(&r, &g, &b, &a);
+				acr += r;
+				acg += g;
+				acb += b;
+				aca += a;
+				cairo_set_source_rgba(cr, acr / 4.0, acg / 4.0, acb / 4.0, aca / 4.0);
+				cairo_fill(cr);
 			}
-			else
-			{
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-				setRasterOp(m_blendModeFill);
-#endif
-				cairo_paint_with_alpha (m_cr, fill_trans);
-			}
-			cairo_pattern_destroy (pat);
-// #ifdef HAVE_PRIVATE_CAIRO
-#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)  || HAVE_PRIVATE_CAIRO)
-			if ((fill_gradient.type() == VGradient::fourcolor) || (fill_gradient.type() == VGradient::diamond) || (fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
-			{
-				cairo_surface_destroy(img);
-				cairo_pattern_destroy(mpat);
-				cairo_destroy( cr );
-			}
-#else
-			if ((fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
-			{
-				cairo_surface_destroy(img);
-				cairo_destroy( cr );
-			}
-#endif
-		}
-		else if (fillMode == 3)
-		{
-			cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_NONE);
-			cairo_surface_t *image2 = cairo_image_surface_create_for_data ((uchar*)m_pattern->getPattern()->bits(), CAIRO_FORMAT_ARGB32, m_pattern->getPattern()->width(), m_pattern->getPattern()->height(), m_pattern->getPattern()->width()*4);
-			cairo_pattern_t *m_pat = cairo_pattern_create_for_surface(image2);
-			cairo_pattern_set_extend(m_pat, CAIRO_EXTEND_REPEAT);
-			cairo_pattern_set_filter(m_pat, CAIRO_FILTER_GOOD);
-			cairo_matrix_t matrix;
-			QTransform qmatrix;
-			qmatrix.translate(patternOffsetX, patternOffsetY);
-			qmatrix.rotate(patternRotation);
-			qmatrix.shear(-patternSkewX, patternSkewY);
-			qmatrix.scale(patternScaleX, patternScaleY);
-			qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
-			if (patternMirrorX)
-				qmatrix.scale(-1, 1);
-			if (patternMirrorY)
-				qmatrix.scale(1, -1);
-			cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
-			cairo_matrix_invert(&matrix);
-			cairo_pattern_set_matrix (m_pat, &matrix);
-			cairo_set_source (m_cr, m_pat);
-			cairo_clip_preserve (m_cr);
-			if (maskMode > 0)
-			{
-				cairo_pattern_t *patM = getMaskPattern();
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-				setRasterOp(m_blendModeFill);
-#endif
-				cairo_mask(m_cr, patM);
-				if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
-					cairo_surface_destroy(imageMask);
-				cairo_pattern_destroy (patM);
-			}
-			else
-			{
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-				setRasterOp(m_blendModeFill);
-#endif
-				cairo_paint_with_alpha (m_cr, fill_trans);
-			}
-			cairo_pattern_destroy (m_pat);
-			cairo_surface_destroy (image2);
-			cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_DEFAULT);
-		}
-	}
-	else
-	{
-		if( LineWidth == 0 )
-			cairo_set_line_width( m_cr, 1.0 / m_zoomFactor );
+			pat = cairo_pattern_create_for_surface(img);
+			cairo_pattern_set_extend(pat, CAIRO_EXTEND_NONE);
+			cairo_pattern_set_filter(pat, CAIRO_FILTER_BEST);
+#endif
+		}
 		else
-			cairo_set_line_width( m_cr, LineWidth );
-		if( m_array.count() > 0 )
-			cairo_set_dash( m_cr, m_array.data(), m_array.count(), m_offset);
-		else
-			cairo_set_dash( m_cr, NULL, 0, 0 );
-		cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
-		if( PLineEnd == Qt::RoundCap )
-			cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_ROUND);
-		else if( PLineEnd == Qt::SquareCap )
-			cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_SQUARE);
-		else if( PLineEnd == Qt::FlatCap )
-			cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_BUTT);
-		if( PLineJoin == Qt::RoundJoin )
-			cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_ROUND );
-		else if( PLineJoin == Qt::BevelJoin )
-			cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_BEVEL );
-		else if( PLineJoin == Qt::MiterJoin )
-			cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_MITER );
-		if (strokeMode == 3)
-		{
-			cairo_push_group(m_cr);
-			cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_NONE);
-			cairo_surface_t *image2 = cairo_image_surface_create_for_data ((uchar*)m_pattern->getPattern()->bits(), CAIRO_FORMAT_ARGB32, m_pattern->getPattern()->width(), m_pattern->getPattern()->height(), m_pattern->getPattern()->width()*4);
-			cairo_pattern_t *m_pat = cairo_pattern_create_for_surface(image2);
-			cairo_pattern_set_extend(m_pat, CAIRO_EXTEND_REPEAT);
-			cairo_pattern_set_filter(m_pat, CAIRO_FILTER_GOOD);
-			cairo_matrix_t matrix;
-			QTransform qmatrix;
-			qmatrix.translate(-LineWidth / 2.0, -LineWidth / 2.0);
-			qmatrix.translate(patternOffsetX, patternOffsetY);
-			qmatrix.rotate(patternRotation);
-			qmatrix.shear(-patternSkewX, patternSkewY);
-			qmatrix.scale(patternScaleX, patternScaleY);
-			qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
-			if (patternMirrorX)
-				qmatrix.scale(-1, 1);
-			if (patternMirrorY)
-				qmatrix.scale(1, -1);
-			cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
-			cairo_matrix_invert(&matrix);
-			cairo_pattern_set_matrix (m_pat, &matrix);
-			cairo_set_source (m_cr, m_pat);
-			cairo_stroke_preserve( m_cr );
-			cairo_pattern_destroy (m_pat);
-			cairo_surface_destroy (image2);
-			cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_DEFAULT);
-			cairo_pop_group_to_source (m_cr);
-#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-			setRasterOp(m_blendModeStroke);
-#endif
-			cairo_paint_with_alpha (m_cr, stroke_trans);
-		}
-		else if (strokeMode == 2)
-		{
-			cairo_push_group(m_cr);
-			cairo_pattern_t *pat;
+		{
 			bool   isFirst = true;
 			double rampPoint, lastPoint = 0.0;
-			double x1 = stroke_gradient.origin().x();
-			double y1 = stroke_gradient.origin().y();
-			double x2 = stroke_gradient.vector().x();
-			double y2 = stroke_gradient.vector().y();
-			double fx = stroke_gradient.focalPoint().x();
-			double fy = stroke_gradient.focalPoint().y();
-			if (stroke_gradient.type() == VGradient::linear)
+			double x1 = fill_gradient.origin().x();
+			double y1 = fill_gradient.origin().y();
+			double x2 = fill_gradient.vector().x();
+			double y2 = fill_gradient.vector().y();
+			double fx = fill_gradient.focalPoint().x();
+			double fy = fill_gradient.focalPoint().y();
+			if (fill_gradient.type() == VGradient::linear)
 				pat = cairo_pattern_create_linear (x1, y1,  x2, y2);
 			else
 				pat = cairo_pattern_create_radial (fx, fy, 0, x1, y1, sqrt(pow(x2 - x1, 2) + pow(y2 - y1,2)));
 			cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
 			cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
-			QList<VColorStop*> colorStops = stroke_gradient.colorStops();
+			QList<VColorStop*> colorStops = fill_gradient.colorStops();
 			QColor qStopColor;
 			for( int offset = 0 ; offset < colorStops.count() ; offset++ )
 			{
@@ -1686,12 +1471,12 @@
 				double a = colorStops[offset]->opacity;
 				double r, g, b;
 				qStopColor.getRgbF(&r, &g, &b);
-				cairo_pattern_add_color_stop_rgba (pat, rampPoint, r, g, b, a);
+				cairo_pattern_add_color_stop_rgba (pat, colorStops[ offset ]->rampPoint, r, g, b, a);
 				lastPoint = rampPoint;
 			}
 			cairo_matrix_t matrix;
 			QTransform qmatrix;
-			if (stroke_gradient.type() == VGradient::radial)
+			if (fill_gradient.type() == VGradient::radial)
 			{
 				double rotEnd = xy2Deg(x2 - x1, y2 - y1);
 				qmatrix.translate(x1, y1);
@@ -1710,25 +1495,230 @@
 			cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
 			cairo_matrix_invert(&matrix);
 			cairo_pattern_set_matrix (pat, &matrix);
-			cairo_set_source (m_cr, pat);
-			cairo_stroke_preserve( m_cr );
-			cairo_pattern_destroy (pat);
-			cairo_pop_group_to_source (m_cr);
+		}
+		cairo_set_source (m_cr, pat);
+		cairo_clip_preserve (m_cr);
+		if (maskMode > 0)
+		{
+			cairo_pattern_t *patM = getMaskPattern();
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-			setRasterOp(m_blendModeStroke);
-#endif
-			cairo_paint_with_alpha (m_cr, stroke_trans);
+			setRasterOp(m_blendModeFill);
+#endif
+			cairo_mask(m_cr, patM);
+			if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
+				cairo_surface_destroy(imageMask);
+			cairo_pattern_destroy (patM);
 		}
 		else
 		{
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+			setRasterOp(m_blendModeFill);
+#endif
+			cairo_paint_with_alpha (m_cr, fill_trans);
+		}
+		cairo_pattern_destroy (pat);
+// #ifdef HAVE_PRIVATE_CAIRO
+#if (CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 11, 2)  || HAVE_PRIVATE_CAIRO)
+		if ((fill_gradient.type() == VGradient::fourcolor) || (fill_gradient.type() == VGradient::diamond) || (fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
+		{
+			cairo_surface_destroy(img);
+			cairo_pattern_destroy(mpat);
+			cairo_destroy( cr );
+		}
+#else
+		if ((fill_gradient.type() == VGradient::mesh) || (fill_gradient.type() == VGradient::freemesh))
+		{
+			cairo_surface_destroy(img);
+			cairo_destroy( cr );
+		}
+#endif
+	}
+	else if (fillMode == 3)
+	{
+		cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_NONE);
+		cairo_surface_t *image2 = cairo_image_surface_create_for_data ((uchar*)m_pattern->getPattern()->bits(), CAIRO_FORMAT_ARGB32, m_pattern->getPattern()->width(), m_pattern->getPattern()->height(), m_pattern->getPattern()->width()*4);
+		cairo_pattern_t *m_pat = cairo_pattern_create_for_surface(image2);
+		cairo_pattern_set_extend(m_pat, CAIRO_EXTEND_REPEAT);
+		cairo_pattern_set_filter(m_pat, CAIRO_FILTER_GOOD);
+		cairo_matrix_t matrix;
+		QTransform qmatrix;
+		qmatrix.translate(patternOffsetX, patternOffsetY);
+		qmatrix.rotate(patternRotation);
+		qmatrix.shear(-patternSkewX, patternSkewY);
+		qmatrix.scale(patternScaleX, patternScaleY);
+		qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
+		if (patternMirrorX)
+			qmatrix.scale(-1, 1);
+		if (patternMirrorY)
+			qmatrix.scale(1, -1);
+		cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
+		cairo_matrix_invert(&matrix);
+		cairo_pattern_set_matrix (m_pat, &matrix);
+		cairo_set_source (m_cr, m_pat);
+		cairo_clip_preserve (m_cr);
+		if (maskMode > 0)
+		{
+			cairo_pattern_t *patM = getMaskPattern();
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+			setRasterOp(m_blendModeFill);
+#endif
+			cairo_mask(m_cr, patM);
+			if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
+				cairo_surface_destroy(imageMask);
+			cairo_pattern_destroy (patM);
+		}
+		else
+		{
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+			setRasterOp(m_blendModeFill);
+#endif
+			cairo_paint_with_alpha (m_cr, fill_trans);
+		}
+		cairo_pattern_destroy (m_pat);
+		cairo_surface_destroy (image2);
+		cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_DEFAULT);
+	}
+	cairo_restore( m_cr );
+	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
+}
+
+void ScPainter::strokePathHelper()
+{
+	cairo_save( m_cr );
+	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
+	if( LineWidth == 0 )
+		cairo_set_line_width( m_cr, 1.0 / m_zoomFactor );
+	else
+		cairo_set_line_width( m_cr, LineWidth );
+	if( m_array.count() > 0 )
+		cairo_set_dash( m_cr, m_array.data(), m_array.count(), m_offset);
+	else
+		cairo_set_dash( m_cr, NULL, 0, 0 );
+	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
+	if( PLineEnd == Qt::RoundCap )
+		cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_ROUND);
+	else if( PLineEnd == Qt::SquareCap )
+		cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_SQUARE);
+	else if( PLineEnd == Qt::FlatCap )
+		cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_BUTT);
+	if( PLineJoin == Qt::RoundJoin )
+		cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_ROUND );
+	else if( PLineJoin == Qt::BevelJoin )
+		cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_BEVEL );
+	else if( PLineJoin == Qt::MiterJoin )
+		cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_MITER );
+	if (strokeMode == 3)
+	{
+		cairo_push_group(m_cr);
+		cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_NONE);
+		cairo_surface_t *image2 = cairo_image_surface_create_for_data ((uchar*)m_pattern->getPattern()->bits(), CAIRO_FORMAT_ARGB32, m_pattern->getPattern()->width(), m_pattern->getPattern()->height(), m_pattern->getPattern()->width()*4);
+		cairo_pattern_t *m_pat = cairo_pattern_create_for_surface(image2);
+		cairo_pattern_set_extend(m_pat, CAIRO_EXTEND_REPEAT);
+		cairo_pattern_set_filter(m_pat, CAIRO_FILTER_GOOD);
+		cairo_matrix_t matrix;
+		QTransform qmatrix;
+		qmatrix.translate(-LineWidth / 2.0, -LineWidth / 2.0);
+		qmatrix.translate(patternOffsetX, patternOffsetY);
+		qmatrix.rotate(patternRotation);
+		qmatrix.shear(-patternSkewX, patternSkewY);
+		qmatrix.scale(patternScaleX, patternScaleY);
+		qmatrix.scale(m_pattern->width / static_cast<double>(m_pattern->getPattern()->width()), m_pattern->height / static_cast<double>(m_pattern->getPattern()->height()));
+		if (patternMirrorX)
+			qmatrix.scale(-1, 1);
+		if (patternMirrorY)
+			qmatrix.scale(1, -1);
+		cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
+		cairo_matrix_invert(&matrix);
+		cairo_pattern_set_matrix (m_pat, &matrix);
+		cairo_set_source (m_cr, m_pat);
+		cairo_stroke_preserve( m_cr );
+		cairo_pattern_destroy (m_pat);
+		cairo_surface_destroy (image2);
+		cairo_set_antialias(m_cr, CAIRO_ANTIALIAS_DEFAULT);
+		cairo_pop_group_to_source (m_cr);
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+		setRasterOp(m_blendModeStroke);
+#endif
+		cairo_paint_with_alpha (m_cr, stroke_trans);
+	}
+	else if (strokeMode == 2)
+	{
+		cairo_push_group(m_cr);
+		cairo_pattern_t *pat;
+		bool   isFirst = true;
+		double rampPoint, lastPoint = 0.0;
+		double x1 = stroke_gradient.origin().x();
+		double y1 = stroke_gradient.origin().y();
+		double x2 = stroke_gradient.vector().x();
+		double y2 = stroke_gradient.vector().y();
+		double fx = stroke_gradient.focalPoint().x();
+		double fy = stroke_gradient.focalPoint().y();
+		if (stroke_gradient.type() == VGradient::linear)
+			pat = cairo_pattern_create_linear (x1, y1,  x2, y2);
+		else
+			pat = cairo_pattern_create_radial (fx, fy, 0, x1, y1, sqrt(pow(x2 - x1, 2) + pow(y2 - y1,2)));
+		cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
+		cairo_pattern_set_filter(pat, CAIRO_FILTER_GOOD);
+		QList<VColorStop*> colorStops = stroke_gradient.colorStops();
+		QColor qStopColor;
+		for( int offset = 0 ; offset < colorStops.count() ; offset++ )
+		{
+			qStopColor = colorStops[ offset ]->color;
+			rampPoint  = colorStops[ offset ]->rampPoint;
+			if ((lastPoint == rampPoint) && (!isFirst))
+				continue;
+			isFirst = false;
+			int h, s, v, sneu, vneu;
+			int shad = colorStops[offset]->shade;
+			qStopColor.getHsv(&h, &s, &v);
+			sneu = s * shad / 100;
+			vneu = 255 - ((255 - v) * shad / 100);
+			qStopColor.setHsv(h, sneu, vneu);
+			double a = colorStops[offset]->opacity;
 			double r, g, b;
-			m_stroke.getRgbF(&r, &g, &b);
-			cairo_set_source_rgba( m_cr, r, g, b, stroke_trans );
+			qStopColor.getRgbF(&r, &g, &b);
+			cairo_pattern_add_color_stop_rgba (pat, rampPoint, r, g, b, a);
+			lastPoint = rampPoint;
+		}
+		cairo_matrix_t matrix;
+		QTransform qmatrix;
+		if (stroke_gradient.type() == VGradient::radial)
+		{
+			double rotEnd = xy2Deg(x2 - x1, y2 - y1);
+			qmatrix.translate(x1, y1);
+			qmatrix.rotate(rotEnd);
+			qmatrix.shear(gradientSkew, 0);
+			qmatrix.translate(0, y1 * (1.0 - gradientScale));
+			qmatrix.translate(-x1, -y1);
+			qmatrix.scale(1, gradientScale);
+		}
+		else
+		{
+			qmatrix.translate(x1, y1);
+			qmatrix.shear(-gradientSkew, 0);
+			qmatrix.translate(-x1, -y1);
+		}
+		cairo_matrix_init(&matrix, qmatrix.m11(), qmatrix.m12(), qmatrix.m21(), qmatrix.m22(), qmatrix.dx(), qmatrix.dy());
+		cairo_matrix_invert(&matrix);
+		cairo_pattern_set_matrix (pat, &matrix);
+		cairo_set_source (m_cr, pat);
+		cairo_stroke_preserve( m_cr );
+		cairo_pattern_destroy (pat);
+		cairo_pop_group_to_source (m_cr);
 #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
-			setRasterOp(m_blendModeStroke);
-#endif
-			cairo_stroke_preserve( m_cr );
-		}
+		setRasterOp(m_blendModeStroke);
+#endif
+		cairo_paint_with_alpha (m_cr, stroke_trans);
+	}
+	else
+	{
+		double r, g, b;
+		m_stroke.getRgbF(&r, &g, &b);
+		cairo_set_source_rgba( m_cr, r, g, b, stroke_trans );
+#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 9, 4)
+		setRasterOp(m_blendModeStroke);
+#endif
+		cairo_stroke_preserve( m_cr );
 	}
 	cairo_restore( m_cr );
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);

Modified: trunk/Scribus/scribus/scpainter.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpainter.h
==============================================================================
--- trunk/Scribus/scribus/scpainter.h (original)
+++ trunk/Scribus/scribus/scpainter.h Fri Feb 10 22:20:30 2012
@@ -59,8 +59,6 @@
 	virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 );
 	virtual void newPath();
 	virtual void closePath();
-	virtual void fillTextPath();
-	virtual void strokeTextPath();
 	virtual void fillPath();
 	virtual void strokePath();
 	virtual void setFillRule( bool fillRule );
@@ -121,7 +119,8 @@
 	ScPattern *m_pattern;
 
 private:
-	void drawVPath( int mode );
+	void fillPathHelper();
+	void strokePathHelper();
 
 	cairo_t *m_cr;
 	struct layerProp

Modified: trunk/Scribus/scribus/scpainterex_ps2.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpainterex_ps2.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainterex_ps2.cpp (original)
+++ trunk/Scribus/scribus/scpainterex_ps2.cpp Fri Feb 10 22:20:30 2012
@@ -272,18 +272,6 @@
 	m_patternSkewY   = skewY;
 	m_patternMirrorX = mirrorX;
 	m_patternMirrorY = mirrorY;
-}
-
-void ScPainterEx_Ps2::fillTextPath()
-{
-	drawVPath( 0 );
-}
-
-void ScPainterEx_Ps2::strokeTextPath()
-{
-	if( m_lineWidth == 0 )
-		return;
-	drawVPath( 1 );
 }
 
 void ScPainterEx_Ps2::fillPath()

Modified: trunk/Scribus/scribus/scpainterex_ps2.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpainterex_ps2.h
==============================================================================
--- trunk/Scribus/scribus/scpainterex_ps2.h (original)
+++ trunk/Scribus/scribus/scpainterex_ps2.h Fri Feb 10 22:20:30 2012
@@ -1,117 +1,115 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-/* This file is part of the KDE project
-   Copyright (C) 2001, 2002, 2003 The Karbon Developers
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License as published by the Free Software Foundation; either
-   version 2 of the License, or (at your option) any later version.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.
-*/
-/* Adapted for Scribus 22.08.2003 by Franz Schmid */
-/* Adapted for Scribus 15.01.2006 by Jean Ghali */
-
-#ifndef __SCPAINTEREX_PS2_H__
-#define __SCPAINTEREX_PS2_H__
-
-// libart wrapper
-
-#include <QGlobalStatic>
-#include <QColor>
-#include <QFont>
-#include <QTransform>
-#include <QList>
-#include <QPixmap>
-#include <QStack>
-#include <QTextStream>
-
-#include "scribusapi.h"
-#include "scconfig.h"
-#include "colormgmt/sccolormgmtengine.h"
-#include "fpoint.h"
-#include "fpointarray.h"
-#include "vgradient.h"
-#include "scpainterexbase.h"
-
-class ScribusDoc;
-
-class ScPs2OutputParams
-{
-public:
-	ScPs2OutputParams(ScribusDoc* doc = NULL);
-	ScPainterExBase::ColorMode colorMode;
-	ScribusDoc* document;
-	bool reloadImages;
-	int resolution;
-	bool useProfiles;
-	bool toGray;
-	bool mirrorH;
-	bool mirrorV;
-	QString outputProfile;
-	ScColorProfile   hProfile;
-	ScColorTransform rgbToOutputColorTransform;
-	ScColorTransform rgbToOutputImageTransform;
-	ScColorTransform cmykToOutputColorTransform;
-	ScColorTransform cmykToOutputImageTransform;
-};
-
-class SCRIBUS_API ScPainterEx_Ps2 : public ScPainterExBase
-{
-public:
-
-	ScPainterEx_Ps2( QIODevice* iodev, QRect& rect, ScPs2OutputParams& options );
-	virtual ~ScPainterEx_Ps2();
-
-	virtual int supportedColorModes() { return (int) (rgbMode|cmykMode); }
-	virtual ColorMode preferredColorMode() { return m_colorMode; }
-	virtual void setPreferredColorMode(ScPainterEx_Ps2::ColorMode colorMode) { m_colorMode = colorMode; }
-	virtual ImageMode imageMode();
-
-	virtual void begin();
-	virtual void end();
-	virtual void clear();
-	virtual void clear( ScColorShade & );
-
-	// matrix manipulation
-	virtual void setWorldMatrix( const QTransform & );
-	virtual const QTransform worldMatrix();
-	virtual void translate( double, double );
-	virtual void rotate( double );
-	virtual void scale( double, double );
-
-	// drawing
-	virtual void moveTo( const double &, const double & );
-	virtual void lineTo( const double &, const double & );
-	virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 );
-	virtual void newPath();
-	virtual void closePath();
-	virtual void fillTextPath();
-	virtual void strokeTextPath();
-	virtual void fillPath();
-	virtual void strokePath();
-	virtual void setFillRule( bool fillRule );
-	virtual bool fillRule() { return m_fillRule; }
-	virtual void setFillMode( int fill );
-	virtual int  fillMode() { return m_fillMode; }
-	virtual void setStrokeMode( int fill );
-	virtual int  strokeMode() { return m_strokeMode; }
-	virtual void setGradient( VGradientEx::Type mode, FPoint orig, FPoint vec, FPoint foc, double scale, double skew);
-	virtual void setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
-
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+/* This file is part of the KDE project
+   Copyright (C) 2001, 2002, 2003 The Karbon Developers
+
+   This library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public
+   License as published by the Free Software Foundation; either
+   version 2 of the License, or (at your option) any later version.
+
+   This library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public License
+   along with this library; see the file COPYING.LIB.  If not, write to
+   the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.
+*/
+/* Adapted for Scribus 22.08.2003 by Franz Schmid */
+/* Adapted for Scribus 15.01.2006 by Jean Ghali */
+
+#ifndef __SCPAINTEREX_PS2_H__
+#define __SCPAINTEREX_PS2_H__
+
+// libart wrapper
+
+#include <QGlobalStatic>
+#include <QColor>
+#include <QFont>
+#include <QTransform>
+#include <QList>
+#include <QPixmap>
+#include <QStack>
+#include <QTextStream>
+
+#include "scribusapi.h"
+#include "scconfig.h"
+#include "colormgmt/sccolormgmtengine.h"
+#include "fpoint.h"
+#include "fpointarray.h"
+#include "vgradient.h"
+#include "scpainterexbase.h"
+
+class ScribusDoc;
+
+class ScPs2OutputParams
+{
+public:
+	ScPs2OutputParams(ScribusDoc* doc = NULL);
+	ScPainterExBase::ColorMode colorMode;
+	ScribusDoc* document;
+	bool reloadImages;
+	int resolution;
+	bool useProfiles;
+	bool toGray;
+	bool mirrorH;
+	bool mirrorV;
+	QString outputProfile;
+	ScColorProfile   hProfile;
+	ScColorTransform rgbToOutputColorTransform;
+	ScColorTransform rgbToOutputImageTransform;
+	ScColorTransform cmykToOutputColorTransform;
+	ScColorTransform cmykToOutputImageTransform;
+};
+
+class SCRIBUS_API ScPainterEx_Ps2 : public ScPainterExBase
+{
+public:
+
+	ScPainterEx_Ps2( QIODevice* iodev, QRect& rect, ScPs2OutputParams& options );
+	virtual ~ScPainterEx_Ps2();
+
+	virtual int supportedColorModes() { return (int) (rgbMode|cmykMode); }
+	virtual ColorMode preferredColorMode() { return m_colorMode; }
+	virtual void setPreferredColorMode(ScPainterEx_Ps2::ColorMode colorMode) { m_colorMode = colorMode; }
+	virtual ImageMode imageMode();
+
+	virtual void begin();
+	virtual void end();
+	virtual void clear();
+	virtual void clear( ScColorShade & );
+
+	// matrix manipulation
+	virtual void setWorldMatrix( const QTransform & );
+	virtual const QTransform worldMatrix();
+	virtual void translate( double, double );
+	virtual void rotate( double );
+	virtual void scale( double, double );
+
+	// drawing
+	virtual void moveTo( const double &, const double & );
+	virtual void lineTo( const double &, const double & );
+	virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 );
+	virtual void newPath();
+	virtual void closePath();
+	virtual void fillPath();
+	virtual void strokePath();
+	virtual void setFillRule( bool fillRule );
+	virtual bool fillRule() { return m_fillRule; }
+	virtual void setFillMode( int fill );
+	virtual int  fillMode() { return m_fillMode; }
+	virtual void setStrokeMode( int fill );
+	virtual int  strokeMode() { return m_strokeMode; }
+	virtual void setGradient( VGradientEx::Type mode, FPoint orig, FPoint vec, FPoint foc, double scale, double skew);
+	virtual void setPattern(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
+
 	virtual void setMaskMode( int mask ) {};
 	virtual void setGradientMask(VGradientEx::Type mode, FPoint orig, FPoint vec, FPoint foc, double scale, double skew) {};
 	virtual void setPatternMask(ScPattern *pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY) {};
@@ -120,100 +118,100 @@
 	virtual void set4ColorColors(const ScColorShade& col1, const ScColorShade& col2, const ScColorShade& col3, const ScColorShade& col4) {};
 	virtual void setDiamondGeometry(FPoint p1, FPoint p2, FPoint p3, FPoint p4, FPoint c1, FPoint c2, FPoint c3, FPoint c4, FPoint c5) {};
 	virtual void setMeshGradient(FPoint p1, FPoint p2, FPoint p3, FPoint p4, QList<QList<meshPoint> > meshArray) {};
-	virtual void setMeshGradient(FPoint p1, FPoint p2, FPoint p3, FPoint p4, QList<meshGradientPatch> meshPatches) {};
-
-	virtual void setClipPath();
-
-	virtual void drawImage( ScImage *image, ScPainterExBase::ImageMode mode );
-	virtual void drawRGBImage_ps2( ScImage *image );
-	virtual void drawCMYKImage_ps2( ScImage *image );
-
-	virtual bool hasAlphaChannel( ScImage* image );
-
-	virtual void setupPolygon(FPointArray *points, bool closed = true);
-	virtual void drawPolygon();
-	virtual void drawPolyLine();
-	virtual void drawLine(FPoint start, FPoint end);
-	virtual void drawRect(double, double, double, double);
-
-	// pen + brush
-	virtual ScColorShade pen();
-	virtual ScColorShade brush();
-	virtual void setPen( const ScColorShade & );
-	virtual void setPen( const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo );
-	virtual void setPenOpacity( double op );
-	virtual void setLineWidth( double w);
-	virtual void setDash(const QVector<double>& array, double ofs);
-	virtual void setBrush( const ScColorShade & );
-	virtual void setBrushOpacity( double op );
-	virtual void setOpacity( double op );
-	virtual void setFont( const QFont &f );
-	virtual QFont font();
-
-	// stack management
-	virtual void save();
-	virtual void restore();
-
-	virtual void setRasterOp( int op );
+	virtual void setMeshGradient(FPoint p1, FPoint p2, FPoint p3, FPoint p4, QList<meshGradientPatch> meshPatches) {};
+
+	virtual void setClipPath();
+
+	virtual void drawImage( ScImage *image, ScPainterExBase::ImageMode mode );
+	virtual void drawRGBImage_ps2( ScImage *image );
+	virtual void drawCMYKImage_ps2( ScImage *image );
+
+	virtual bool hasAlphaChannel( ScImage* image );
+
+	virtual void setupPolygon(FPointArray *points, bool closed = true);
+	virtual void drawPolygon();
+	virtual void drawPolyLine();
+	virtual void drawLine(FPoint start, FPoint end);
+	virtual void drawRect(double, double, double, double);
+
+	// pen + brush
+	virtual ScColorShade pen();
+	virtual ScColorShade brush();
+	virtual void setPen( const ScColorShade & );
+	virtual void setPen( const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo );
+	virtual void setPenOpacity( double op );
+	virtual void setLineWidth( double w);
+	virtual void setDash(const QVector<double>& array, double ofs);
+	virtual void setBrush( const ScColorShade & );
+	virtual void setBrushOpacity( double op );
+	virtual void setOpacity( double op );
+	virtual void setFont( const QFont &f );
+	virtual QFont font();
+
+	// stack management
+	virtual void save();
+	virtual void restore();
+
+	virtual void setRasterOp( int op );
 	virtual void setBlendModeFill( int blendMode ) {};
-	virtual void setBlendModeStroke( int blendMode ) {};
-
-protected:
-
-	virtual void writeRGBImageToStream_Ascii85 ( ScImage* image );
-	virtual void writeRGBImageToStream_AsciiHex ( ScImage* image );
-	virtual void writeCMYKImageToStream_Ascii85( ScImage* image );
-	virtual void writeCMYKImageToStream_AsciiHex( ScImage* image );
-	virtual void writeMaskToStream ( QImage* image ); 
-
-private:
-
-	typedef enum {
-		Ascii85Encoding,
-		AsciiHexEncoding
-	} AsciiEncoding;
-
-	/* Output stream */
-	QTextStream   m_stream;
-	ColorMode     m_colorMode;
-	AsciiEncoding m_encoding; 
-
-	/* Path bounding boxes*/
-	QRect m_pathBBox;
-	QRect m_clipBBox;
-
-	/* General output options */
-	ScPs2OutputParams m_options;
-
-	/* Basic drawing functions*/
-	void drawVPath( int mode );
-	void drawGradient( VGradientEx& gradient );
-	void drawLinearGradient( VGradientEx& gradient, const QRect& rect );
-	void drawLinearGradient_RGB( VGradientEx& gradient, const QRect& rect );
-	void drawLinearGradient_CMYK( VGradientEx& gradient, const QRect& rect );
-	void drawCircularGradient( VGradientEx& gradient, const QRect& rect );
-	void drawCircularGradient_RGB( VGradientEx& gradient, const QRect& rect );
-	void drawCircularGradient_CMYK( VGradientEx& gradient, const QRect& rect );
-	void getPathBoundingBox( FPointArray* points, QRect& r );
-	void transformPoint( const FPoint& in, FPoint& out );
-	void transformPoints( const FPoint* in, FPoint* out, uint length );
-
-	void putColor( ScColorShade& colorShade, bool doFill );
-
-	unsigned int m_width;
-	unsigned int m_height;
-	unsigned int m_x;
-	unsigned int m_y;
-	QTransform m_pageTrans;
-	QTransform m_matrix;
-	QFont m_font;
-/* Filling */
-	ScColorShade m_fillColor;
-	double m_fillTrans;
-	bool   m_fillRule;
-	int    m_fillMode;			// 0 = none, 1 = solid, 2 = gradient
-	int    m_gradientMode;		// 1 = linear, 2 = radial
-
+	virtual void setBlendModeStroke( int blendMode ) {};
+
+protected:
+
+	virtual void writeRGBImageToStream_Ascii85 ( ScImage* image );
+	virtual void writeRGBImageToStream_AsciiHex ( ScImage* image );
+	virtual void writeCMYKImageToStream_Ascii85( ScImage* image );
+	virtual void writeCMYKImageToStream_AsciiHex( ScImage* image );
+	virtual void writeMaskToStream ( QImage* image ); 
+
+private:
+
+	typedef enum {
+		Ascii85Encoding,
+		AsciiHexEncoding
+	} AsciiEncoding;
+
+	/* Output stream */
+	QTextStream   m_stream;
+	ColorMode     m_colorMode;
+	AsciiEncoding m_encoding; 
+
+	/* Path bounding boxes*/
+	QRect m_pathBBox;
+	QRect m_clipBBox;
+
+	/* General output options */
+	ScPs2OutputParams m_options;
+
+	/* Basic drawing functions*/
+	void drawVPath( int mode );
+	void drawGradient( VGradientEx& gradient );
+	void drawLinearGradient( VGradientEx& gradient, const QRect& rect );
+	void drawLinearGradient_RGB( VGradientEx& gradient, const QRect& rect );
+	void drawLinearGradient_CMYK( VGradientEx& gradient, const QRect& rect );
+	void drawCircularGradient( VGradientEx& gradient, const QRect& rect );
+	void drawCircularGradient_RGB( VGradientEx& gradient, const QRect& rect );
+	void drawCircularGradient_CMYK( VGradientEx& gradient, const QRect& rect );
+	void getPathBoundingBox( FPointArray* points, QRect& r );
+	void transformPoint( const FPoint& in, FPoint& out );
+	void transformPoints( const FPoint* in, FPoint* out, uint length );
+
+	void putColor( ScColorShade& colorShade, bool doFill );
+
+	unsigned int m_width;
+	unsigned int m_height;
+	unsigned int m_x;
+	unsigned int m_y;
+	QTransform m_pageTrans;
+	QTransform m_matrix;
+	QFont m_font;
+/* Filling */
+	ScColorShade m_fillColor;
+	double m_fillTrans;
+	bool   m_fillRule;
+	int    m_fillMode;			// 0 = none, 1 = solid, 2 = gradient
+	int    m_gradientMode;		// 1 = linear, 2 = radial
+
 	double m_patternScaleX;
 	double m_patternScaleY;
 	double m_patternOffsetX;
@@ -222,37 +220,37 @@
 	double m_patternSkewX;
 	double m_patternSkewY;
 	bool   m_patternMirrorX;
-	bool   m_patternMirrorY;
-
-/* Stroking */
-	ScColorShade m_strokeColor;
-	double m_strokeTrans;
-	double m_lineWidth;
-	int    m_strokeMode;				// 0 = none, 1 = solid, 2 = gradient 3 = pattern
-/* Line End Style */
-	Qt::PenCapStyle m_lineEnd;
-/* Line Join Style */
-	Qt::PenJoinStyle m_lineJoin;
-/* The Dash Array */
-	QVector<double> m_array;
-	double m_offset;
-/* Transformation Stack */
-	QStack<QTransform> m_stack;
-/* Zoom Factor of the Painter */
-	double m_zoomFactor;
-
-/* Some data to describe state of drawing */	
-	bool m_pathIsClosed;
-	bool m_drawingClosedPath;
-/* Drawing surface dimensions */
-	double m_deviceDimX;
-	double m_deviceDimY;
-/* Device resolutions */
-	double m_deviceResX;
-	double m_deviceResY;
-
-/* Color conversion function */
-	void   transformImage( QImage* image, uchar* data, int scan);
-};
-
-#endif
+	bool   m_patternMirrorY;
+
+/* Stroking */
+	ScColorShade m_strokeColor;
+	double m_strokeTrans;
+	double m_lineWidth;
+	int    m_strokeMode;				// 0 = none, 1 = solid, 2 = gradient 3 = pattern
+/* Line End Style */
+	Qt::PenCapStyle m_lineEnd;
+/* Line Join Style */
+	Qt::PenJoinStyle m_lineJoin;
+/* The Dash Array */
+	QVector<double> m_array;
+	double m_offset;
+/* Transformation Stack */
+	QStack<QTransform> m_stack;
+/* Zoom Factor of the Painter */
+	double m_zoomFactor;
+
+/* Some data to describe state of drawing */	
+	bool m_pathIsClosed;
+	bool m_drawingClosedPath;
+/* Drawing surface dimensions */
+	double m_deviceDimX;
+	double m_deviceDimY;
+/* Device resolutions */
+	double m_deviceResX;
+	double m_deviceResY;
+
+/* Color conversion function */
+	void   transformImage( QImage* image, uchar* data, int scan);
+};
+
+#endif

Modified: trunk/Scribus/scribus/scpainterexbase.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17288&path=/trunk/Scribus/scribus/scpainterexbase.h
==============================================================================
--- trunk/Scribus/scribus/scpainterexbase.h (original)
+++ trunk/Scribus/scribus/scpainterexbase.h Fri Feb 10 22:20:30 2012
@@ -84,8 +84,6 @@
 	virtual void lineTo( const double &, const double & ) = 0;
 	virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 ) = 0;
 	virtual void newPath() = 0;
-	virtual void fillTextPath() = 0;
-	virtual void strokeTextPath() = 0;
 	virtual void fillPath() = 0;
 	virtual void strokePath() = 0;
 	virtual void setFillRule( bool fillRule ) = 0;




More information about the scribus-commit mailing list