[fondue-commits] [SCM] Fondue Font Editor branch, master, updated. c190fbb61058a8c2f7e7a2c650bf0528d75324be

Eugeniy Meshcheryakov eugen at debian.org
Mon Feb 11 10:41:41 UTC 2008


The following commit has been merged in the master branch:
commit 4e3ea3aa13c3366a3207ebbc0edb5121e6e97352
Author: Eugeniy Meshcheryakov <eugen at debian.org>
Date:   Sun Feb 10 23:01:31 2008 +0100

    cache boundingRect in GlyphItemBase

diff --git a/gui/glyphitem.cxx b/gui/glyphitem.cxx
index 8c7f15a..4094c1e 100644
--- a/gui/glyphitem.cxx
+++ b/gui/glyphitem.cxx
@@ -23,16 +23,16 @@ GlyphItemBase::GlyphItemBase(GlyphGraphics *gfx, QGraphicsItem *parent) :
 	QGraphicsItem(parent), m_gfx(gfx)
 {
 	Q_ASSERT(m_gfx);
-//	m_content = m_gfx->m_glyph->content();
+	calculateBoundingRect();
 }
 
 void GlyphItemBase::update()
 {
 	prepareGeometryChange();
-//	m_content = m_gfx->m_glyph->content();
+	calculateBoundingRect();
 }
 
-QRectF GlyphItemBase::boundingRect() const
+void GlyphItemBase::calculateBoundingRect()
 {
 	QPainterPath path;
 	bool hadContours = false;
@@ -49,9 +49,15 @@ QRectF GlyphItemBase::boundingRect() const
 		QRectF rect = path.boundingRect();
 		qreal top = rect.bottom(), left = rect.left();
 		QSizeF size = rect.size();
-		return QRectF(QPointF(left, -top), size);
+		m_boundingRect =  QRectF(QPointF(left, -top), size);
 	}
-	return QRectF();
+	else
+		m_boundingRect = QRectF();
+}
+
+QRectF GlyphItemBase::boundingRect() const
+{
+	return m_boundingRect;
 }
 
 void GlyphItemBase::paintOutline(QPainter *painter, bool paintOpen)
diff --git a/gui/glyphitem.h b/gui/glyphitem.h
index aa38ae5..3ecddbf 100644
--- a/gui/glyphitem.h
+++ b/gui/glyphitem.h
@@ -30,10 +30,10 @@ public:
 protected:
 	void paintOutline(QPainter *painter, bool paintOpen = true);
 	void paintFill(QPainter *painter);
+	void calculateBoundingRect();
 
 	GlyphGraphics *m_gfx;
-	// XXX does not work for now
-//	GlyphContentList m_content;
+	QRectF m_boundingRect;
 };
 
 class GlyphItemOutline : public GlyphItemBase {

-- 
Fondue Font Editor



More information about the fondue-commits mailing list