r24112 by jghali - Code style fixes

scribus-commit scribus-commit at lists.scribus.net
Mon Oct 26 21:20:50 UTC 2020


Author: jghali
Date: Mon Oct 26 21:20:50 2020
New Revision: 24112

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=24112
Log:
Code style fixes

Modified:
    trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
    trunk/Scribus/scribus/scpageoutput.cpp
    trunk/Scribus/scribus/scpainterex_cairo.cpp

Modified: trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24112&path=/trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	(original)
+++ trunk/Scribus/scribus/plugins/tools/hunspellcheck/hunspelldialog.cpp	Mon Oct 26 21:20:50 2020
@@ -115,8 +115,8 @@
 
 	int sentencePos = 0;
 	QString sentence(m_iText->sentence(currWF.start, sentencePos));
-	sentence.insert(currWF.end-sentencePos+currWF.changeOffset,"</b></font>");
-	sentence.insert(currWF.start-sentencePos+currWF.changeOffset,"<font color=red><b>");
+	sentence.insert(currWF.end - sentencePos + currWF.changeOffset, "</b></font>");
+	sentence.insert(currWF.start - sentencePos + currWF.changeOffset, "<font color=red><b>");
 	sentenceTextEdit->setText(sentence);
 }
 
@@ -221,7 +221,7 @@
 {
 	m_returnToDefaultLang = true;
 	QString wordLang = LanguageManager::instance()->getAbbrevFromLang(newLanguage, false);
-	if (!m_hspellerMap->contains(wordLang) )
+	if (!m_hspellerMap->contains(wordLang))
 	{
 		//qDebug() << "hspeller"<<wordLang<<"does not exist";
 		return;

Modified: trunk/Scribus/scribus/scpageoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24112&path=/trunk/Scribus/scribus/scpageoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/scpageoutput.cpp	(original)
+++ trunk/Scribus/scribus/scpageoutput.cpp	Mon Oct 26 21:20:50 2020
@@ -77,19 +77,19 @@
 	m_useProfiles = useProfiles;
 }
 
-ScImage::RequestType ScPageOutput::translateImageModeToRequest( ScPainterExBase::ImageMode mode )
+ScImage::RequestType ScPageOutput::translateImageModeToRequest(ScPainterExBase::ImageMode mode)
 {
 	ScImage::RequestType value = ScImage::RGBData;
-	if ( mode == ScPainterExBase::cmykImages )
+	if (mode == ScPainterExBase::cmykImages)
 		value = ScImage::CMYKData;
-	else if ( mode == ScPainterExBase::rgbImages )
+	else if (mode == ScPainterExBase::rgbImages)
 		value = ScImage::RGBData;
-	else if ( mode == ScPainterExBase::rawImages )
+	else if (mode == ScPainterExBase::rawImages)
 		value = ScImage::RawData;
 	return value;
 }
 
-void ScPageOutput::drawPage( ScPage* page, ScPainterExBase* painter)
+void ScPageOutput::drawPage(ScPage* page, ScPainterExBase* painter)
 {
 	int clipx = static_cast<int>(page->xOffset());
 	int clipy = static_cast<int>(page->yOffset());
@@ -182,12 +182,12 @@
 		QRectF oldR(currItem->getBoundingRect().adjusted(0.0, 0.0, 1.0, 1.0));
 		if (clip.intersects(oldR.toRect()))
 		{
-			drawItem( currItem, painter, clip );
-		}
-	}
-}
-
-void ScPageOutput::drawItem( PageItem* item, ScPainterExBase* painter, QRect clip )
+			drawItem(currItem, painter, clip);
+		}
+	}
+}
+
+void ScPageOutput::drawItem(PageItem* item, ScPainterExBase* painter, QRect clip)
 {
 	if (clip.isNull())
 	{
@@ -198,33 +198,33 @@
 	drawItem_Pre(item, painter);
 	PageItem::ItemType itemType = item->itemType();
 	if (itemType == PageItem::Arc)
-		drawItem_Arc( (PageItem_Arc*) item, painter, clip);
+		drawItem_Arc((PageItem_Arc*) item, painter, clip);
 	else if (itemType == PageItem::Group)
-		drawItem_Group( (PageItem_Group*) item, painter, clip);
+		drawItem_Group((PageItem_Group*) item, painter, clip);
 	else if (itemType == PageItem::ImageFrame)
-		drawItem_ImageFrame( (PageItem_ImageFrame*) item, painter, clip);
+		drawItem_ImageFrame((PageItem_ImageFrame*) item, painter, clip);
 	else if (itemType == PageItem::Line)
-		drawItem_Line( (PageItem_Line*) item, painter, clip);
+		drawItem_Line((PageItem_Line*) item, painter, clip);
 	else if (itemType == PageItem::Polygon)
-		drawItem_Polygon( (PageItem_Polygon*) item, painter, clip);
+		drawItem_Polygon((PageItem_Polygon*) item, painter, clip);
 	else if (itemType == PageItem::PolyLine)
-		drawItem_PolyLine( (PageItem_PolyLine*) item, painter, clip);
+		drawItem_PolyLine((PageItem_PolyLine*) item, painter, clip);
 	else if (itemType == PageItem::RegularPolygon)
-		drawItem_RegularPolygon( (PageItem_RegularPolygon*) item, painter, clip);
+		drawItem_RegularPolygon((PageItem_RegularPolygon*) item, painter, clip);
 	else if (itemType == PageItem::Spiral)
-		drawItem_Spiral( (PageItem_Spiral*) item, painter, clip);
+		drawItem_Spiral((PageItem_Spiral*) item, painter, clip);
 	else if (itemType == PageItem::Table)
-		drawItem_Table( (PageItem_Table*) item, painter, clip);
+		drawItem_Table((PageItem_Table*) item, painter, clip);
 	else if (itemType == PageItem::TextFrame || itemType == PageItem::PathText)
 		drawItem_Text(item, painter, clip);
 	drawItem_Post(item, painter);
 }
 
-void ScPageOutput::drawItem_Pre( PageItem* item, ScPainterExBase* painter)
+void ScPageOutput::drawItem_Pre(PageItem* item, ScPainterExBase* painter)
 {
 	painter->save();
 	if (!item->isEmbedded)
-		painter->translate( item->xPos(), item->yPos());
+		painter->translate(item->xPos(), item->yPos());
 	painter->rotate(item->rotation());
 	painter->setBlendModeFill(item->fillBlendmode());
 	painter->setLineWidth(item->lineWidth());
@@ -281,7 +281,7 @@
 		{
 			if (item->fillColor() != CommonStrings::None)
 			{
-				painter->setBrush( ScColorShade(m_doc->PageColors[item->fillColor()], (int) item->fillShade()) );
+				painter->setBrush(ScColorShade(m_doc->PageColors[item->fillColor()], (int) item->fillShade()));
 				painter->setFillMode(ScPainterExBase::Solid);
 			}
 			else
@@ -328,7 +328,7 @@
 		painter->m_fillGradient = VGradientEx(VGradientEx::linear);
 		if (item->fillColor() != CommonStrings::None)
 		{
-			painter->setBrush( ScColorShade(m_doc->PageColors[item->fillColor()], (int) item->fillShade()) );
+			painter->setBrush(ScColorShade(m_doc->PageColors[item->fillColor()], (int) item->fillShade()));
 			painter->setFillMode(ScPainterExBase::Solid);
 		}
 		else
@@ -341,7 +341,7 @@
 		else
 		{
 			ScColorShade tmp(m_doc->PageColors[item->lineColor()], (int) item->lineShade());
-			painter->setPen( tmp , item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
+			painter->setPen(tmp , item->lineWidth(), item->PLineArt, item->PLineEnd, item->PLineJoin);
 			if (item->DashValues.count() != 0)
 				painter->setDash(item->DashValues, item->DashOffset);
 		}
@@ -397,13 +397,13 @@
 		painter->setMaskMode(0);
 }
 
-void ScPageOutput::drawItem_Post( PageItem* item, ScPainterExBase* painter )
+void ScPageOutput::drawItem_Post(PageItem* item, ScPainterExBase* painter)
 {
 	bool doStroke = true;
 	if (!item->isGroup())
 	{
 		painter->setMaskMode(0);
-		if (item->isGroup() || item->isLine() || item->isPathText() || item->isPolyLine() || item->isSpiral() || item->isSymbol() || item->isTable() )
+		if (item->isGroup() || item->isLine() || item->isPathText() || item->isPolyLine() || item->isSpiral() || item->isSymbol() || item->isTable())
 			doStroke = false;
 		if (doStroke)
 		{
@@ -506,7 +506,7 @@
 	painter->restore();
 }
 
-void ScPageOutput::drawItem_Embedded( PageItem* item, ScPainterExBase *p, QRect clip, const CharStyle& style, PageItem* cembedded)
+void ScPageOutput::drawItem_Embedded(PageItem* item, ScPainterExBase *p, QRect clip, const CharStyle& style, PageItem* cembedded)
 {
 	if (!cembedded)
 		return;
@@ -518,13 +518,13 @@
 		p->save();
 		double x = embedded->xPos();
 		double y = embedded->yPos();
-		embedded->setXPos( embedded->gXpos, true );
-		embedded->setYPos((embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos, true );
+		embedded->setXPos(embedded->gXpos, true);
+		embedded->setYPos((embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos, true);
 		p->translate((embedded->gXpos * (style.scaleH() / 1000.0)), ( - (embedded->gHeight * (style.scaleV() / 1000.0)) + embedded->gYpos * (style.scaleV() / 1000.0)));
 		if (style.baselineOffset() != 0)
 		{
 			p->translate(0, -embedded->gHeight * (style.baselineOffset() / 1000.0));
-			embedded->setYPos( embedded->yPos() - embedded->gHeight * (style.baselineOffset() / 1000.0) );
+			embedded->setYPos(embedded->yPos() - embedded->gHeight * (style.baselineOffset() / 1000.0));
 		}
 		p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
 		double pws = embedded->m_lineWidth;
@@ -559,7 +559,7 @@
 	}
 }
 
-void ScPageOutput::drawPattern( PageItem* item, ScPainterExBase* painter, QRect clip)
+void ScPageOutput::drawPattern(PageItem* item, ScPainterExBase* painter, QRect clip)
 {
 	double x1, x2, y1, y2;
 	ScPattern& pattern = m_doc->docPatterns[item->pattern()];
@@ -586,10 +586,10 @@
 	double ctheta = cos(rot * M_PI / 180);
 	double stheta = sin(rot * M_PI / 180);
 	QRectF  itemRect(0.0, 0.0, item->width(), item->height());
-	QPointF pa( width * stheta * stheta, -width * stheta * ctheta );
-	QPointF pb( width + height * ctheta * stheta, height * stheta * stheta );
-	QPointF pc( -height * ctheta * stheta, height * ctheta * ctheta );
-	QPointF pd( width * ctheta * ctheta, height + width * ctheta * stheta );
+	QPointF pa(width * stheta * stheta, -width * stheta * ctheta);
+	QPointF pb(width + height * ctheta * stheta, height * stheta * stheta);
+	QPointF pc(-height * ctheta * stheta, height * ctheta * ctheta);
+	QPointF pd(width * ctheta * ctheta, height + width * ctheta * stheta);
 	QPointF ipa = invMat.map(pa), ipb = invMat.map(pb);
 	QPointF ipc = invMat.map(pc), ipd = invMat.map(pd);
 
@@ -622,25 +622,25 @@
 		double kyb = (ipb.y() - it->gYpos) / patHeight;
 		double kyc = (ipc.y() - it->gYpos) / patHeight;
 		double kyd = (ipd.y() - it->gYpos) / patHeight;
-		int kxMin  = (int) floor( qMin(qMin(kxa, kxb), qMin(kxc, kxd)) );
-		int kxMax  = (int) ceil ( qMax(qMax(kxa, kxb), qMax(kxc, kxd)) );
-		int kyMin  = (int) floor( qMin(qMin(kya, kyb), qMin(kyc, kyd)) );
-		int kyMax  = (int) ceil ( qMax(qMax(kya, kyb), qMax(kyc, kyd)) );
+		int kxMin  = (int) floor(qMin(qMin(kxa, kxb), qMin(kxc, kxd)));
+		int kxMax  = (int) ceil (qMax(qMax(kxa, kxb), qMax(kxc, kxd)));
+		int kyMin  = (int) floor(qMin(qMin(kya, kyb), qMin(kyc, kyd)));
+		int kyMax  = (int) ceil (qMax(qMax(kya, kyb), qMax(kyc, kyd)));
 
 		double itx = it->xPos();
 		double ity = it->yPos();
 		double itPosX = it->gXpos, itPosY = it->gYpos;
-		for ( int kx = kxMin; kx <= kxMax; kx++ )
-		{
-			for ( int ky = kyMin; ky <= kyMax; ky++ )
+		for (int kx = kxMin; kx <= kxMax; kx++)
+		{
+			for (int ky = kyMin; ky <= kyMax; ky++)
 			{
 				itPosX = it->gXpos + kx * pattern.width;
 				itPosY = it->gYpos + ky * pattern.height;
 				it->setXYPos(itPosX, itPosY);
 				it->getBoundingRect(&x1, &y1, &x2, &y2);
 				itRect.setCoords(x1, y1, x2, y2);
-				itRect = matrix.mapRect( itRect );
-				if ( itRect.intersects(itemRect) )
+				itRect = matrix.mapRect(itRect);
+				if (itRect.intersects(itemRect))
 					drawItem(it, painter, clip);
 			}
 		}
@@ -655,13 +655,13 @@
 
 }
 
-void ScPageOutput::drawItem_Arc ( PageItem_Arc* item , ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_Arc(PageItem_Arc* item , ScPainterExBase* painter, QRect clip)
 {
 	painter->setupPolygon(&item->PoLine);
 	fillPath(item, painter, clip);
 }
 
-void ScPageOutput::drawItem_Group( PageItem_Group* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_Group(PageItem_Group* item, ScPainterExBase* painter, QRect clip)
 {
 	if (item->groupItemList.isEmpty())
 		return;
@@ -733,7 +733,7 @@
 	painter->restore();
 }
 
-void ScPageOutput::drawItem_ImageFrame( PageItem_ImageFrame* item, ScPainterExBase* painter, QRect clip  )
+void ScPageOutput::drawItem_ImageFrame(PageItem_ImageFrame* item, ScPainterExBase* painter, QRect clip)
 {
 	ScPainterExBase::ImageMode mode = ScPainterExBase::rgbImages;
 	if ((item->fillColor() != CommonStrings::None) || (item->GrType != 0))
@@ -743,7 +743,7 @@
 	}
 	if (item->Pfile.isEmpty())
 	{
-		/*painter->setPen( ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+		/*painter->setPen(ScColorShade(Qt::black, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 		painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height()));
 		painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0));*/
 	}
@@ -751,7 +751,7 @@
 	{
 		if ((!item->imageVisible()) || (!item->imageIsAvailable))
 		{
-			/*painter->setPen( ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			/*painter->setPen(ScColorShade(Qt::red, 100), 1, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 			painter->drawLine(FPoint(0, 0), FPoint(item->width(), item->height()));
 			painter->drawLine(FPoint(0, item->height()), FPoint(item->width(), 0));*/
 		}
@@ -766,7 +766,7 @@
 				bool dummy;
 				bool useCmyk = false;
 				ScPainterExBase::ImageMode imageMode = painter->imageMode();
-				if ( imageMode == ScPainterExBase::cmykImages )
+				if (imageMode == ScPainterExBase::cmykImages)
 					useCmyk = true;
 				QFileInfo fInfo(item->Pfile);
 				QString ext = fInfo.suffix();
@@ -780,7 +780,7 @@
 				scImg.imgInfo.RequestProps = item->pixm.imgInfo.RequestProps;
 				scImg.imgInfo.isRequest = item->pixm.imgInfo.isRequest;
 				scImg.loadPicture(item->Pfile, item->pixm.imgInfo.actualPageNumber, cmsSettings, translateImageModeToRequest(imageMode), m_imageRes, &dummy);
-				if (extensionIndicatesEPSorPS(ext) || extensionIndicatesPDF(ext) )
+				if (extensionIndicatesEPSorPS(ext) || extensionIndicatesPDF(ext))
 				{
 					imScaleX *= (72.0 / (double) m_imageRes);
 					imScaleY *= (72.0 / (double) m_imageRes);
@@ -812,7 +812,7 @@
 			}
 			painter->translate(item->imageXOffset() * item->imageXScale(), item->imageYOffset() * item->imageYScale());
 			painter->rotate(item->imageRotation());
-			painter->scale( imScaleX, imScaleY );
+			painter->scale(imScaleX, imScaleY);
 			if (pImage->imgInfo.lowResType != 0)
 				painter->scale(pImage->imgInfo.lowResScale, pImage->imgInfo.lowResScale);
 			painter->drawImage(pImage, mode);
@@ -821,7 +821,7 @@
 	}
 }
 
-void ScPageOutput::drawItem_Line( PageItem_Line* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_Line(PageItem_Line* item, ScPainterExBase* painter, QRect clip)
 {
 	int startArrowIndex = item->startArrowIndex();
 	int endArrowIndex = item->endArrowIndex();
@@ -1111,13 +1111,13 @@
 	}
 };
 
-void ScPageOutput::drawItem_Polygon ( PageItem_Polygon* item , ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_Polygon(PageItem_Polygon* item , ScPainterExBase* painter, QRect clip)
 {
 	painter->setupPolygon(&item->PoLine);
 	fillPath(item, painter, clip);
 }
 
-void ScPageOutput::drawItem_PolyLine( PageItem_PolyLine* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_PolyLine(PageItem_PolyLine* item, ScPainterExBase* painter, QRect clip)
 {
 	if (item->PoLine.size() < 4)
 		return;
@@ -1281,13 +1281,13 @@
 	}
 }
 
-void ScPageOutput::drawItem_RegularPolygon( PageItem_RegularPolygon* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_RegularPolygon(PageItem_RegularPolygon* item, ScPainterExBase* painter, QRect clip)
 {
 	painter->setupPolygon(&item->PoLine);
 	painter->fillPath();
 }
 
-void ScPageOutput::drawItem_Spiral( PageItem_Spiral* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_Spiral(PageItem_Spiral* item, ScPainterExBase* painter, QRect clip)
 {
 	if (item->PoLine.size() < 4)
 		return;
@@ -1448,7 +1448,7 @@
 	}
 }
 
-void ScPageOutput::drawItem_Table( PageItem_Table* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::drawItem_Table(PageItem_Table* item, ScPainterExBase* painter, QRect clip)
 {
 	painter->save();
 
@@ -1463,7 +1463,7 @@
 	painter->restore();
 }
 
-void ScPageOutput::drawItem_Text( PageItem* item, ScPainterExBase* painter, QRect cullingArea )
+void ScPageOutput::drawItem_Text(PageItem* item, ScPainterExBase* painter, QRect cullingArea)
 {
 	if (item->pathTextShowFrame())
 	{
@@ -1567,7 +1567,7 @@
 	}
 }
 
-void ScPageOutput::drawMarks( ScPage* page, ScPainterExBase* painter, const MarksOptions& options )
+void ScPageOutput::drawMarks(ScPage* page, ScPainterExBase* painter, const MarksOptions& options)
 {
 	double markLength = options.markLength;
 	double markOffs   = options.markOffset;
@@ -1600,20 +1600,20 @@
 	QRectF  bleedBox(bleedTopLeft, bleedBottomRight);
 	painter->save();
 	painter->setLineWidth(0.5);
-	painter->setPen(ScColorShade(Qt::black, 100), 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin );
+	painter->setPen(ScColorShade(Qt::black, 100), 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 	if (options.cropMarks)
 	{
 		FPoint start, end;
 		double left = offsetX, right = offsetX + width;
 		double bottom = offsetY + height, top = offsetY;
-		drawBoxMarks( painter, QRectF(QPointF(left, top), QPointF(right, bottom)), bleedBox, markOffs, markLength);
+		drawBoxMarks(painter, QRectF(QPointF(left, top), QPointF(right, bottom)), bleedBox, markOffs, markLength);
 	}
 	if (options.bleedMarks)
 	{
 		FPoint start, end;
 		double left = offsetX - bleedLeft, right = offsetX + width + bleedRight;
 		double bottom = offsetY + height + bleedBottom, top = offsetY - bleedTop;;
-		drawBoxMarks( painter, QRectF(QPointF(left, top), QPointF(right, bottom)), bleedBox, markOffs, markLength);
+		drawBoxMarks(painter, QRectF(QPointF(left, top), QPointF(right, bottom)), bleedBox, markOffs, markLength);
 	}
 	if (options.registrationMarks)
 	{
@@ -1621,26 +1621,26 @@
 		double posY = (offsetY + height + bleedBottom + markOffs + 3.0);
 		painter->save();
 		painter->translate(posX, posY);
-		drawRegistrationCross( painter );
+		drawRegistrationCross(painter);
 		painter->restore();
 		posX = (2 * offsetX + width) / 2.0 - 7.0;
 		posY = (offsetY - bleedTop - markOffs - 17);
 		painter->save();
 		painter->translate(posX, posY);
-		drawRegistrationCross( painter );
+		drawRegistrationCross(painter);
 		painter->restore();
 
 		posX = (offsetX - bleedLeft - markOffs - 17);
 		posY = (2 * offsetY + height) / 2.0 - 7.0;
 		painter->save();
 		painter->translate(posX, posY);
-		drawRegistrationCross( painter );
+		drawRegistrationCross(painter);
 		painter->restore();
 		posX = (offsetX + width + bleedRight + markOffs + 3.0);
 		posY = (2 * offsetY + height) / 2.0 - 7.0;
 		painter->save();
 		painter->translate(posX, posY);
-		drawRegistrationCross( painter );
+		drawRegistrationCross(painter);
 		painter->restore();
 	}
 	if (options.colorMarks)
@@ -1648,54 +1648,54 @@
 		int shade = 100;
 		double startX = offsetX + 6.0;
 		double startY = offsetY - bleedTop - markOffs - 16.0;
-		ScColorShade strokecolor( ScColor(0, 0, 0, 255), 100 );
-		painter->setPen( strokecolor, 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin );
-		painter->setFillMode( ScPainterExBase::Solid );
-		for (int i = 0; i < 11; i++ )
-		{
-			ScColorShade fillcolor( ScColor(0, 0, 0, 255), shade );
-			painter->setBrush( fillcolor );
-			painter->drawRect( startX + i * 14, startY, 14, 14 );
+		ScColorShade strokecolor(ScColor(0, 0, 0, 255), 100);
+		painter->setPen(strokecolor, 0.5, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+		painter->setFillMode(ScPainterExBase::Solid);
+		for (int i = 0; i < 11; i++)
+		{
+			ScColorShade fillcolor(ScColor(0, 0, 0, 255), shade);
+			painter->setBrush(fillcolor);
+			painter->drawRect(startX + i * 14, startY, 14, 14);
 			shade -= 10;
 		}
 		startX = offsetX + width - 20.0;
-		painter->setBrush( ScColorShade(ScColor(0, 0, 0, 255), 50) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 0, 0, 255), 50));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(0, 0, 255, 0), 50) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 0, 255, 0), 50));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(0, 255, 0, 0), 50) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 255, 0, 0), 50));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(255, 0, 0, 0), 50) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(255, 0, 0, 0), 50));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(255, 255, 0, 0), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(255, 255, 0, 0), 100));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(255, 0, 255, 0), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(255, 0, 255, 0), 100));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(0, 255, 255, 0), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 255, 255, 0), 100));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(0, 0, 0, 255), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 0, 0, 255), 100));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(0, 0, 255, 0), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 0, 255, 0), 100));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(0, 255, 0, 0), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(0, 255, 0, 0), 100));
+		painter->drawRect(startX, startY, 14, 14);
 		startX -= 14;
