From 21f59b816bfb72f1d524f41fce662982b45e8f1b Mon Sep 17 00:00:00 2001 From: Abdelrazak Younes Date: Fri, 6 Jun 2008 12:34:27 +0000 Subject: [PATCH] RenderGraphic::metrics(): return early. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25164 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/insets/RenderGraphic.cpp | 43 +++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/insets/RenderGraphic.cpp b/src/insets/RenderGraphic.cpp index 07185ccdfe..392ac1f122 100644 --- a/src/insets/RenderGraphic.cpp +++ b/src/insets/RenderGraphic.cpp @@ -135,34 +135,37 @@ void RenderGraphic::metrics(MetricsInfo & mi, Dimension & dim) const { bool image_ready = displayGraphic(params_) && readyToDisplay(loader_); - dim.asc = image_ready ? loader_.image()->height() : 50; - dim.des = 0; - if (image_ready) { dim.wid = loader_.image()->width() + 2 * Inset::TEXT_TO_INSET_OFFSET; - } else { - int font_width = 0; + dim.asc = loader_.image()->height(); + dim_ = dim; + return; + } - FontInfo msgFont(mi.base.font); - msgFont.setFamily(SANS_FAMILY); + dim.asc = image_ready ? loader_.image()->height() : 50; + dim.des = 0; - // FIXME UNICODE - docstring const justname = from_utf8(params_.filename.onlyFileName()); - if (!justname.empty()) { - msgFont.setSize(FONT_SIZE_FOOTNOTE); - font_width = theFontMetrics(msgFont).width(justname); - } + int font_width = 0; - docstring const msg = statusMessage(params_, loader_.status()); - if (!msg.empty()) { - msgFont.setSize(FONT_SIZE_TINY); - font_width = max(font_width, - theFontMetrics(msgFont).width(msg)); - } + FontInfo msgFont(mi.base.font); + msgFont.setFamily(SANS_FAMILY); + + // FIXME UNICODE + docstring const justname = from_utf8(params_.filename.onlyFileName()); + if (!justname.empty()) { + msgFont.setSize(FONT_SIZE_FOOTNOTE); + font_width = theFontMetrics(msgFont).width(justname); + } - dim.wid = max(50, font_width + 15); + docstring const msg = statusMessage(params_, loader_.status()); + if (!msg.empty()) { + msgFont.setSize(FONT_SIZE_TINY); + font_width = max(font_width, + theFontMetrics(msgFont).width(msg)); } + dim.wid = max(50, font_width + 15); + dim_ = dim; } -- 2.39.2