Sfoglia il codice sorgente

fix offset discrepency, and allow reuse of loaded images

David Rose 24 anni fa
parent
commit
f78a17389d

+ 3 - 3
pandaapp/src/stitchbase/stitchImage.cxx

@@ -83,7 +83,7 @@ StitchImage(const string &name, const string &filename,
   _mm_to_uv =
     LMatrix3d::translate_mat(-_film_offset_mm) *
     LMatrix3d::scale_mat(1.0 / mm_per_uv[0], 1.0 / mm_per_uv[1]) *
-    LMatrix3d::translate_mat(LVector2d(0.5, 0.5) + _film_offset_mm);
+    LMatrix3d::translate_mat(LVector2d(0.5, 0.5));
 
   setup_pixel_scales();
 
@@ -147,8 +147,8 @@ set_fade_filename(const Filename &filename) {
 bool StitchImage::
 read_file() {
   if (_data != NULL) {
-    delete _data;
-    _data = NULL;
+    // The data is already available; no need to re-read it.
+    return true;
   }
   if (!has_filename()) {
     return false;

+ 4 - 1
pandaapp/src/stitchbase/stitchImageRasterizer.cxx

@@ -313,7 +313,10 @@ draw_image(StitchImage *output, StitchImage *input) {
   output->pick_up_singularity(rast, input);
   output->close_layer(rast._read_input);
 
-  input->clear_file();
+  // We don't necessarily want to clear the input file now.  Although
+  // that would reduce memory consumption, maybe we've got plenty of
+  // memory and we're more concerned with reducing load time.
+  //  input->clear_file();
 }