From a63ec83d5fe6a859b0dbfd636bcc66a0ca6f18f9 Mon Sep 17 00:00:00 2001 From: Thomas Geymayer Date: Thu, 14 Feb 2013 17:32:19 +0100 Subject: [PATCH] CanvasImage: Use normalized coordinates by default. Using absolute sizes by default lead to problems, as while creating the image the size of the later texture is not available. --- simgear/canvas/elements/CanvasImage.cxx | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/simgear/canvas/elements/CanvasImage.cxx b/simgear/canvas/elements/CanvasImage.cxx index cf9f12f2..c41c4897 100644 --- a/simgear/canvas/elements/CanvasImage.cxx +++ b/simgear/canvas/elements/CanvasImage.cxx @@ -319,17 +319,10 @@ namespace canvas { if( !_src_rect.width() || !_src_rect.height() ) { - const SGRect& tex_dim = getTextureDimensions(); - - _node_src_rect->setBoolValue("normalized", false); - _node_src_rect->setFloatValue("right", tex_dim.width()); - _node_src_rect->setFloatValue("bottom", tex_dim.height()); - } - - if( !_region.width() || !_region.height() ) - { - _node->setFloatValue("size[0]", _src_rect.width()); - _node->setFloatValue("size[1]", _src_rect.height()); + // Show whole image by default + _node_src_rect->setBoolValue("normalized", true); + _node_src_rect->setFloatValue("right", 1); + _node_src_rect->setFloatValue("bottom", 1); } } -- 2.39.5