~mbranton/libopenshot/alpha-channel-fix

« back to all changes in this revision

Viewing changes to src/Clip.cpp

  • Committer: Jonathan Thomas
  • Date: 2016-09-14 09:11:12 UTC
  • Revision ID: jonathan@openshot.org-20160914091112-mcxg747f4zniwscx
Added SetMaxSize for image optimizations in QImageReader and FFmpegReader, which lets the timeline pass down the max size to all clips and readers, so they can optionally optimize the size of images (especially useful for optimizing preview performance). Removed convoluted image scaling code in FFmpegReader, and replaced with simpler version. Also, fixed a few regressions from the new Caching code, primarily a crash when reaching the end of the last clip on the timeline.

Show diffs side-by-side

added added

removed removed

Lines of Context:
596
596
                // Debug output
597
597
                ZmqLogger::Instance()->AppendDebugMethod("Clip::GetOrCreateFrame (from reader)", "number", number, "samples_in_frame", samples_in_frame, "", -1, "", -1, "", -1, "", -1);
598
598
 
 
599
                // Set max image size (used for performance optimization)
 
600
                if (scale_x.GetValue(number) > 1.000001 || scale_y.GetValue(number) > 1.000001)
 
601
                        // Scaling larger, use original image size (slower but better quality)
 
602
                        reader->SetMaxSize(0, 0);
 
603
                else
 
604
                        // No scaling applied, use max_size (usually the size of the timeline)
 
605
                        reader->SetMaxSize(max_width, max_height);
 
606
 
599
607
                // Attempt to get a frame (but this could fail if a reader has just been closed)
600
608
                new_frame = reader->GetFrame(number);
601
609