Convert remaining RTPixbuf to RTSurface

Changes:
- Remove RTPixbuf use in directory browser to use native GTK mechanism
- Replace RTPixbuf by RTSurface for thumbnail icons
- Remove now useless RTPixbuf class

Fixes:
- Elaborate RTSurface width / height based on the type
This commit is contained in:
Pandagrapher
2022-08-27 11:37:59 +02:00
parent 36222d14a2
commit 50e54aa395
11 changed files with 151 additions and 297 deletions

View File

@@ -21,6 +21,7 @@
#include "options.h"
#include "thumbbrowserbase.h"
#include "../rtengine/rt_math.h"
#include "rtsurface.h"
namespace
{
@@ -284,10 +285,10 @@ void ThumbBrowserEntryBase::updateBackBuffer ()
int iheight = 0;
for (size_t i = 0; i < bbIcons.size(); i++) {
iwidth += bbIcons[i]->get_width() + (i > 0 ? igap : 0);
iwidth += bbIcons[i]->getWidth() + (i > 0 ? igap : 0);
if (bbIcons[i]->get_height() > iheight) {
iheight = bbIcons[i]->get_height();
if (bbIcons[i]->getHeight() > iheight) {
iheight = bbIcons[i]->getHeight();
}
}
@@ -310,10 +311,10 @@ void ThumbBrowserEntryBase::updateBackBuffer ()
for (size_t i = 0; i < bbIcons.size(); i++) {
// Draw the image at 110, 90, except for the outermost 10 pixels.
Gdk::Cairo::set_source_pixbuf(cc, bbIcons[i], istartx, istarty);
cc->rectangle(istartx, istarty, bbIcons[i]->get_width(), bbIcons[i]->get_height());
cc->set_source(bbIcons[i]->get(), istartx, istarty);
cc->rectangle(istartx, istarty, bbIcons[i]->getWidth(), bbIcons[i]->getHeight());
cc->fill();
istartx += bbIcons[i]->get_width() + igap;
istartx += bbIcons[i]->getWidth() + igap;
}
}
@@ -323,9 +324,9 @@ void ThumbBrowserEntryBase::updateBackBuffer ()
int istarty2 = prey + preh - igap - 1;
for (size_t i = 0; i < bbSpecificityIcons.size(); ++i) {
istartx2 -= bbSpecificityIcons[i]->get_width() - igap;
Gdk::Cairo::set_source_pixbuf(cc, bbSpecificityIcons[i], istartx2, istarty2 - bbSpecificityIcons[i]->get_height());
cc->rectangle(istartx2, istarty2 - bbSpecificityIcons[i]->get_height(), bbSpecificityIcons[i]->get_width(), bbSpecificityIcons[i]->get_height());
istartx2 -= bbSpecificityIcons[i]->getWidth() - igap;
cc->set_source(bbSpecificityIcons[i]->get(), istartx2, istarty2 - bbSpecificityIcons[i]->getHeight());
cc->rectangle(istartx2, istarty2 - bbSpecificityIcons[i]->getHeight(), bbSpecificityIcons[i]->getWidth(), bbSpecificityIcons[i]->getHeight());
cc->fill();
}
}
@@ -694,14 +695,14 @@ bool ThumbBrowserEntryBase::insideWindow (int x, int y, int w, int h) const
return !(ofsX + startx > x + w || ofsX + startx + exp_width < x || ofsY + starty > y + h || ofsY + starty + exp_height < y);
}
std::vector<Glib::RefPtr<Gdk::Pixbuf>> ThumbBrowserEntryBase::getIconsOnImageArea()
std::vector<std::shared_ptr<RTSurface>> ThumbBrowserEntryBase::getIconsOnImageArea()
{
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >();
return std::vector<std::shared_ptr<RTSurface>>();
}
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ThumbBrowserEntryBase::getSpecificityIconsOnImageArea()
std::vector<std::shared_ptr<RTSurface>> ThumbBrowserEntryBase::getSpecificityIconsOnImageArea()
{
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >();
return std::vector<std::shared_ptr<RTSurface>>();
}
bool ThumbBrowserEntryBase::motionNotify (int x, int y)