-		painter->setBrush( ScColorShade(ScColor(255, 0, 0, 0), 100) );
-		painter->drawRect( startX, startY, 14, 14 );
+		painter->setBrush(ScColorShade(ScColor(255, 0, 0, 0), 100));
+		painter->drawRect(startX, startY, 14, 14);
 	}
 	painter->restore();
 }
 
-void ScPageOutput::drawBoxMarks( ScPainterExBase* painter, const QRectF& box, const QRectF& bleedBox, double offset , double markSize)
+void ScPageOutput::drawBoxMarks(ScPainterExBase* painter, const QRectF& box, const QRectF& bleedBox, double offset , double markSize)
 {
 	FPoint start, end;
 	double left   = box.left(), right = box.right();
@@ -1703,36 +1703,36 @@
 	double bleedLeft = bleedBox.left(), bleedRight = bleedBox.right();
 	double bleedBottom = bleedBox.bottom(), bleedTop = bleedBox.top();
 	// Top Left
-	start.setXY( bleedLeft - offset, top );
-	end.setXY  ( bleedLeft - offset - markSize, top );
+	start.setXY(bleedLeft - offset, top);
+	end.setXY  (bleedLeft - offset - markSize, top);
 	painter->drawLine(start, end);
-	start.setXY( left, bleedTop - offset );
-	end.setXY  ( left, bleedTop - offset - markSize);
+	start.setXY(left, bleedTop - offset);
+	end.setXY  (left, bleedTop - offset - markSize);
 	painter->drawLine(start, end);
 	// Top Right
-	start.setXY( bleedRight + offset, top );
-	end.setXY  ( bleedRight + offset + markSize, top );
+	start.setXY(bleedRight + offset, top);
+	end.setXY  (bleedRight + offset + markSize, top);
 	painter->drawLine(start, end);
-	start.setXY( right, bleedTop - offset );
-	end.setXY  ( right, bleedTop - offset - markSize);
+	start.setXY(right, bleedTop - offset);
+	end.setXY  (right, bleedTop - offset - markSize);
 	painter->drawLine(start, end);
 	// Bottom Left
-	start.setXY( bleedLeft - offset, bottom );
-	end.setXY  ( bleedLeft - offset - markSize, bottom  );
+	start.setXY(bleedLeft - offset, bottom);
+	end.setXY  (bleedLeft - offset - markSize, bottom);
 	painter->drawLine(start, end);
-	start.setXY( left, bleedBottom + offset );
-	end.setXY  ( left, bleedBottom + offset + markSize);
+	start.setXY(left, bleedBottom + offset);
+	end.setXY  (left, bleedBottom + offset + markSize);
 	painter->drawLine(start, end);
 	// Bottom Right
-	start.setXY( bleedRight + offset, bottom );
-	end.setXY  ( bleedRight + offset + markSize, bottom  );
+	start.setXY(bleedRight + offset, bottom);
+	end.setXY  (bleedRight + offset + markSize, bottom);
 	painter->drawLine(start, end);
-	start.setXY( right, bleedBottom + offset );
-	end.setXY  ( right, bleedBottom + offset + markSize);
+	start.setXY(right, bleedBottom + offset);
+	end.setXY  (right, bleedBottom + offset + markSize);
 	painter->drawLine(start, end);
 }
 
