Merged master into pixelshift

This commit is contained in:
heckflosse
2016-12-12 14:25:57 +01:00
25 changed files with 1940 additions and 65 deletions

View File

@@ -2083,10 +2083,15 @@ void CropWindow::updateHoveredPicker (rtengine::Coord *imgPos)
}
LockableColorPicker::Validity validity = checkValidity (hoveredPicker, cropPos);
hoveredPicker->setValidity (validity);
{
MyMutex::MyLock lock(cropHandler.cimg);
if (validity == LockableColorPicker::Validity::INSIDE) {
cropHandler.colorPick(cropPos, r, g, b, rpreview, gpreview, bpreview, hoveredPicker->getSize());
hoveredPicker->setRGB (r, g, b, rpreview, gpreview, bpreview);
}
}
}
void CropWindow::changeZoom (int zoom, bool notify, int centerx, int centery)
{
@@ -2450,6 +2455,7 @@ void CropWindow::drawObservedFrame (Cairo::RefPtr<Cairo::Context> cr, int rw, in
void CropWindow::cropImageUpdated ()
{
MyMutex::MyLock lock(cropHandler.cimg);
for (auto colorPicker : colorPickers) {
Coord imgPos, cropPos;

View File

@@ -430,7 +430,7 @@ void ExifPanel::addPressed ()
} else {
tcombo->set_active_text (sel);
if (tcombo->get_active () < 0) {
if (!tcombo->get_active ()) {
tcombo->append_text (sel);
tcombo->set_active_text (sel);
}

View File

@@ -437,7 +437,7 @@ public:
// you have to check if the surface is created thanks to surfaceCreated before starting to draw on it
bool surfaceCreated()
{
return surface;
return static_cast<bool>(surface);
}
Cairo::RefPtr<Cairo::ImageSurface> getSurface()
{

View File

@@ -149,16 +149,43 @@ void ImageArea::setInfoText (Glib::ustring text)
infotext = text;
Glib::RefPtr<Pango::Context> context = get_pango_context () ;
Pango::FontDescription fontd = context->get_font_description ();
Pango::FontDescription fontd(get_default_style()->get_font());
// update font
fontd.set_weight (Pango::WEIGHT_BOLD);
fontd.set_size (9 * Pango::SCALE);
context->set_font_description (fontd);
ilayout = create_pango_layout("");
// create text layout
Glib::RefPtr<Pango::Layout> ilayout = create_pango_layout("");
ilayout->set_markup(text);
// get size of the text block
int iw, ih;
ilayout->get_pixel_size (iw, ih);
ipixbuf = Gdk::Pixbuf::create (Gdk::COLORSPACE_RGB, true, 8, iw + 8, ih + 8);
ipixbuf->fill (128);
// create BackBuffer
iBackBuffer.setDrawRectangle(Cairo::FORMAT_ARGB32, 0, 0, iw + 16, ih + 16, true);
iBackBuffer.setDestPosition(8, 8);
Cairo::RefPtr<Cairo::Context> cr = iBackBuffer.getContext();
// cleaning the back buffer (make it full transparent)
cr->set_source_rgba (0., 0., 0., 0.);
cr->set_operator (Cairo::OPERATOR_CLEAR);
cr->paint ();
cr->set_operator (Cairo::OPERATOR_OVER);
// paint transparent black background
cr->set_source_rgba (0., 0., 0., 0.5);
cr->paint ();
// paint text
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->move_to (8, 8);
ilayout->add_to_cairo_context (cr);
cr->fill ();
}
void ImageArea::infoEnabled (bool e)
@@ -206,7 +233,6 @@ bool ImageArea::on_expose_event(GdkEventExpose* event)
return true;
}
Glib::RefPtr<Gdk::Window> window = get_window();
Cairo::RefPtr<Cairo::Context> cr = get_window()->create_cairo_context();
if (mainCropWindow) {
@@ -214,13 +240,7 @@ bool ImageArea::on_expose_event(GdkEventExpose* event)
}
if (options.showInfo && infotext != "") {
int fnw, fnh;
ilayout->get_pixel_size (fnw, fnh);
window->draw_pixbuf (get_style()->get_base_gc (Gtk::STATE_NORMAL), ipixbuf, 0, 0, 4, 4, fnw + 8, fnh + 8, Gdk::RGB_DITHER_NONE, 0, 0);
cr->set_source_rgb (1.0, 1.0, 1.0);
cr->move_to (8, 8);
ilayout->add_to_cairo_context (cr);
cr->fill ();
iBackBuffer.copySurface(cr);
}
for (std::list<CropWindow*>::reverse_iterator i = cropWins.rbegin(); i != cropWins.rend(); ++i) {

View File

@@ -41,9 +41,8 @@ class ImageArea : public Gtk::DrawingArea, public CropWindowListener, public Edi
protected:
Glib::ustring infotext;
Glib::RefPtr<Pango::Layout> ilayout;
Glib::RefPtr<Pango::Layout> deglayout;
Glib::RefPtr<Gdk::Pixbuf> ipixbuf;
BackBuffer iBackBuffer;
bool showClippedH, showClippedS;
ImageAreaPanel* parent;

View File

@@ -17,9 +17,11 @@
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/
#include <cassert>
#include <cmath>
#include "thresholdselector.h"
#include "multilangmgr.h"
#include <cassert>
#include "mycurve.h"
ThresholdSelector::ThresholdSelector(double minValueBottom, double maxValueBottom, double defBottom, Glib::ustring labelBottom, unsigned int precisionBottom,
@@ -551,7 +553,7 @@ void ThresholdSelector::findLitCursor(int posX, int posY)
// we use minValTop since if this block is executed, it means that we are in a simple Threshold where both bottom and top range are the same
double cursorX = (posX - hb) * (maxValTop - minValTop) / (w - 2 * hb) + minValTop;
if (cursorX > positions[TS_TOPRIGHT] || abs(cursorX - positions[TS_TOPRIGHT]) < abs(cursorX - positions[TS_TOPLEFT])) {
if (cursorX > positions[TS_TOPRIGHT] || std::fabs(cursorX - positions[TS_TOPRIGHT]) < std::fabs(cursorX - positions[TS_TOPLEFT])) {
litCursor = TS_TOPRIGHT;
}
}
@@ -564,7 +566,7 @@ void ThresholdSelector::findLitCursor(int posX, int posY)
// we use minValTop since if this block is executed, it means that we are in a simple Threshold where both bottom and top range are the same
double cursorX = (posX - hb) * (maxValTop - minValTop) / (w - 2 * hb) + minValTop;
if (cursorX > positions[TS_BOTTOMRIGHT] || abs(cursorX - positions[TS_BOTTOMRIGHT]) < abs(cursorX - positions[TS_BOTTOMLEFT])) {
if (cursorX > positions[TS_BOTTOMRIGHT] || std::fabs(cursorX - positions[TS_BOTTOMRIGHT]) < std::fabs(cursorX - positions[TS_BOTTOMLEFT])) {
litCursor = TS_BOTTOMRIGHT;
}
}

View File

@@ -24,8 +24,9 @@
class WinDirChangeListener
{
public:
virtual ~WinDirChangeListener() = default;
virtual void winDirChanged () {}
};