From f78a17389d26a47a8b2c85ad058d19eb3d5c7d40 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 26 Jul 2001 16:48:40 +0000 Subject: [PATCH] fix offset discrepency, and allow reuse of loaded images --- pandaapp/src/stitchbase/stitchImage.cxx | 6 +++--- pandaapp/src/stitchbase/stitchImageRasterizer.cxx | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/pandaapp/src/stitchbase/stitchImage.cxx b/pandaapp/src/stitchbase/stitchImage.cxx index cdfb4fb428..1cc687b630 100644 --- a/pandaapp/src/stitchbase/stitchImage.cxx +++ b/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; diff --git a/pandaapp/src/stitchbase/stitchImageRasterizer.cxx b/pandaapp/src/stitchbase/stitchImageRasterizer.cxx index 2ccb0c60f2..8f337718b9 100644 --- a/pandaapp/src/stitchbase/stitchImageRasterizer.cxx +++ b/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(); }