enigma-cvs
[Top][All Lists]
Advanced

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

[Enigma-cvs] enigma/src Makefile.am, 1.27, 1.28 enigma.cc, 1.30, 1.31 me


From: Johannes Fortmann <address@hidden>
Subject: [Enigma-cvs] enigma/src Makefile.am, 1.27, 1.28 enigma.cc, 1.30, 1.31 menus_internal.hh, 1.6, 1.7 video.cc, 1.13, 1.14
Date: Wed, 19 Nov 2003 16:22:39 +0000

Update of /cvsroot/enigma/enigma/src
In directory subversions:/tmp/cvs-serv14797/src

Modified Files:
        Makefile.am enigma.cc menus_internal.hh video.cc 
Log Message:
Endian fixes to PNG save code (please test on little-endian)
PNG saving moved to Surface::save_surface


Index: video.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/video.cc,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** video.cc    16 Nov 2003 19:30:49 -0000      1.13
--- video.cc    19 Nov 2003 16:22:37 -0000      1.14
***************
*** 124,130 ****
      SDL_WM_SetCaption(caption.c_str(), 0);
  
      Surface *icn = enigma::GetImage("enigma_wm_icon");
!     if( icn)
          SDL_WM_SetIcon(icn->get_surface(), NULL);
  
      int bpp = 16; //options::BitsPerPixel;
--- 124,132 ----
      SDL_WM_SetCaption(caption.c_str(), 0);
  
+ #ifndef MACOSX    // 16x16 icons look crappy if you zoom them up to 128x128 
:-)
      Surface *icn = enigma::GetImage("enigma_wm_icon");
!     if(icn)
          SDL_WM_SetIcon(icn->get_surface(), NULL);
+ #endif
  
      int bpp = 16; //options::BitsPerPixel;

Index: Makefile.am
===================================================================
RCS file: /cvsroot/enigma/enigma/src/Makefile.am,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Makefile.am 16 Nov 2003 18:13:04 -0000      1.27
--- Makefile.am 19 Nov 2003 16:22:37 -0000      1.28
***************
*** 104,107 ****
--- 104,108 ----
        cp -r /Library/Frameworks/SDL_image.framework 
$(bundle_name)/Contents/Frameworks/
        cp -r /Library/Frameworks/SDL_mixer.framework 
$(bundle_name)/Contents/Frameworks/
+       cp -r /Library/Frameworks/PNG.framework 
$(bundle_name)/Contents/Frameworks/
  
  # Special target to copy the binary to Enigma.app/Contents/MacOS.
***************
*** 112,114 ****
  # Special target to create a binary linked with Mac OS X frameworks
  enigma-fw-mosx: $(enigma_OBJECTS) $(enigma_DEPENDENCIES)
!       $(CXX) $(LDFLAGS) -o enigma-fw $(enigma_OBJECTS) $(enigma_DEPENDENCIES) 
-lsdlmain -lz -framework SDL -framework SDL_image -framework SDL_mixer 
-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon 
-framework QuickTime
--- 113,115 ----
  # Special target to create a binary linked with Mac OS X frameworks
  enigma-fw-mosx: $(enigma_OBJECTS) $(enigma_DEPENDENCIES)
!       $(CXX) $(LDFLAGS) -o enigma-fw $(enigma_OBJECTS) $(enigma_DEPENDENCIES) 
-lsdlmain -lz -framework SDL -framework SDL_image -framework SDL_mixer 
-framework IOKit -framework Cocoa -framework OpenGL -framework Carbon 
-framework QuickTime -framework PNG

Index: menus_internal.hh
===================================================================
RCS file: /cvsroot/enigma/enigma/src/menus_internal.hh,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** menus_internal.hh   16 Nov 2003 19:32:19 -0000      1.6
--- menus_internal.hh   19 Nov 2003 16:22:37 -0000      1.7
***************
*** 126,198 ****
      };
  
