r22739 by jghali - #15457: Incorrect rendering of LaTeX Render Frames after toggling color management

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 21 12:24:39 UTC 2018


Author: jghali
Date: Sun Oct 21 12:24:39 2018
New Revision: 22739

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22739
Log:
#15457: Incorrect rendering of LaTeX Render Frames after toggling color management

Modified:
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/pageitem_latexframe.cpp
    trunk/Scribus/scribus/pageitem_latexframe.h

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22739&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h	(original)
+++ trunk/Scribus/scribus/pageitem.h	Sun Oct 21 12:24:39 2018
@@ -1191,7 +1191,7 @@
 	 * @brief Load an image into an image frame, moved from ScribusView
 	 * @return True if load succeeded
 	 */
-	bool loadImage(const QString& filename, const bool reload, const int gsResolution=-1, bool showMsg = false);
+	virtual bool loadImage(const QString& filename, const bool reload, const int gsResolution=-1, bool showMsg = false);
 
 
 	/**

Modified: trunk/Scribus/scribus/pageitem_latexframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22739&path=/trunk/Scribus/scribus/pageitem_latexframe.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_latexframe.cpp	(original)
+++ trunk/Scribus/scribus/pageitem_latexframe.cpp	Sun Oct 21 12:24:39 2018
@@ -156,6 +156,40 @@
 		//Just pass it to ImageFrame
 		PageItem_ImageFrame::DrawObj_Item(p, e);
 	}
+}
+
+bool PageItem_LatexFrame::loadImage(const QString & filename, const bool reload, const int gsResolution, bool showMsg)
+{
+	//Save state and restore afterwards
+	double xres, yres;
+	if (imageIsAvailable)
+	{
+		xres = pixm.imgInfo.xres;
+		yres = pixm.imgInfo.yres;
+	}
+	else
+	{
+		xres = yres = realDpi();
+	}
+	double scaleX = m_imageXScale * xres;
+	double scaleY = m_imageYScale * yres;
+	double offX = m_imageXOffset / xres;
+	double offY = m_imageYOffset / yres;
+
+	bool imageLoaded = PageItem_ImageFrame::loadImage(imageFile, true, realDpi(), showMsg);
+	if (PrefsManager::instance()->latexForceDpi())
+	{
+		pixm.imgInfo.xres = pixm.imgInfo.yres = realDpi();
+	}
+	m_lastDpi = realDpi();
+
+	//Restore parameters, account for dpi changes
+	m_imageXScale = scaleX / pixm.imgInfo.xres;
+	m_imageYScale = scaleY / pixm.imgInfo.yres;
+	m_imageXOffset = offX  * pixm.imgInfo.xres;
+	m_imageYOffset = offY  * pixm.imgInfo.yres;
+
+	return imageLoaded;
 }
 
 void PageItem_LatexFrame::updateImage(int exitCode, QProcess::ExitStatus exitStatus)
@@ -200,33 +234,8 @@
 	firstWarning = true;
 	m_imgValid = true;
 
-	//Save state and restore afterwards
-	double xres, yres;
-	if (imageIsAvailable)
-	{
-		xres = pixm.imgInfo.xres;
-		yres = pixm.imgInfo.yres;
-	}
-	else
-	{
-		xres = yres = realDpi();
-	}
-	double scaleX = m_imageXScale * xres;
-	double scaleY = m_imageYScale * yres;
-	double offX   = m_imageXOffset / xres;
-	double offY   = m_imageYOffset / yres;
-	PageItem_ImageFrame::loadImage(imageFile, true, realDpi());
-	if (PrefsManager::instance()->latexForceDpi()) 
-	{
-		pixm.imgInfo.xres = pixm.imgInfo.yres = realDpi();
-	}
-	m_lastDpi = realDpi();
-	
-	//Restore parameters, account for dpi changes
-	m_imageXScale = scaleX / pixm.imgInfo.xres;
-	m_imageYScale = scaleY / pixm.imgInfo.yres;
-	m_imageXOffset = offX  * pixm.imgInfo.xres;
-	m_imageYOffset = offY  * pixm.imgInfo.yres;
+	loadImage(imageFile, true, realDpi(), false);
+
 	//emit imageOffsetScale(LocalScX, LocalScY, LocalX, LocalY);
 	update();
 }

Modified: trunk/Scribus/scribus/pageitem_latexframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22739&path=/trunk/Scribus/scribus/pageitem_latexframe.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_latexframe.h	(original)
+++ trunk/Scribus/scribus/pageitem_latexframe.h	Sun Oct 21 12:24:39 2018
@@ -56,6 +56,12 @@
 		virtual void applicableActions(QStringList& actionList);
 		virtual QString infoDescription() const;
 		void layout();
+
+		/**
+		* @brief Load an image into an image frame, moved from ScribusView
+		* @return True if load succeeded
+		*/
+		bool loadImage(const QString& filename, const bool reload, const int gsResolution = -1, bool showMsg = false) override;
 		
 		/** @brief Perform undo/redo action */
 		void restore(UndoState *state, bool isUndo);
@@ -91,6 +97,7 @@
 		int error() const { return m_err; }
 
 		QMap<QString,QString> editorProperties;
+
 	protected:
 		virtual void DrawObj_Item(ScPainter *p, QRectF e);
 		double m_lastWidth, m_lastHeight, m_lastDpi;
@@ -113,14 +120,17 @@
 		bool m_imgValid;
 		bool m_usePreamble;
 		bool m_killed;
+
 	signals:
 		void formulaAutoUpdate(QString oldText, QString newText);
 		void latexFinished();
 		void stateChanged(QProcess::ProcessState state);
 		void applicationChanged();
+
 	protected slots:
 		void updateImage(int exitCode, QProcess::ExitStatus exitStatus);
 		void latexError(QProcess::ProcessError error);
+
 	public slots:
 		void killProcess();
 		void setDpi(int dpi);




More information about the scribus-commit mailing list