summaryrefslogtreecommitdiff
path: root/src/editing_tools/EditingTools.vala
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff.email>2018-07-09 12:10:38 +0200
committerJörg Frings-Fürst <debian@jff.email>2018-07-09 12:10:38 +0200
commit709e2d6f5652ec90c194a4ec2b530bebc6f952cb (patch)
tree496b2f3899e1d5728ee9ae76095cc5056c317447 /src/editing_tools/EditingTools.vala
parentf1353e9ffd34db5f755c7da0b3f9c10638fbfd38 (diff)
parent5c8be07095cc04a6d8a95204b0504fd7ab030154 (diff)
Merge branch 'release/0.28.3-1'0.28.3-1
Diffstat (limited to 'src/editing_tools/EditingTools.vala')
-rw-r--r--src/editing_tools/EditingTools.vala56
1 files changed, 18 insertions, 38 deletions
diff --git a/src/editing_tools/EditingTools.vala b/src/editing_tools/EditingTools.vala
index d160f23..ee08f84 100644
--- a/src/editing_tools/EditingTools.vala
+++ b/src/editing_tools/EditingTools.vala
@@ -265,29 +265,7 @@ public abstract class PhotoCanvas {
default_ctx.fill();
// paint the actual image
- Gdk.cairo_set_source_pixbuf(default_ctx, pixbuf, scaled_position.x, scaled_position.y);
- default_ctx.rectangle(scaled_position.x, scaled_position.y,
- pixbuf.get_width(), pixbuf.get_height());
- default_ctx.fill();
- default_ctx.restore();
- }
-
- public void paint_pixbuf_area(Gdk.Pixbuf pixbuf, Box source_area) {
- default_ctx.save();
- if (pixbuf.get_has_alpha()) {
- set_source_color_from_string(default_ctx, "#000");
- default_ctx.rectangle(scaled_position.x + source_area.left,
- scaled_position.y + source_area.top,
- source_area.get_width(), source_area.get_height());
- default_ctx.fill();
-
- }
- Gdk.cairo_set_source_pixbuf(default_ctx, pixbuf, scaled_position.x,
- scaled_position.y);
- default_ctx.rectangle(scaled_position.x + source_area.left,
- scaled_position.y + source_area.top,
- source_area.get_width(), source_area.get_height());
- default_ctx.fill();
+ paint_pixmap_with_background(default_ctx, pixbuf, scaled_position.x, scaled_position.y);
default_ctx.restore();
}
@@ -460,7 +438,7 @@ public abstract class PhotoCanvas {
Cairo.Surface surface = new Cairo.Surface.similar(default_ctx.get_target(),
Cairo.Content.COLOR_ALPHA, pos.width, pos.height);
Cairo.Context ctx = new Cairo.Context(surface);
- Gdk.cairo_set_source_pixbuf(ctx, pixbuf, 0, 0);
+ paint_pixmap_with_background(ctx, pixbuf, 0, 0);
ctx.paint();
return surface;
}
@@ -2207,7 +2185,7 @@ public class RedeyeTool : EditingTool {
}
public class AdjustTool : EditingTool {
- private const int SLIDER_WIDTH = 160;
+ private const int SLIDER_WIDTH = 200;
private const uint SLIDER_DELAY_MSEC = 100;
private class AdjustToolWindow : EditingToolWindow {
@@ -2255,7 +2233,7 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(exposure_label, 0, 0, 1, 1);
slider_organizer.attach(exposure_slider, 1, 0, 1, 1);
exposure_slider.set_size_request(SLIDER_WIDTH, -1);
- exposure_slider.set_draw_value(false);
+ exposure_slider.set_value_pos(Gtk.PositionType.RIGHT);
exposure_slider.set_margin_end(0);
Gtk.Label contrast_label = new Gtk.Label.with_mnemonic(_("Contrast:"));
@@ -2264,7 +2242,7 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(contrast_label, 0, 1, 1, 1);
slider_organizer.attach(contrast_slider, 1, 1, 1, 1);
contrast_slider.set_size_request(SLIDER_WIDTH, -1);
- contrast_slider.set_draw_value(false);
+ contrast_slider.set_value_pos(Gtk.PositionType.RIGHT);
contrast_slider.set_margin_end(0);
Gtk.Label saturation_label = new Gtk.Label.with_mnemonic(_("Saturation:"));
@@ -2273,7 +2251,7 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(saturation_label, 0, 2, 1, 1);
slider_organizer.attach(saturation_slider, 1, 2, 1, 1);
saturation_slider.set_size_request(SLIDER_WIDTH, -1);
- saturation_slider.set_draw_value(false);
+ saturation_slider.set_value_pos(Gtk.PositionType.RIGHT);
saturation_slider.set_margin_end(0);
Gtk.Label tint_label = new Gtk.Label.with_mnemonic(_("Tint:"));
@@ -2282,7 +2260,7 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(tint_label, 0, 3, 1, 1);
slider_organizer.attach(tint_slider, 1, 3, 1, 1);
tint_slider.set_size_request(SLIDER_WIDTH, -1);
- tint_slider.set_draw_value(false);
+ tint_slider.set_value_pos(Gtk.PositionType.RIGHT);
tint_slider.set_margin_end(0);
Gtk.Label temperature_label =
@@ -2292,7 +2270,7 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(temperature_label, 0, 4, 1, 1);
slider_organizer.attach(temperature_slider, 1, 4, 1, 1);
temperature_slider.set_size_request(SLIDER_WIDTH, -1);
- temperature_slider.set_draw_value(false);
+ temperature_slider.set_value_pos(Gtk.PositionType.RIGHT);
temperature_slider.set_margin_end(0);
Gtk.Label shadows_label = new Gtk.Label.with_mnemonic(_("Shadows:"));
@@ -2301,8 +2279,10 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(shadows_label, 0, 5, 1, 1);
slider_organizer.attach(shadows_slider, 1, 5, 1, 1);
shadows_slider.set_size_request(SLIDER_WIDTH, -1);
- shadows_slider.set_draw_value(false);
- shadows_slider.set_margin_end(0);
+ shadows_slider.set_value_pos(Gtk.PositionType.RIGHT);
+ // FIXME: Hack to make the slider the same length as the other. Find out why it is aligned
+ // Differently (probably because it only has positive values)
+ shadows_slider.set_margin_end(5);
Gtk.Label highlights_label = new Gtk.Label.with_mnemonic(_("Highlights:"));
highlights_label.halign = Gtk.Align.START;
@@ -2310,7 +2290,8 @@ public class AdjustTool : EditingTool {
slider_organizer.attach(highlights_label, 0, 6, 1, 1);
slider_organizer.attach(highlights_slider, 1, 6, 1, 1);
highlights_slider.set_size_request(SLIDER_WIDTH, -1);
- highlights_slider.set_draw_value(false);
+ highlights_slider.set_value_pos(Gtk.PositionType.RIGHT);
+ highlights_slider.set_margin_end(0);
Gtk.Box button_layouter = new Gtk.Box(Gtk.Orientation.HORIZONTAL, 8);
button_layouter.set_homogeneous(true);
@@ -2327,7 +2308,7 @@ public class AdjustTool : EditingTool {
pane_layouter.add(histogram_manipulator);
pane_layouter.add(slider_organizer);
pane_layouter.add(button_layouter);
- pane_layouter.set_child_packing(histogram_manipulator, true, true, 0, Gtk.PackType.START);
+ pane_layouter.set_child_packing(histogram_manipulator, false, true, 0, Gtk.PackType.START);
add(pane_layouter);
}
@@ -2971,15 +2952,14 @@ public class AdjustTool : EditingTool {
fp_pixel_cache = new float[3 * source_width * source_height];
int cache_pixel_index = 0;
- float INV_255 = 1.0f / 255.0f;
for (int j = 0; j < source_height; j++) {
int row_start_index = j * source_rowstride;
int row_end_index = row_start_index + (source_width * source_num_channels);
for (int i = row_start_index; i < row_end_index; i += source_num_channels) {
- fp_pixel_cache[cache_pixel_index++] = ((float) source_pixels[i]) * INV_255;
- fp_pixel_cache[cache_pixel_index++] = ((float) source_pixels[i + 1]) * INV_255;
- fp_pixel_cache[cache_pixel_index++] = ((float) source_pixels[i + 2]) * INV_255;
+ fp_pixel_cache[cache_pixel_index++] = rgb_lookup_table[source_pixels[i]];
+ fp_pixel_cache[cache_pixel_index++] = rgb_lookup_table[source_pixels[i + 1]];
+ fp_pixel_cache[cache_pixel_index++] = rgb_lookup_table[source_pixels[i + 2]];
}
}
}