-     void savePNG(Surface *surface, const string& fname) {
-         int            h = surface->height();
-         int            w = surface->width();
-         unsigned char *rows[h];
- 
-         surface->lock();
-         for (int i = 0; i<h; ++i) {
-             rows[i] = (unsigned char *)surface->scanline_pointer(i);
-         }
- 
-         enigma::Log << "Caching auto-preview as '" << fname << '\'' << endl;
- 
-         string error;
-         FILE *fp    = fopen(fname.c_str(), "wb");
- 
-         if (fp) {
-             png_structp png_ptr = 
png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
-             if (!png_ptr) {
-                 error = "write struct not generated";
-             }
-             else {
-                 png_infop info_ptr = png_create_info_struct(png_ptr);
-                 if (!info_ptr) {
-                     error = "info struct not generated";
-                 }
-                 else {
-                     static const char *what = 0;
-                     if (setjmp(png_jmpbuf(png_ptr))) {
-                         error = strf("unknown error during '%s' while 
creating png", what);
-                     }
-                     else {
-                         what = "png_init_io";
-                         png_init_io(png_ptr, fp);
-                         what = "png_set_IHDR";
-                         png_set_IHDR(png_ptr,
-                                      info_ptr,
-                                      w, h,
-                                      8,
-                                      PNG_COLOR_TYPE_RGBA,
-                                      PNG_INTERLACE_NONE,
-                                      PNG_COMPRESSION_TYPE_BASE,
-                                      PNG_FILTER_TYPE_BASE);
- //                         what = "png_set_compression_level";
- //                         png_set_compression_level(png_ptr, 9); // nearly 
no effect
-                         what = "png_write_info";
-                         png_write_info(png_ptr, info_ptr);
- 
-                         png_write_image(png_ptr, rows);
- 
-                         what = "png_write_end";
-                         png_write_end(png_ptr, NULL);
-                     }
-                 }
-                 // next line frees resources - and it crashes enigma :-(
-                 // png_destroy_write_struct(&png_ptr, &info_ptr);
-             }
-             fclose(fp);
-         }
-         else {
-             error = "Couldn't create file";
-         }
- 
-         if (error.length() > 0) {
-             enigma::Log << strf("Error saving '%s': %s\n", fname.c_str(), 
error.c_str());
-         }
- 
-         surface->unlock();
-     }
- 
      string removeIllChars(const string& s) {
          string s2 = s;
--- 126,129 ----
***************
*** 263,267 ****
  
                          removeOldPreviews(rev_number, preview_version, 
cleanedName);
!                         savePNG(zoomed_surface, preview_name);
                      }
  
--- 194,200 ----
  
                          removeOldPreviews(rev_number, preview_version, 
cleanedName);
! 
!                                               enigma::Log << "Caching 
auto-preview as '" << preview_name << '\'' << endl;
!                         zoomed_surface->save_surface(preview_name);
                      }
  

Index: enigma.cc
===================================================================
RCS file: /cvsroot/enigma/enigma/src/enigma.cc,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** enigma.cc   16 Nov 2003 19:24:03 -0000      1.30
--- enigma.cc   19 Nov 2003 16:22:37 -0000      1.31
***************
*** 18,22 ****
   * $Id$
   */
! #include "config.h"             // for DEFAULT_DATA_PATH
  #include "enigma.hh"
  #include "px/px.hh"
--- 18,22 ----
   * $Id$
   */
! #include "config.h"  // for DEFAULT_DATA_PATH
  #include "enigma.hh"
  #include "px/px.hh"
***************
*** 415,440 ****
  /* -------------------- Searching for files -------------------- */
  
! namespace
! {
!     class DataPathList {
!     public:
          DataPathList(const string &pathspec=DEFAULT_DATA_PATH);
! 
          void set_path(const string &pathspec);
          const string &get_path() const;
! 
          bool find_file(const string &filename, string &dest) const;
! 
!       std::list <string> find_files (const string &folder,
!                                      const string &filename) const;
! 
!     private:
!       // Variables
!         string path;
          vector<string> datapaths;
      };
! 
      DataPathList datapaths;
! }
  
  DataPathList::DataPathList(const string &pathspec)
--- 415,443 ----
  /* -------------------- Searching for files -------------------- */
  
! //----------------------------------------------------------------------
! // Data path
! //----------------------------------------------------------------------
! namespace {
!       class DataPathList {
! public:
          DataPathList(const string &pathspec=DEFAULT_DATA_PATH);
!               
          void set_path(const string &pathspec);
          const string &get_path() const;
!               
          bool find_file(const string &filename, string &dest) const;
!               
! std::list <string> find_files (const string &folder,
!                                                          const string 
&filename) const;
!               
! private:
!                       // Variables
!                       string path;
          vector<string> datapaths;
      };
!       
      DataPathList datapaths;
! 
! 
  
  DataPathList::DataPathList(const string &pathspec)
***************
*** 500,503 ****
--- 503,509 ----
      return matches;
  }
+ 
+ }
+ 
  
  string enigma::GetDataPath()





reply via email to

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