"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "rtgui/rtscalable.cc" between
rawtherapee-5.6.tar.xz and rawtherapee-5.7.tar.xz

About: RawTherapee is a powerful cross-platform raw image processing program.

rtscalable.cc  (rawtherapee-5.6.tar.xz):rtscalable.cc  (rawtherapee-5.7.tar.xz)
skipping to change at line 17 skipping to change at line 17
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* RawTherapee is distributed in the hope that it will be useful, * RawTherapee is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "rtscalable.h" #include "rtscalable.h"
#include <glib/gstdio.h> #include <glib/gstdio.h>
#include <regex> #include <regex>
#include <glibmm.h> #include <glibmm.h>
#include <iostream> #include <iostream>
#include <librsvg/rsvg.h> #include <librsvg/rsvg.h>
#include "options.h" #include "options.h"
skipping to change at line 122 skipping to change at line 122
// Removing the directory itself // Removing the directory itself
if (!error) { if (!error) {
try { try {
error = g_remove (path.c_str()); error = g_remove (path.c_str());
} catch (Glib::Error&) {} } catch (Glib::Error&) {}
} }
} }
void RTScalable::cleanup() void RTScalable::cleanup(bool all)
{ {
Glib::ustring imagesCacheFolder = Glib::build_filename (options.cacheBaseDir , "svg2png"); Glib::ustring imagesCacheFolder = Glib::build_filename (options.cacheBaseDir , "svg2png");
Glib::ustring sDPI = Glib::ustring::compose("%1", (int)getTweakedDPI()); Glib::ustring sDPI = Glib::ustring::compose("%1", (int)getTweakedDPI());
try { try {
Glib::Dir dir(imagesCacheFolder); Glib::Dir dir(imagesCacheFolder);
for (Glib::DirIterator entry = dir.begin(); entry != dir.end(); ++entry) { for (Glib::DirIterator entry = dir.begin(); entry != dir.end(); ++entry) {
const Glib::ustring fileName = *entry; const Glib::ustring fileName = *entry;
const Glib::ustring filePath = Glib::build_filename(imagesCacheFolde r, fileName); const Glib::ustring filePath = Glib::build_filename(imagesCacheFolde r, fileName);
if (fileName == "." || fileName == ".." || !Glib::file_test(filePath , Glib::FILE_TEST_IS_DIR)) { if (fileName == "." || fileName == ".." || !Glib::file_test(filePath , Glib::FILE_TEST_IS_DIR)) {
continue; continue;
} }
if (fileName != sDPI) { if (all || fileName != sDPI) {
deleteDir(filePath); deleteDir(filePath);
} }
} }
} catch (Glib::Exception&) { } catch (Glib::Exception&) {
} }
} }
/* /*
* This function try to find the svg file converted to png in a cache and return * This function try to find the svg file converted to png in a cache and return
skipping to change at line 223 skipping to change at line 223
// -------------------- Updating the the magic color -------------------- // -------------------- Updating the the magic color --------------------
std::string updatedSVG = std::regex_replace(svgFile, std::regex("#2a7fff"), "#CCCCCC"); std::string updatedSVG = std::regex_replace(svgFile, std::regex("#2a7fff"), "#CCCCCC");
// -------------------- Creating the rsvg handle -------------------- // -------------------- Creating the rsvg handle --------------------
GError **error = nullptr; GError **error = nullptr;
RsvgHandle *handle = rsvg_handle_new_from_data((unsigned const char*)updated SVG.c_str(), updatedSVG.length(), error); RsvgHandle *handle = rsvg_handle_new_from_data((unsigned const char*)updated SVG.c_str(), updatedSVG.length(), error);
if (handle == nullptr) { if (error && !handle) {
std::cerr << "ERROR: Can't use the provided data for \"" << fname << "\" to create a RsvgHandle:" << std::endl std::cerr << "ERROR: Can't use the provided data for \"" << fname << "\" to create a RsvgHandle:" << std::endl
<< Glib::ustring((*error)->message) << std::endl; << Glib::ustring((*error)->message) << std::endl;
Cairo::RefPtr<Cairo::ImageSurface> surf = Cairo::ImageSurface::create(Ca iro::FORMAT_RGB24, 10, 10); Cairo::RefPtr<Cairo::ImageSurface> surf = Cairo::ImageSurface::create(Ca iro::FORMAT_RGB24, 10, 10);
return surf; return surf;
} }
// -------------------- Drawing the image to a Cairo::ImageSurface --------- ----------- // -------------------- Drawing the image to a Cairo::ImageSurface --------- -----------
RsvgDimensionData dim; RsvgDimensionData dim;
rsvg_handle_get_dimensions(handle, &dim); rsvg_handle_get_dimensions(handle, &dim);
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)