r25004 by craig - Remove unnecessary resize(0) calls and code cleanup

scribus-commit scribus-commit at lists.scribus.net
Wed Mar 9 21:05:30 UTC 2022


Author: craig
Date: Wed Mar  9 21:05:30 2022
New Revision: 25004

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=25004
Log:
Remove unnecessary resize(0) calls and code cleanup

Modified:
    trunk/Scribus/scribus/fonts/scfontmetrics.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem_line.cpp
    trunk/Scribus/scribus/plugins/import/pdf/pdftextrecognition.cpp
    trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
    trunk/Scribus/scribus/pslib.cpp
    trunk/Scribus/scribus/scimagestructs.cpp
    trunk/Scribus/scribus/ui/autoformbuttongroup.cpp
    trunk/Scribus/scribus/ui/effectsdialog.cpp
    trunk/Scribus/scribus/ui/extimageprops.cpp

Modified: trunk/Scribus/scribus/fonts/scfontmetrics.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/fonts/scfontmetrics.cpp
==============================================================================
--- trunk/Scribus/scribus/fonts/scfontmetrics.cpp	(original)
+++ trunk/Scribus/scribus/fonts/scfontmetrics.cpp	Wed Mar  9 21:05:30 2022
@@ -174,10 +174,9 @@
 {
 	bool error = false;
 	//AV: not threadsave, but tracechar is only used in ReadMetrics() and fontSample()
-	static FPointArray pts; 
+	static FPointArray pts;
+	pts.resize(0);
 	FPointArray pts2;
-	pts.resize(0);
-	pts2.resize(0);
 	firstP = FPoint(0,0);
 	FirstM = true;
 	error = FT_Set_Char_Size( face, 0, chs*6400, 72, 72 );

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader.cpp	Wed Mar  9 21:05:30 2022
@@ -10,7 +10,6 @@
 
 ScImgDataLoader::ScImgDataLoader()
 {
-	initialize();
 }
 
 void ScImgDataLoader::initialize()
@@ -126,9 +125,9 @@
 		s >> signature;
 		offset += 4;
 		if (((signature >> 24)&0xff) != '8' ||
-		        ((signature >> 16)&0xff) != 'B' ||
-		        ((signature >> 8)&0xff) != 'I' ||
-		        ((signature )&0xff) != 'M' )
+				((signature >> 16)&0xff) != 'B' ||
+				((signature >> 8)&0xff) != 'I' ||
+				((signature )&0xff) != 'M' )
 			break;
 		s >> resID;
 		offset += 2;

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader.h	Wed Mar  9 21:05:30 2022
@@ -51,8 +51,8 @@
 	QImage          m_image;
 	ImageInfoRecord m_imageInfoRecord;
 	QByteArray      m_embeddedProfile;
-	int             m_profileComponents;
-	eColorFormat    m_pixelFormat;
+	int             m_profileComponents {0};
+	eColorFormat    m_pixelFormat {Format_Undefined};
 
 	typedef enum
 	{
@@ -60,7 +60,7 @@
 		warningMsg = 1,
 		errorMsg = 2
 	} MsgType;
-	MsgType m_msgType;
+	MsgType m_msgType {noMsg};
 	QString m_message;
 
 	void swapRGBA();

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp	Wed Mar  9 21:05:30 2022
@@ -375,7 +375,6 @@
 					colName = getPascalString(s);
 					s.device()->seek( duoCurveStart + (28 * static_cast<uint>(cda)) );
 					FPointArray tmcu;
