]> git.mxchange.org Git - simgear.git/commitdiff
CanvasImage: Use normalized coordinates by default.
authorThomas Geymayer <tomgey@gmail.com>
Thu, 14 Feb 2013 16:32:19 +0000 (17:32 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Thu, 14 Feb 2013 16:32:19 +0000 (17:32 +0100)
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

index cf9f12f2e41029e5c31ebe1e177bb72b14004c4d..c41c489752605a615d535c6f8d71704db904ce7c 100644 (file)
@@ -319,17 +319,10 @@ namespace canvas
   {
     if( !_src_rect.width() || !_src_rect.height() )
     {
-      const SGRect<int>& 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);
     }
   }