-void ScPageOutput::drawRegistrationCross( ScPainterExBase* painter )
+void ScPageOutput::drawRegistrationCross(ScPainterExBase* painter)
 {
 	painter->save();
 
@@ -1748,32 +1748,32 @@
 
 	painter->newPath();
 	painter->moveTo(13.0, 7.0);
-	painter->curveTo( FPoint(13.0, 10.31383), FPoint(10.31383, 13.0), FPoint(7.0, 13.0) );
-	painter->curveTo( FPoint(3.68629, 13.0) , FPoint(1.0, 10.31383) , FPoint(1.0, 7.0) );
-	painter->curveTo( FPoint(1.0, 3.68629)  , FPoint(3.68629, 1.0) , FPoint(7.0, 1.0) );
-	painter->curveTo( FPoint(10.31383, 1.0) , FPoint(13.0, 3.68629) , FPoint(13.0, 7.0) );
+	painter->curveTo(FPoint(13.0, 10.31383), FPoint(10.31383, 13.0), FPoint(7.0, 13.0));
+	painter->curveTo(FPoint(3.68629, 13.0) , FPoint(1.0, 10.31383) , FPoint(1.0, 7.0));
+	painter->curveTo(FPoint(1.0, 3.68629)  , FPoint(3.68629, 1.0) , FPoint(7.0, 1.0));
+	painter->curveTo(FPoint(10.31383, 1.0) , FPoint(13.0, 3.68629) , FPoint(13.0, 7.0));
 	painter->strokePath();
 
 	painter->newPath();
 	painter->moveTo(10.5, 7.0);
-	painter->curveTo( FPoint(10.5, 8.93307), FPoint(8.93307, 10.5), FPoint(7.0, 10.5) );
-	painter->curveTo( FPoint(5.067, 10.5)  , FPoint(3.5, 8.93307) , FPoint(3.5, 7.0) );
-	painter->curveTo( FPoint(3.5, 5.067)   , FPoint(5.067, 3.5)   , FPoint(7.0, 3.5) );
-	painter->curveTo( FPoint(8.93307, 3.5) , FPoint(10.5, 5.067)  , FPoint(10.5, 7.0) );
+	painter->curveTo(FPoint(10.5, 8.93307), FPoint(8.93307, 10.5), FPoint(7.0, 10.5));
+	painter->curveTo(FPoint(5.067, 10.5)  , FPoint(3.5, 8.93307) , FPoint(3.5, 7.0));
+	painter->curveTo(FPoint(3.5, 5.067)   , FPoint(5.067, 3.5)   , FPoint(7.0, 3.5));
+	painter->curveTo(FPoint(8.93307, 3.5) , FPoint(10.5, 5.067)  , FPoint(10.5, 7.0));
 	painter->strokePath();
 
 	painter->restore();
 }
 
