pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/worldobjs surface_background.cxx,1.7


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs surface_background.cxx,1.7,1.8
Date: 10 Apr 2003 18:28:32 -0000

Update of /var/lib/cvs/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv2681/worldobjs

Modified Files:
        surface_background.cxx 
Log Message:
removed some unused stuff

Index: surface_background.cxx
===================================================================
RCS file: /var/lib/cvs/Games/Pingus/src/worldobjs/surface_background.cxx,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- surface_background.cxx      19 Feb 2003 09:50:37 -0000      1.7
+++ surface_background.cxx      10 Apr 2003 18:28:30 -0000      1.8
@@ -42,75 +42,64 @@
   if (data->color.alpha > 1.0) 
     std::cout << "Background: Warning dim larger than 1.0 are no longer 
supported" << std::endl;
   
-  // Testing animatied backgrounds...
-  /*std::cout << "Res: " << data->desc.res_name << std::endl
-    << "file: " << data->desc.datafile << std::endl;*/
-
-  if (background_manipulation_enabled)
-    {
-      CL_Surface source_surface = PingusResource::load_surface(data->desc);
+  CL_Surface source_surface = PingusResource::load_surface(data->desc);
       
-      CL_Canvas* canvas;
+  CL_Canvas* canvas;
 
-      // Scaling Code
-      if (data->stretch_x && data->stretch_y)
+  // Scaling Code
+  if (data->stretch_x && data->stretch_y)
+    {
+      canvas = Blitter::scale_surface_to_canvas(source_surface, 
world->get_width(), world->get_height());
+    }
+  else if (data->stretch_x && !data->stretch_y)
+    {
+      if (data->keep_aspect)
         {
-          canvas = Blitter::scale_surface_to_canvas(source_surface, 
world->get_width(), world->get_height());
+          float aspect = 
source_surface.get_height()/float(source_surface.get_width());
+          canvas = Blitter::scale_surface_to_canvas(source_surface, 
+                                                    world->get_width(), 
+                                                    
int(world->get_width()*aspect));
         }
-      else if (data->stretch_x && !data->stretch_y)
+      else
         {
-          if (data->keep_aspect)
-            {
-              float aspect = 
source_surface.get_height()/float(source_surface.get_width());
-              canvas = Blitter::scale_surface_to_canvas(source_surface, 
-                                                        world->get_width(), 
-                                                        
int(world->get_width()*aspect));
-            }
-          else
-            {
-              canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
-            }
+          canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
         }
-      else if (!data->stretch_x && data->stretch_y)
+    }
+  else if (!data->stretch_x && data->stretch_y)
+    {
+      if (data->keep_aspect)
         {
-          if (data->keep_aspect)
-            {
-              float aspect = 
float(source_surface.get_width())/source_surface.get_height();
-              canvas = Blitter::scale_surface_to_canvas(source_surface,
-                                                        
int(world->get_height() * aspect),
-                                                        world->get_height());
-            }
-          else
-            {
-              canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
-            }
+          float aspect = 
float(source_surface.get_width())/source_surface.get_height();
+          canvas = Blitter::scale_surface_to_canvas(source_surface,
+                                                    int(world->get_height() * 
aspect),
+                                                    world->get_height());
         }
       else
         {
-          canvas = Blitter::create_canvas(source_surface);
+          canvas = Blitter::scale_surface_to_canvas(source_surface, 
source_surface.get_width(), world->get_height());
         }
-
-      /* FIXME: fill_rect doesn't work with RGB images
-        FIXME: seems to work fine with indexed images
-        FIXME: not tested with RGBA images
-        FIXME: the bug might be in create_canvas() and not in fill_rect()
-      */
-    
-      if (data->color.alpha != 0.0 && data->color != Color(0, 0, 0, 1.0f))
-       { // Workaround for a bug which caused all levels to have the
-         // wrong background color
-         canvas->fill_rect(0, 0, 
-                           canvas->get_width(), canvas->get_height(),
-                           data->color.red, data->color.green, 
data->color.blue, 
-                           data->color.alpha);
-       }
-      
-      bg_surface = CL_Surface(canvas, true);
     }
   else
     {
-      bg_surface = PingusResource::load_surface(data->desc);
+      canvas = Blitter::create_canvas(source_surface);
+    }
+
+  /* FIXME: fill_rect doesn't work with RGB images
+     FIXME: seems to work fine with indexed images
+     FIXME: not tested with RGBA images
+     FIXME: the bug might be in create_canvas() and not in fill_rect()
+  */
+    
+  if (data->color.alpha != 0.0 && data->color != Color(0, 0, 0, 1.0f))
+    { // Workaround for a bug which caused all levels to have the
+      // wrong background color
+      canvas->fill_rect(0, 0, 
+                        canvas->get_width(), canvas->get_height(),
+                        data->color.red, data->color.green, data->color.blue, 
+                        data->color.alpha);
     }
+      
+  bg_surface = CL_Surface(canvas, true);
 
   //bg_surface = CAImageManipulation::changeHSV(bg_surface, 150, 100, 0);
   counter.set_size(bg_surface.get_num_frames());





reply via email to

[Prev in Thread] Current Thread [Next in Thread]