diff options
author | Albert Astals Cid <aacid@kde.org> | 2017-05-05 23:32:32 +0200 |
---|---|---|
committer | Albert Astals Cid <aacid@kde.org> | 2017-05-05 23:32:32 +0200 |
commit | 3c29ded4bee5eadb829ed46af2ec92be57b0077b (patch) | |
tree | e9a549c6258b4303fbb97a8bfda8ca76a45866e1 /poppler/Movie.cc | |
parent | d73bcd3721f3b53bb97241cc53a6abf807aff782 (diff) |
Make Object free itself on init and destruction
Will make for a *much* easier way to code.
Patches with more std::move coming on top.
Most things seem to work though i'm pretty sure some things are broken.
NEEDS TESTING
Diffstat (limited to 'poppler/Movie.cc')
-rw-r--r-- | poppler/Movie.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/poppler/Movie.cc b/poppler/Movie.cc index f68b6adc..7775eb50 100644 --- a/poppler/Movie.cc +++ b/poppler/Movie.cc @@ -6,7 +6,7 @@ // Hugo Mercier <hmercier31[at]gmail.com> (c) 2008 // Pino Toscano <pino@kde.org> (c) 2008 // Carlos Garcia Campos <carlosgc@gnome.org> (c) 2010 -// Albert Astals Cid <aacid@kde.org> (c) 2010 +// Albert Astals Cid <aacid@kde.org> (c) 2010, 2017 // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -265,6 +265,23 @@ Movie::Movie(Object *movieDict, Object *aDict) { } } +Movie::Movie(const Movie &other) +{ + ok = other.ok; + rotationAngle = other.rotationAngle; + width = other.width; + height = other.height; + showPoster = other.showPoster; + MA = other.MA; + + other.poster.copy(&poster); + + if (other.fileName) + fileName = other.fileName->copy(); + else + fileName = nullptr; +} + void Movie::getFloatingWindowSize(int *widthA, int *heightA) { *widthA = int(width * double(MA.znum) / MA.zdenum); @@ -272,14 +289,5 @@ void Movie::getFloatingWindowSize(int *widthA, int *heightA) } Movie* Movie::copy() { - - // call default copy constructor - Movie* new_movie = new Movie(*this); - - if (fileName) - new_movie->fileName = fileName->copy(); - - poster.copy(&new_movie->poster); - - return new_movie; + return new Movie(*this); } |