-void ScPageOutput::fillPath( PageItem* item, ScPainterExBase* painter, QRect clip )
-{
-	if( painter->fillMode() == ScPainterExBase::Pattern && !painter->hasCapability(ScPainterExBase::patterns) )
-		drawPattern( item, painter, clip );
+void ScPageOutput::fillPath(PageItem* item, ScPainterExBase* painter, QRect clip)
+{
+	if (painter->fillMode() == ScPainterExBase::Pattern && !painter->hasCapability(ScPainterExBase::patterns))
+		drawPattern(item, painter, clip);
 	else
 		painter->fillPath();
 }
 
-void ScPageOutput::strokePath( PageItem* item, ScPainterExBase* painter, QRect clip )
+void ScPageOutput::strokePath(PageItem* item, ScPainterExBase* painter, QRect clip)
 {
 	painter->strokePath();
 }

Modified: trunk/Scribus/scribus/scpainterex_cairo.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=24112&path=/trunk/Scribus/scribus/scpainterex_cairo.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainterex_cairo.cpp	(original)
+++ trunk/Scribus/scribus/scpainterex_cairo.cpp	Mon Oct 26 21:20:50 2020
@@ -7,10 +7,11 @@
 
 #include "scpainterex_cairo.h"
 #include "sccolorengine.h"
+#include "scimage.h"
 #include "util.h"
 #include "util_math.h"
 
-ScPainterEx_Cairo::ScPainterEx_Cairo( cairo_t* context, QRect& rect,  ScribusDoc* doc, bool gray ) : ScPainterExBase()
+ScPainterEx_Cairo::ScPainterEx_Cairo(cairo_t* context, QRect& rect,  ScribusDoc* doc, bool gray) : ScPainterExBase()
 {
 	m_doc    = doc;
 	m_width  = rect.width();
@@ -18,8 +19,8 @@
 	m_blendModeLayer = 0;
 	m_blendModeFill = 0;
 	m_blendModeStroke = 0;
-	m_strokeColor = ScColorShade( QColor(0,0,0), 100 );
-	m_fillColor = ScColorShade( QColor(0,0,0), 100 );
+	m_strokeColor = ScColorShade(QColor(0,0,0), 100);
+	m_fillColor = ScColorShade(QColor(0,0,0), 100);
 	m_fillTrans = 1.0;
 	m_strokeTrans = 1.0;
 	m_fillRule  = true;
@@ -43,17 +44,17 @@
 
 }
 
-QColor ScPainterEx_Cairo::transformColor( ScColorShade& colorShade, double trans )
+QColor ScPainterEx_Cairo::transformColor(ScColorShade& colorShade, double trans)
 {
 	QColor c, color;
 	c = ScColorEngine::getShadeColor(colorShade.color, m_doc, colorShade.shade);
-	color = qRgba( qRed(c.rgb()), qGreen(c.rgb()), qBlue(c.rgb()), qAlpha(trans * 255));
-	if ( m_convertToGray )
+	color = qRgba(qRed(c.rgb()), qGreen(c.rgb()), qBlue(c.rgb()), qAlpha(trans * 255));
+	if (m_convertToGray)
 	{
 		int grayLevel;
 		QColor grayColor;
 		grayLevel = 0.3 * color.red() + 0.59 * color.green() + 0.11 * color.blue();
-		grayColor = qRgba( grayLevel, grayLevel, grayLevel, qAlpha(color.rgb()));
+		grayColor = qRgba(grayLevel, grayLevel, grayLevel, qAlpha(color.rgb()));
 		color = grayColor;
 	}
 	return color;
@@ -66,10 +67,10 @@
 	int imageHeight = image.height();
 	QRgb *pscan;
 
-	for ( int j = 0; j < imageHeight; j++ )
+	for (int j = 0; j < imageHeight; j++)
 	{
 		pscan = (QRgb *) image.scanLine(j);
-		for (int i = 0; i < imageWidth; i++ )
+		for (int i = 0; i < imageWidth; i++)
 		{
 			rgb = pscan[i];
 			grey = 0.3 * qRed(rgb) + 0.59 * qGreen(rgb) + 0.11 * qBlue(rgb);
@@ -88,15 +89,15 @@
 
 void ScPainterEx_Cairo::clear()
 {
-	/*SolidBrush brush( Color(255,255,255) );
+	/*SolidBrush brush(Color(255,255,255));
 	m_graphics->FillRectangle(&brush, 0, 0, m_width, m_height);*/
 }
 
-void ScPainterEx_Cairo::clear( ScColorShade &c )
-{
-	/*QColor color = transformColor( c, 1.0 );
+void ScPainterEx_Cairo::clear(ScColorShade &c)
+{
+	/*QColor color = transformColor(c, 1.0);
 	QRgb cs = color.rgb();
-	SolidBrush brush( Color(qAlpha(cs), qRed(cs), qGreen(cs),qBlue(cs)) );
+	SolidBrush brush(Color(qAlpha(cs), qRed(cs), qGreen(cs),qBlue(cs)));
 	m_graphics->FillRectangle(&brush, 0, 0, m_width, m_height);*/
 }
 
@@ -108,69 +109,69 @@
 	return mat;
 }
 
-void ScPainterEx_Cairo::setWorldMatrix( const QTransform &mat )
+void ScPainterEx_Cairo::setWorldMatrix(const QTransform &mat)
 {
 	cairo_matrix_t matrix;
 	cairo_matrix_init(&matrix, mat.m11(), mat.m12(), mat.m21(), mat.m22(), mat.dx(), mat.dy());
 	cairo_set_matrix(m_cr, &matrix);
 }
 
-void ScPainterEx_Cairo::translate( double x, double y )
+void ScPainterEx_Cairo::translate(double x, double y)
 {
 	cairo_translate(m_cr, x, y);
 }
 
-void ScPainterEx_Cairo::translate( const QPointF& offset )
+void ScPainterEx_Cairo::translate(const QPointF& offset)
 {
 	cairo_translate(m_cr, offset.x(), offset.y());
 }
 
-void ScPainterEx_Cairo::rotate( double r )
+void ScPainterEx_Cairo::rotate(double r)
 {
 	cairo_rotate(m_cr, r * 3.1415927 / 180.0);
 }
 
-void ScPainterEx_Cairo::scale( double x, double y )
+void ScPainterEx_Cairo::scale(double x, double y)
 {
 	cairo_scale(m_cr, x, y);
 }
 
-void ScPainterEx_Cairo::moveTo( const double &x, const double &y )
+void ScPainterEx_Cairo::moveTo(const double &x, const double &y)
 {
 	cairo_move_to(m_cr, x, y);
 }
 
-void ScPainterEx_Cairo::lineTo( const double &x, const double &y )
+void ScPainterEx_Cairo::lineTo(const double &x, const double &y)
 {
 	cairo_line_to(m_cr, x, y);
 }
 
-void ScPainterEx_Cairo::curveTo( FPoint p1, FPoint p2, FPoint p3 )
-{
-	cairo_curve_to(m_cr, p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y() );
+void ScPainterEx_Cairo::curveTo(FPoint p1, FPoint p2, FPoint p3)
+{
+	cairo_curve_to(m_cr, p1.x(), p1.y(), p2.x(), p2.y(), p3.x(), p3.y());
 }
 
 void ScPainterEx_Cairo::newPath()
 {
-	cairo_new_path( m_cr );
+	cairo_new_path(m_cr);
 }
 
 void ScPainterEx_Cairo::closePath()
 {
-	cairo_close_path( m_cr);
-}
-
-void ScPainterEx_Cairo::setFillRule( bool fillRule )
+	cairo_close_path(m_cr);
+}
+
+void ScPainterEx_Cairo::setFillRule(bool fillRule)
 {
 	m_fillRule = fillRule;
 }
 
-void ScPainterEx_Cairo::setFillMode( int fill )
+void ScPainterEx_Cairo::setFillMode(int fill)
 {
 	m_fillMode = fill;
 }
 
-void ScPainterEx_Cairo::setStrokeMode( int stroke )
+void ScPainterEx_Cairo::setStrokeMode(int stroke)
 {
 	m_strokeMode = stroke;
 }
@@ -331,12 +332,12 @@
 	return m_fillColor;
 }
 
-void ScPainterEx_Cairo::setPen( const ScColorShade &c )
+void ScPainterEx_Cairo::setPen(const ScColorShade &c)
 {
 	m_strokeColor = c;
 }
 
-void ScPainterEx_Cairo::setPen( const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo )
+void ScPainterEx_Cairo::setPen(const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo)
 {
 	m_strokeColor = c;
 	m_lineWidth   = w;
@@ -347,12 +348,12 @@
 	getDashArray(st, w, m_array);
 }
 
-void ScPainterEx_Cairo::setLineWidth( double w )
+void ScPainterEx_Cairo::setLineWidth(double w)
 {
 	m_lineWidth = w;
 }
 
-void ScPainterEx_Cairo::setPenOpacity( double op )
+void ScPainterEx_Cairo::setPenOpacity(double op)
 {
 	m_strokeTrans = op;
 }
@@ -363,23 +364,23 @@
 	m_offset = ofs;
 }
 
-void ScPainterEx_Cairo::setBrush( const ScColorShade &c )
+void ScPainterEx_Cairo::setBrush(const ScColorShade &c)
 {
 	m_fillColor = c;
 }
 
-void ScPainterEx_Cairo::setBrushOpacity( double op )
+void ScPainterEx_Cairo::setBrushOpacity(double op)
 {
 	m_fillTrans = op;
 }
 
-void ScPainterEx_Cairo::setOpacity( double op )
+void ScPainterEx_Cairo::setOpacity(double op)
 {
 	m_fillTrans = op;
 	m_strokeTrans = op;
 }
 
-void ScPainterEx_Cairo::setFont( const QFont &f)
+void ScPainterEx_Cairo::setFont(const QFont &f)
 {
 	m_font = f;
 }
@@ -396,7 +397,7 @@
 
 void ScPainterEx_Cairo::restore()
 {
-	cairo_restore( m_cr );
+	cairo_restore(m_cr);
 }
 
 void ScPainterEx_Cairo::setRasterOp(int blendMode)
@@ -437,19 +438,19 @@
 		cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
 }
 
