r1260 - in trunk: . code/renderer

DONOTREPLY at icculus.org DONOTREPLY at icculus.org
Thu Feb 14 06:13:58 EST 2008


Author: ludwig
Date: 2008-02-14 06:13:51 -0500 (Thu, 14 Feb 2008)
New Revision: 1260

Modified:
   trunk/Makefile
   trunk/code/renderer/tr_image_jpg.c
Log:
remove code duplicated from libjpeg and make internal functions static


Modified: trunk/Makefile
===================================================================
--- trunk/Makefile	2008-02-14 11:13:42 UTC (rev 1259)
+++ trunk/Makefile	2008-02-14 11:13:51 UTC (rev 1260)
@@ -1132,6 +1132,7 @@
   $(B)/client/l_struct.o \
   \
   $(B)/client/jcapimin.o \
+  $(B)/client/jcapistd.o \
   $(B)/client/jchuff.o   \
   $(B)/client/jcinit.o \
   $(B)/client/jccoefct.o  \

Modified: trunk/code/renderer/tr_image_jpg.c
===================================================================
--- trunk/code/renderer/tr_image_jpg.c	2008-02-14 11:13:42 UTC (rev 1259)
+++ trunk/code/renderer/tr_image_jpg.c	2008-02-14 11:13:51 UTC (rev 1260)
@@ -230,7 +230,8 @@
  * before any data is actually written.
  */
 
-void init_destination (j_compress_ptr cinfo)
+static void
+init_destination (j_compress_ptr cinfo)
 {
   my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
 
@@ -262,104 +263,13 @@
  * write it out when emptying the buffer externally.
  */
 
-boolean empty_output_buffer (j_compress_ptr cinfo)
+static boolean
+empty_output_buffer (j_compress_ptr cinfo)
 {
   return TRUE;
 }
 
-
 /*
- * Compression initialization.
- * Before calling this, all parameters and a data destination must be set up.
- *
- * We require a write_all_tables parameter as a failsafe check when writing
- * multiple datastreams from the same compression object.  Since prior runs
- * will have left all the tables marked sent_table=TRUE, a subsequent run
- * would emit an abbreviated stream (no tables) by default.  This may be what
- * is wanted, but for safety's sake it should not be the default behavior:
- * programmers should have to make a deliberate choice to emit abbreviated
- * images.  Therefore the documentation and examples should encourage people
- * to pass write_all_tables=TRUE; then it will take active thought to do the
- * wrong thing.
- */
-
-GLOBAL void
-jpeg_start_compress (j_compress_ptr cinfo, boolean write_all_tables)
-{
-  if (cinfo->global_state != CSTATE_START)
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-
-  if (write_all_tables)
-    jpeg_suppress_tables(cinfo, FALSE);	/* mark all tables to be written */
-
-  /* (Re)initialize error mgr and destination modules */
-  (*cinfo->err->reset_error_mgr) ((j_common_ptr) cinfo);
-  (*cinfo->dest->init_destination) (cinfo);
-  /* Perform master selection of active modules */
-  jinit_compress_master(cinfo);
-  /* Set up for the first pass */
-  (*cinfo->master->prepare_for_pass) (cinfo);
-  /* Ready for application to drive first pass through jpeg_write_scanlines
-   * or jpeg_write_raw_data.
-   */
-  cinfo->next_scanline = 0;
-  cinfo->global_state = (cinfo->raw_data_in ? CSTATE_RAW_OK : CSTATE_SCANNING);
-}
-
-
-/*
- * Write some scanlines of data to the JPEG compressor.
- *
- * The return value will be the number of lines actually written.
- * This should be less than the supplied num_lines only in case that
- * the data destination module has requested suspension of the compressor,
- * or if more than image_height scanlines are passed in.
- *
- * Note: we warn about excess calls to jpeg_write_scanlines() since
- * this likely signals an application programmer error.  However,
- * excess scanlines passed in the last valid call are *silently* ignored,
- * so that the application need not adjust num_lines for end-of-image
- * when using a multiple-scanline buffer.
- */
-
-GLOBAL JDIMENSION
-jpeg_write_scanlines (j_compress_ptr cinfo, JSAMPARRAY scanlines,
-		      JDIMENSION num_lines)
-{
-  JDIMENSION row_ctr, rows_left;
-
-  if (cinfo->global_state != CSTATE_SCANNING)
-    ERREXIT1(cinfo, JERR_BAD_STATE, cinfo->global_state);
-  if (cinfo->next_scanline >= cinfo->image_height)
-    WARNMS(cinfo, JWRN_TOO_MUCH_DATA);
-
-  /* Call progress monitor hook if present */
-  if (cinfo->progress != NULL) {
-    cinfo->progress->pass_counter = (long) cinfo->next_scanline;
-    cinfo->progress->pass_limit = (long) cinfo->image_height;
-    (*cinfo->progress->progress_monitor) ((j_common_ptr) cinfo);
-  }
-
-  /* Give master control module another chance if this is first call to
-   * jpeg_write_scanlines.  This lets output of the frame/scan headers be
-   * delayed so that application can write COM, etc, markers between
-   * jpeg_start_compress and jpeg_write_scanlines.
-   */
-  if (cinfo->master->call_pass_startup)
-    (*cinfo->master->pass_startup) (cinfo);
-
-  /* Ignore any extra scanlines at bottom of image. */
-  rows_left = cinfo->image_height - cinfo->next_scanline;
-  if (num_lines > rows_left)
-    num_lines = rows_left;
-
-  row_ctr = 0;
-  (*cinfo->main->process_data) (cinfo, scanlines, &row_ctr, num_lines);
-  cinfo->next_scanline += row_ctr;
-  return row_ctr;
-}
-
-/*
  * Terminate destination --- called by jpeg_finish_compress
  * after all data has been written.  Usually needs to flush buffer.
  *
@@ -370,7 +280,8 @@
 
 static int hackSize;
 
-void term_destination (j_compress_ptr cinfo)
+static void
+term_destination (j_compress_ptr cinfo)
 {
   my_dest_ptr dest = (my_dest_ptr) cinfo->dest;
   size_t datacount = dest->size - dest->pub.free_in_buffer;
@@ -384,7 +295,8 @@
  * for closing it after finishing compression.
  */
 
-void jpegDest (j_compress_ptr cinfo, byte* outfile, int size)
+static void
+jpegDest (j_compress_ptr cinfo, byte* outfile, int size)
 {
   my_dest_ptr dest;
 




More information about the quake3-commits mailing list