diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2025-08-04 03:29:51 +0300 |
---|---|---|
committer | Alexander Golubev <fatzer2@gmail.com> | 2025-08-05 02:24:46 +0300 |
commit | a6ab7f1c6dcf3076aa5488a790d81f42cbc93b48 (patch) | |
tree | 398109d81d95d7b01032abd655fc0340aa91479c /src/exporters | |
parent | 19201b658c807f6ffa3c9dcaa02c90b38312e2d7 (diff) | |
download | krecipes-master.tar.gz krecipes-master.zip |
TQImage is more suitable for i/o operations and long-term storage rather
than TQPixmap (which is better for immediate display on the screen). The
UI rarely does displays all those photos and does it one-by-one (i.e.
there is no big gallery), so there is no significant performance penalty
for the use of TQImage. On the contrary this way we should save some
memory on allocations associated X11 stuff for pixmaps and loading time
when the database contains a lot of photos.
Note that there is yet another use of TQPixmap in `htmlexporter` which
cannot be replaced because it uses TQPainter, which didn't supported
QImage until Qt5.
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
Diffstat (limited to 'src/exporters')
-rw-r--r-- | src/exporters/cookmlexporter.cpp | 2 | ||||
-rw-r--r-- | src/exporters/htmlexporter.cpp | 6 | ||||
-rw-r--r-- | src/exporters/kreexporter.cpp | 2 |
3 files changed, 5 insertions, 5 deletions
diff --git a/src/exporters/cookmlexporter.cpp b/src/exporters/cookmlexporter.cpp index b967fb9..41f88bc 100644 --- a/src/exporters/cookmlexporter.cpp +++ b/src/exporters/cookmlexporter.cpp @@ -90,7 +90,7 @@ TQString CookMLExporter::createContent( const RecipeList& recipes ) TQBuffer buffer( data ); buffer.open( IO_WriteOnly ); TQImageIO iio( &buffer, "JPEG" ); - iio.setImage( ( *recipe_it ).photo.convertToImage() ); + iio.setImage( ( *recipe_it ).photo ); iio.write(); picbin_tag.appendChild( doc.createTextNode( KCodecs::base64Encode( data, true ) ) ); diff --git a/src/exporters/htmlexporter.cpp b/src/exporters/htmlexporter.cpp index b8afd40..740b31a 100644 --- a/src/exporters/htmlexporter.cpp +++ b/src/exporters/htmlexporter.cpp @@ -245,16 +245,16 @@ void HTMLExporter::storePhoto( const Recipe &recipe ) photo_name = "default_photo"; } else { - image = recipe.photo.convertToImage(); + image = recipe.photo; photo_name = TQString::number(recipe.recipeID); } - TQPixmap pm = image;//image.smoothScale( phwidth, 0, TQImage::ScaleMax ); + //image.smoothScale( phwidth, 0, TQImage::ScaleMax ); TQFileInfo fi(fileName()); TQString photo_path = fi.dirPath(true) + "/" + fi.baseName() + "_photos/" + photo_name + ".png"; if ( !TQFile::exists( photo_path ) ) { - pm.save( photo_path, "PNG" ); + image.save( photo_path, "PNG" ); } } diff --git a/src/exporters/kreexporter.cpp b/src/exporters/kreexporter.cpp index 4df2792..9fa400e 100644 --- a/src/exporters/kreexporter.cpp +++ b/src/exporters/kreexporter.cpp @@ -111,7 +111,7 @@ TQString KreExporter::createContent( const RecipeList& recipes ) TQBuffer buffer( data ); buffer.open( IO_WriteOnly ); TQImageIO iio( &buffer, "JPEG" ); - iio.setImage( ( *recipe_it ).photo.convertToImage() ); + iio.setImage( ( *recipe_it ).photo ); iio.write(); xml += KCodecs::base64Encode( data, true ); |