-void ScPainterEx_Cairo::setBlendModeFill( int blendMode )
+void ScPainterEx_Cairo::setBlendModeFill(int blendMode)
 {
 	m_blendModeFill = blendMode;
 }
 
-void ScPainterEx_Cairo::setBlendModeStroke( int blendMode )
+void ScPainterEx_Cairo::setBlendModeStroke(int blendMode)
 {
 	m_blendModeStroke = blendMode;
 }
 
 void ScPainterEx_Cairo::fillPathHelper()
 {
-	cairo_save( m_cr );
+	cairo_save(m_cr);
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
 	if (m_fillRule)
 		cairo_set_fill_rule (m_cr, CAIRO_FILL_RULE_EVEN_ODD);
@@ -463,7 +464,7 @@
 		if (m_maskMode > 0)
 		{
 			/*cairo_pattern_t *pat = getMaskPattern();
-			cairo_set_source_rgb( m_cr, r, g, b );
+			cairo_set_source_rgb(m_cr, r, g, b);
 			setRasterOp(m_blendModeFill);
 			cairo_clip_preserve(m_cr);
 			cairo_mask(m_cr, pat);
@@ -480,25 +481,25 @@
 	}
 	else if (m_fillMode == ScPainterExBase::Gradient)
 	{
-		drawGradient( m_fillGradient );
+		drawGradient(m_fillGradient);
 	}
 	else if (m_fillMode == ScPainterExBase::Pattern)
 	{
 
 	}
-	cairo_restore( m_cr );
+	cairo_restore(m_cr);
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
 }
 
 void ScPainterEx_Cairo::strokePathHelper()
 {
-	cairo_save( m_cr );
+	cairo_save(m_cr);
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
-	cairo_set_line_width( m_cr, m_lineWidth );
+	cairo_set_line_width(m_cr, m_lineWidth);
 	if (m_array.count() > 0)
-		cairo_set_dash( m_cr, m_array.data(), m_array.count(), m_offset);
+		cairo_set_dash(m_cr, m_array.data(), m_array.count(), m_offset);
 	else
-		cairo_set_dash( m_cr, nullptr, 0, 0 );
+		cairo_set_dash(m_cr, nullptr, 0, 0);
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
 	if (m_lineEnd == Qt::RoundCap)
 		cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_ROUND);
@@ -507,11 +508,11 @@
 	else if (m_lineEnd == Qt::FlatCap)
 		cairo_set_line_cap (m_cr, CAIRO_LINE_CAP_BUTT);
 	if (m_lineJoin == Qt::RoundJoin)
-		cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_ROUND );
+		cairo_set_line_join(m_cr, CAIRO_LINE_JOIN_ROUND);
 	else if (m_lineJoin == Qt::BevelJoin)
-		cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_BEVEL );
+		cairo_set_line_join(m_cr, CAIRO_LINE_JOIN_BEVEL);
 	else if (m_lineJoin == Qt::MiterJoin)
-		cairo_set_line_join( m_cr, CAIRO_LINE_JOIN_MITER );
+		cairo_set_line_join(m_cr, CAIRO_LINE_JOIN_MITER);
 	if (m_strokeMode == 3)
 	{
 
@@ -523,13 +524,13 @@
 	else
 	{
 		double r, g, b;
-		QColor strokeColor = transformColor( m_strokeColor, 1.0 );
+		QColor strokeColor = transformColor(m_strokeColor, 1.0);
 		strokeColor.getRgbF(&r, &g, &b);
-		cairo_set_source_rgba( m_cr, r, g, b, m_strokeTrans );
+		cairo_set_source_rgba(m_cr, r, g, b, m_strokeTrans);
 		setRasterOp(m_blendModeStroke);
-		cairo_stroke_preserve( m_cr );
-	}
-	cairo_restore( m_cr );
+		cairo_stroke_preserve(m_cr);
+	}
+	cairo_restore(m_cr);
 	cairo_set_operator(m_cr, CAIRO_OPERATOR_OVER);
 }
 
@@ -538,7 +539,7 @@
 	cairo_clip (m_cr);
 }
 
-void ScPainterEx_Cairo::drawImage( ScImage *image, ScPainterExBase::ImageMode mode )
+void ScPainterEx_Cairo::drawImage(ScImage *image, ScPainterExBase::ImageMode mode)
 {
 	QImage qImage(image->qImage());
 	if (m_convertToGray)
@@ -561,7 +562,7 @@
 		return;
 
 	newPath();
-	for (int poi=0; poi<points->size()-3; poi += 4)
+	for (int poi = 0; poi < points->size() - 3; poi += 4)
 	{
 		if (points->isMarker(poi))
 		{
@@ -572,8 +573,8 @@
 		{
 			np = points->point(poi);
 			if ((!first) && (closed) && (np4 == firstP))
-				cairo_close_path( m_cr );
-			moveTo( np.x(), np.y() );
+				cairo_close_path(m_cr);
+			moveTo(np.x(), np.y());
 			first = nPath = false;
 			firstP = np4 = np;
 		}
@@ -584,13 +585,13 @@
 		if (np4 == np3)
 			continue;
 		if ((np == np1) && (np2 == np3))
-			lineTo( np3.x(), np3.y() );
+			lineTo(np3.x(), np3.y());
 		else
 			curveTo(np1, np2, np3);
 		np4 = np3;
 	}
 	if (closed)
-		cairo_close_path( m_cr );
+		cairo_close_path(m_cr);
 }
 
 void ScPainterEx_Cairo::drawPolygon()
@@ -622,38 +623,38 @@
 void ScPainterEx_Cairo::drawRect(double x, double y, double w, double h)
 {
 	newPath();
-	moveTo( x, y );
-	lineTo( x+w, y );
-	lineTo( x+w, y+h );
-	lineTo( x, y+h );
-	lineTo( x, y );
-	cairo_close_path( m_cr );
+	moveTo(x, y);
+	lineTo(x + w, y);
+	lineTo(x + w, y + h);
+	lineTo(x, y + h);
+	lineTo(x, y);
+	cairo_close_path(m_cr);
 	fillPath();
 	strokePath();
 }
 
-void ScPainterEx_Cairo::drawGradient( VGradientEx& gradient )
+void ScPainterEx_Cairo::drawGradient(VGradientEx& gradient)
 {
 	QRect clipPathRect;
 	save();
 	setClipPath();
-	getClipPathDimensions( clipPathRect );
-	if ( gradient.type() == VGradientEx::linear )
-		drawLinearGradient( gradient, clipPathRect );
-	else if ( gradient.type() == VGradientEx::radial )
-		drawCircularGradient( gradient, clipPathRect );
-	else if ( gradient.type() == VGradientEx::fourcolor )
-		drawFourColorGradient( clipPathRect );
-	else if ( gradient.type() == VGradientEx::diamond )
-		drawDiamondGradient( gradient, clipPathRect );
-	else if ( gradient.type() == VGradientEx::mesh )
-		drawMeshGradient( clipPathRect );
-	else if ( gradient.type() == VGradientEx::freemesh )
-		drawFreeMeshGradient( clipPathRect );
+	getClipPathDimensions(clipPathRect);
+	if (gradient.type() == VGradientEx::linear)
+		drawLinearGradient(gradient, clipPathRect);
+	else if (gradient.type() == VGradientEx::radial)
+		drawCircularGradient(gradient, clipPathRect);
+	else if (gradient.type() == VGradientEx::fourcolor)
+		drawFourColorGradient(clipPathRect);
+	else if (gradient.type() == VGradientEx::diamond)
+		drawDiamondGradient(gradient, clipPathRect);
+	else if (gradient.type() == VGradientEx::mesh)
+		drawMeshGradient(clipPathRect);
+	else if (gradient.type() == VGradientEx::freemesh)
+		drawFreeMeshGradient(clipPathRect);
 	restore();
 }
 
-void ScPainterEx_Cairo::drawLinearGradient( VGradientEx& gradient, const QRect& rect )
+void ScPainterEx_Cairo::drawLinearGradient(VGradientEx& gradient, const QRect& rect)
 {
 	int index = 0;
 	double r, g, b;
@@ -661,7 +662,7 @@
 	VColorStopEx* stop = nullptr;
 	QColor color;
 
-	if ( gradient.stops() < 2 )
+	if (gradient.stops() < 2)
 		return;
 
 	double x1 = gradient.origin().x();
@@ -680,7 +681,7 @@
 		if ((lastStop == stop->rampPoint) && (!isFirst))
 			continue;
 		isFirst = false;
-		color = transformColor( ScColorShade(stop->color, stop->shade), 1.0 );
+		color = transformColor(ScColorShade(stop->color, stop->shade), 1.0);
 		color.getRgbF(&r, &g, &b);
 		cairo_pattern_add_color_stop_rgba (pat, stop->rampPoint, r, g, b, stop->opacity);
 		lastStop = stop->rampPoint;
@@ -703,7 +704,7 @@
 	cairo_pattern_destroy (pat);
 }
 
-void ScPainterEx_Cairo::drawCircularGradient( VGradientEx& gradient, const QRect& rect )
+void ScPainterEx_Cairo::drawCircularGradient(VGradientEx& gradient, const QRect& rect)
 {
 	int offset = 0;
 	double r, g, b;
@@ -717,7 +718,7 @@
 	double y2  = gradient.vector().y();
 	double fx  = gradient.focalPoint().x();
 	double fy  = gradient.focalPoint().y();
-	double rad = sqrt( pow(x2 - x1, 2) + pow(y2 - y1, 2) );
+	double rad = sqrt(pow(x2 - x1, 2) + pow(y2 - y1, 2));
 
 	cairo_pattern_t* pat = cairo_pattern_create_radial (fx, fy, 0, x1, y1, rad);
 	cairo_pattern_set_extend(pat, CAIRO_EXTEND_PAD);
@@ -731,7 +732,7 @@
 		if ((lastStop == stop->rampPoint) && (!isFirst))
 			continue;
 		isFirst = false;
-		color = transformColor( ScColorShade(stop->color, stop->shade), 1.0 );
+		color = transformColor(ScColorShade(stop->color, stop->shade), 1.0);
 		color.getRgbF(&r, &g, &b);
 		cairo_pattern_add_color_stop_rgba (pat, stop->rampPoint, r, g, b, stop->opacity);
 		lastStop = stop->rampPoint;
@@ -754,7 +755,7 @@
 	cairo_pattern_destroy (pat);
 }
 
-void ScPainterEx_Cairo::drawFourColorGradient( const QRect& rect )
+void ScPainterEx_Cairo::drawFourColorGradient(const QRect& rect)
 {
 	cairo_pattern_t *pat = nullptr;
 	cairo_surface_t *img = nullptr;
@@ -774,7 +775,7 @@
 	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 );
+	cairo_set_tolerance(cr, 0.5);
 	double r, g, b, a;
 	mpat = cairo_pattern_create_mesh();
 	cairo_mesh_pattern_begin_patch(mpat);
@@ -828,10 +829,10 @@
 
 	if (img) cairo_surface_destroy(img);
 	if (mpat) cairo_pattern_destroy(mpat);
-	if (cr) cairo_destroy( cr );
-}
-
-void ScPainterEx_Cairo::drawDiamondGradient( VGradientEx& gradient, const QRect& rect )
+	if (cr) cairo_destroy(cr);
+}
+
+void ScPainterEx_Cairo::drawDiamondGradient(VGradientEx& gradient, const QRect& rect)
 {
 	cairo_pattern_t *pat = nullptr;
 	cairo_surface_t *img = nullptr;
@@ -852,7 +853,7 @@
 	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 );
+	cairo_set_tolerance(cr, 0.5);
 	double r, g, b, a;
 	QList<VColorStopEx*> colorStops = gradient.colorStops();
 	QList<QColor> qStopColors;
@@ -861,7 +862,7 @@
 	for (int offset = 0 ; offset < colorStops.count() ; offset++)
 	{
 		stop = colorStops.at(offset);
-		qStopColor = transformColor( ScColorShade(stop->color, stop->shade), 1.0);
+		qStopColor = transformColor(ScColorShade(stop->color, stop->shade), 1.0);
 		int h, s, v, sneu, vneu;
 		int shad = stop->shade;
 		qStopColor.getHsv(&h, &s, &v);
@@ -1052,10 +1053,10 @@
 
 	if (img) cairo_surface_destroy(img);
 	if (mpat) cairo_pattern_destroy(mpat);
-	if (cr) cairo_destroy( cr );
-}
-
-void ScPainterEx_Cairo::drawMeshGradient( const QRect& rect )
+	if (cr) cairo_destroy(cr);
+}
+
+void ScPainterEx_Cairo::drawMeshGradient(const QRect& rect)
 {
 	cairo_pattern_t *pat = nullptr;
 	cairo_surface_t *img = nullptr;
@@ -1070,7 +1071,7 @@
 	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 );
+	cairo_set_tolerance(cr, 0.5);
 	double r, g, b, a;
 	mpat = cairo_pattern_create_mesh();
 	for (int grow = 0; grow < m_meshGradientArray.count()-1; grow++)
@@ -1130,10 +1131,10 @@
 
 	if (img) cairo_surface_destroy(img);
 	if (mpat) cairo_pattern_destroy(mpat);
-	if (cr) cairo_destroy( cr );
-}
-
-void ScPainterEx_Cairo::drawFreeMeshGradient( const QRect& rect )
+	if (cr) cairo_destroy(cr);
+}
+
+void ScPainterEx_Cairo::drawFreeMeshGradient(const QRect& rect)
 {
 	cairo_pattern_t *pat = nullptr;
 	cairo_surface_t *img = nullptr;
@@ -1148,7 +1149,7 @@
 	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 );
+	cairo_set_tolerance(cr, 0.5);
 	double r, g, b, a;
 	mpat = cairo_pattern_create_mesh();
 	for (int col = 0; col < m_meshGradientPatches.count(); col++)
@@ -1206,15 +1207,15 @@
 
 	if (img) cairo_surface_destroy(img);
 	if (mpat) cairo_pattern_destroy(mpat);
-	if (cr) cairo_destroy( cr );
+	if (cr) cairo_destroy(cr);
 }
 
 void ScPainterEx_Cairo::strokeGradient(VGradientEx& gradient)
 {
 	save();
-	if ( gradient.type() == VGradientEx::linear )
+	if (gradient.type() == VGradientEx::linear)
 		strokeLinearGradient(gradient);
-	else if ( gradient.type() == VGradientEx::radial )
+	else if (gradient.type() == VGradientEx::radial)
 		strokeCircularGradient(gradient);
 	restore();
 }
@@ -1247,7 +1248,7 @@
 		if ((lastStop == stop->rampPoint) && (!isFirst))
 			continue;
 		isFirst = false;
-		color = transformColor( ScColorShade(stop->color, stop->shade), 1.0 );
+		color = transformColor(ScColorShade(stop->color, stop->shade), 1.0);
 		color.getRgbF(&r, &g, &b);
 		cairo_pattern_add_color_stop_rgba (pat, stop->rampPoint, r, g, b, stop->opacity);
 		lastStop = stop->rampPoint;
@@ -1262,7 +1263,7 @@
 	cairo_matrix_invert(&matrix);
 	cairo_pattern_set_matrix (pat, &matrix);
 	cairo_set_source (m_cr, pat);
-	cairo_stroke_preserve( m_cr );
+	cairo_stroke_preserve(m_cr);
 	cairo_pattern_destroy (pat);
 
 	cairo_pop_group_to_source (m_cr);
@@ -1299,7 +1300,7 @@
 		if ((lastStop == stop->rampPoint) && (!isFirst))
 			continue;
 		isFirst = false;
-		color = transformColor( ScColorShade(stop->color, stop->shade), 1.0 );
+		color = transformColor(ScColorShade(stop->color, stop->shade), 1.0);
 		color.getRgbF(&r, &g, &b);
 		cairo_pattern_add_color_stop_rgba (pat, stop->rampPoint, r, g, b, stop->opacity);
 		lastStop = stop->rampPoint;
@@ -1318,7 +1319,7 @@
 	cairo_matrix_invert(&matrix);
 	cairo_pattern_set_matrix (pat, &matrix);
 	cairo_set_source (m_cr, pat);
-	cairo_stroke_preserve( m_cr );
+	cairo_stroke_preserve(m_cr);
 	cairo_pattern_destroy (pat);
 
 	cairo_pop_group_to_source (m_cr);
@@ -1327,12 +1328,12 @@
 	cairo_paint_with_alpha (m_cr, m_strokeTrans);
 }
 
-void ScPainterEx_Cairo::getClipPathDimensions( QRect& r )
+void ScPainterEx_Cairo::getClipPathDimensions(QRect& r)
 {
 	double left = 0.0, right = 0.0, bottom = 0.0, top = 0.0;
 	cairo_clip_extents(m_cr, &left, &bottom, &right, &top);
-	r.setLeft( left );
-	r.setRight( right );
-	r.setBottom( bottom );
-	r.setTop( top );
-}
+	r.setLeft(left);
+	r.setRight(right);
+	r.setBottom(bottom);
+	r.setTop(top);
+}




More information about the scribus-commit mailing list