-					tmcu.resize(0);
 					for (int cu = 0; cu < 13; cu++)
 					{
 						short val;
@@ -411,7 +410,6 @@
 				{
 					s.device()->seek( duoCurveStart + (28 * static_cast<uint>(cda)) );
 					FPointArray tmcu;
-					tmcu.resize(0);
 					for (int cu = 0; cu < 13; cu++)
 					{
 						short val;

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Wed Mar  9 21:05:30 2022
@@ -3031,7 +3031,6 @@
 void PageItem::meshToShape()
 {
 	FPointArray Coords;
-	Coords.resize(0);
 	Coords.svgInit();
 	int rows = meshGradientArray.count() - 1;
 	int cols = meshGradientArray[0].count() - 1;
@@ -8695,7 +8694,6 @@
 	if (m_rotation != 0)
 	{
 		FPointArray pb;
-		pb.resize(0);
 		pb.addPoint(FPoint(m_xPos, m_yPos));
 		pb.addPoint(FPoint(m_width,    0.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(m_width, m_height, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
@@ -8730,7 +8728,6 @@
 	if (oldRot != 0)
 	{
 		FPointArray pb;
-		pb.resize(0);
 		pb.addPoint(FPoint(oldXpos, oldYpos));
 		pb.addPoint(FPoint(oldWidth,    0.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
 		pb.addPoint(FPoint(oldWidth, oldHeight, oldXpos, oldYpos, oldRot, 1.0, 1.0));
@@ -8766,7 +8763,6 @@
 	if (m_rotation != 0)
 	{
 		FPointArray pb;
-		pb.resize(0);
 		pb.addPoint(FPoint(-extraSpace,					-extraSpace,				xPos(), yPos(), m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(visualWidth()-extraSpace,	-extraSpace,				xPos(), yPos(), m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(visualWidth()-extraSpace,	visualHeight()-extraSpace,	xPos(), yPos(), m_rotation, 1.0, 1.0));

Modified: trunk/Scribus/scribus/pageitem_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/pageitem_line.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_line.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_line.cpp	Wed Mar  9 21:05:30 2022
@@ -194,7 +194,6 @@
 	if (m_rotation != 0)
 	{
 		FPointArray pb;
-		pb.resize(0);
 		pb.addPoint(FPoint(0,       - m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(m_width, - m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(m_width, + m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
@@ -242,7 +241,6 @@
 	if (oldRot != 0)
 	{
 		FPointArray pb;
-		pb.resize(0);
 		pb.addPoint(FPoint(0,        - m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
 		pb.addPoint(FPoint(oldWidth, - m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
 		pb.addPoint(FPoint(oldWidth, + m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
@@ -291,7 +289,6 @@
 	if (m_rotation != 0)
 	{
 		FPointArray pb;
-		pb.resize(0);
 		pb.addPoint(FPoint(0.0,           -extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(visualWidth(), -extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));
 		pb.addPoint(FPoint(visualWidth(), +extraSpace, xPos(), yPos(), m_rotation, 1.0, 1.0));

Modified: trunk/Scribus/scribus/plugins/import/pdf/pdftextrecognition.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/plugins/import/pdf/pdftextrecognition.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/pdftextrecognition.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/pdf/pdftextrecognition.cpp	Wed Mar  9 21:05:30 2022
@@ -567,7 +567,6 @@
 	*	This code can be used to set PoLine instead of setting the FrameShape if setting the PoLine is the more correct way of doing things.
 	*	I have no idea of what the PoLine is at this time except for it changes when the shape is set and appears to be unit scales as opposed to percentage scaled
 	FPointArray boundingBoxShape;
-	boundingBoxShape.resize(0);
 	boundingBoxShape.svgInit();
 	//doubles to create a shape, it's 100% textframe width by 100% textframe height
 

Modified: trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/plugins/import/shape/importshape.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/shape/importshape.cpp	(original)
+++ trunk/Scribus/scribus/plugins/import/shape/importshape.cpp	Wed Mar  9 21:05:30 2022
@@ -424,7 +424,6 @@
 		LineEnd = Qt::FlatCap;
 		LineJoin = Qt::MiterJoin;
 		FPointArray PoLine;
-		PoLine.resize(0);
 		QDomElement pg = DOC.toElement();
 		QString STag = pg.tagName();
 		QString style = pg.attribute( "style", "" ).simplified();
@@ -661,7 +660,6 @@
 	{
 		double x1, y1, x2, y2;
 		FPointArray PoLine;
-		PoLine.resize(0);
 		QDomElement pg = DOC.toElement();
 		QString STag = pg.tagName();
 		if (STag == "svg:line")

Modified: trunk/Scribus/scribus/pslib.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/pslib.cpp
==============================================================================
--- trunk/Scribus/scribus/pslib.cpp	(original)
+++ trunk/Scribus/scribus/pslib.cpp	Wed Mar  9 21:05:30 2022
@@ -1665,7 +1665,6 @@
 			if (currItem->rotation() != 0)
 			{
 				FPointArray pb;
-				pb.resize(0);
 				pb.addPoint(FPoint(currItem->xPos() - lw, currItem->yPos() - lw));
 				pb.addPoint(FPoint(currItem->width() + lw * 2.0, -lw, currItem->xPos() - lw, currItem->yPos() - lw, currItem->rotation(), 1.0, 1.0));
 				pb.addPoint(FPoint(currItem->width() + lw * 2.0, currItem->height() + lw * 2.0, currItem->xPos() - lw, currItem->yPos() - lw, currItem->rotation(), 1.0, 1.0));

Modified: trunk/Scribus/scribus/scimagestructs.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/scimagestructs.cpp
==============================================================================
--- trunk/Scribus/scribus/scimagestructs.cpp	(original)
+++ trunk/Scribus/scribus/scimagestructs.cpp	Wed Mar  9 21:05:30 2022
@@ -45,7 +45,6 @@
 
 ExifValues::ExifValues()
 {
-	init();
 }
 
 void ExifValues::init()
@@ -70,7 +69,6 @@
 
 ImageInfoRecord::ImageInfoRecord()
 {
-	init();
 }
 
 void ImageInfoRecord::init()

Modified: trunk/Scribus/scribus/ui/autoformbuttongroup.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/ui/autoformbuttongroup.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/autoformbuttongroup.cpp	(original)
+++ trunk/Scribus/scribus/ui/autoformbuttongroup.cpp	Wed Mar  9 21:05:30 2022
@@ -732,7 +732,6 @@
 	int count = 0;
 	qreal* AutoShapes;
 	FPointArray Path;
-	Path.resize(0);
 	AutoShapes = getShapeData(nr, &count);
 	for (int i = 0; i < count - 3; i += 4)
 	{

Modified: trunk/Scribus/scribus/ui/effectsdialog.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/ui/effectsdialog.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/effectsdialog.cpp	(original)
+++ trunk/Scribus/scribus/ui/effectsdialog.cpp	Wed Mar  9 21:05:30 2022
@@ -1038,7 +1038,6 @@
 			int numVals;
 			double xval, yval;
 			FPointArray curve;
-			curve.resize(0);
 			fp >> numVals;
 			for (int i = 0; i < numVals; i++)
 			{
@@ -1103,7 +1102,6 @@
 			int numVals;
 			double xval, yval;
 			FPointArray curve;
-			curve.resize(0);
 			fp >> numVals;
 			for (int i = 0; i < numVals; i++)
 			{
@@ -1191,7 +1189,6 @@
 			int numVals;
 			double xval, yval;
 			FPointArray curve;
-			curve.resize(0);
 			fp >> numVals;
 			for (int i = 0; i < numVals; i++)
 			{
@@ -1343,7 +1340,6 @@
 			int numVals;
 			double xval, yval;
 			FPointArray curve;
-			curve.resize(0);
 			fp >> numVals;
 			for (int i = 0; i < numVals; i++)
 			{

Modified: trunk/Scribus/scribus/ui/extimageprops.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=25004&path=/trunk/Scribus/scribus/ui/extimageprops.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/extimageprops.cpp	(original)
+++ trunk/Scribus/scribus/ui/extimageprops.cpp	Wed Mar  9 21:05:30 2022
@@ -252,7 +252,6 @@
 			else
 				pixm.fill(Qt::white);
 			FPointArray Path;
-			Path.resize(0);
 			Path = info->PDSpathData[it.key()].copy();
 			FPoint min = getMinClipF(&Path);
 			Path.translate(-min.x(), -min.y());
@@ -341,7 +340,7 @@
 		else
 		{
 			m_item->imageClip.resize(0);
-			m_item->pixm.imgInfo.usedPath = "";
+			m_item->pixm.imgInfo.usedPath.clear();
 		}
 	}
 	m_item->update();
@@ -381,7 +380,7 @@
 			else
 			{
 				m_item->imageClip.resize(0);
-				m_item->pixm.imgInfo.usedPath = "";
+				m_item->pixm.imgInfo.usedPath.clear();
 			}
 		}
 		m_item->update();
@@ -484,7 +483,7 @@
 	if (doPreview)
 	{
 		m_item->imageClip.resize(0);
-		m_item->pixm.imgInfo.usedPath = "";
+		m_item->pixm.imgInfo.usedPath.clear();
 		m_item->update();
 	}
 	connect(pathList, SIGNAL( itemClicked(QListWidgetItem*) ), this, SLOT( selPath(QListWidgetItem*) ) );




More information about the scribus-commit mailing list