When adding a rectangle to a projection's update area, align the
rectangle to a coarse grid, to reduce the complexity of the overall
area. We currently align the rectangle to a 32x32 grid, which
seems to be a good tradeoff between the overhead of processing a
complex area, and the overhead of processing a large area.
... which control the priority of the projection's idle source.
The projection's priority is specified relatively to
GIMP_PRIORITY_PROJECTION_IDLE (i.e., a priority of 1 results in an
idle source with priority GIMP_PRIORITY_PROJECTION_IDLE + 1, etc.)
More than 2000 lines of code less in app/, instead of
if (instance->member)
{
g_object_unref/g_free/g_whatever (instance->member);
instance->member = NULL;
}
we now simply use
g_clear_object/pointer (&instance->member);
which isn't really for "picking", but it just fits too nicely into
GimpPickable to not put it there.
Also add utility function gimp_pickable_srgb_to_image_color() which
takes a "real" (sRGB) GimpRGB value, transforms it to the pickable's
colorspace and puts it into an "image color" GimpRGB.
...when a color profile is active
Add GimpPickable::pixel_to_srgb() which puts a picked raw image
pixel into a GimpRGB. Default to gimp_rgba_set_pixel() but implement
pixel_to_srgb() in GimpLayer, GimpProjection and GimpImage and
run the pixel through gimp_image_color_profile_pixel_to_srgb().
which currently all end in a call to gimp_color_managed_get_color_profile()
except for channels and masks. This is currently unused infrastructure but
will be used for things like layer previews, and return NULL if called
on a mask or channel, or if color management is disabled, or whatever.
Add virtual function validate() so subclasses can construct arbitrary
buffers on-the-fly. The default implementation blits from the
projection graph like before. Add boolean property "whole-tile" which
allows for switching between always validating entire tiles, and
validating the parts of the tile that are actually dirty.
Allow for more tiles to update, making it possible to see more of the updated
image when tuning paremters / dragging items interactively. Lower frame rate
for more image content is better than 60fps for a small rectangle in the upper
left.
In GimpProjection, use gimp_rectangle_intersect() instead of ad-hoc
CLAMP() constructs to sanitize rectangles, and don't let rectangles
enter the projection if they don't intersect with the projectable.
(apparently I have killed some check that did the same when porting
to cairo regions).
Pull freeing the update regions into gimp_projection_free_buffer()
because freeing the buffer definitely obsoletes them. Get rid of
the last x1, y1, x2, y2 and use x, y, w, h inatead.
Remove member "running" it was always identical to "idle_id != 0".
Rename and reorder variables to make more sense. Simplify
gimp_projection_chunk_render_iteration() work area calculation.
This may or may not remove some logic that avoids drawing tiny update
regions, and may or may not improve things or make them worse. Will
add code that actually tile-aligns update areas later.
- don't include <gdk-pixbuf/gdk-pixbuf.h> in headers in app/
- instead, include it in many .c files instead of <glib-object.h>,
finally acknowledging the fact that app/ depends on gdk-pixbuf almost
globally
- fix up includes as if libgimpbase depended in GIO, which it soon will
removing the area that is going to be rendered from the dirty area
before rendering it, prevents tile-handler-projection to render it
again.
This was the reason why caching showed an improvement also during
the construction of the projection. And it was a regression that
I introduced in a previous commit
when toggling the visibility of a single layer image with
alpha channel, zoomed at 50%, the projection wasn't
properly redrawn. It seems there's a GEGL bug exposed
by normal layer mode operation fast path.
measure the time it takes to render projection chunks and continue
rendering until 0.01 seconds have passed. This ways we avoid excessive
expose roundtrips.
so we can control how much time it takes, and can further optimize it.
This is needed for gtk3 because it should happen between clock ticks,
not in the expose handler, and in gtk2 the old code would have the
unfortunate property to potentially render at very high frame rates,
including all the overhead of exposing.
and separate the chunk rendering logic from the fact that it's invoked
from an idle callback. Idle rendering no longer works in GTK+ 3.8 and
later because the expose logic was changed from an idle function to a
frame clock, and when we switch to that in gtk3-port, the diff to
master should stay readable (and rebasable) in this critical part of
the code.
because it made applying of expensive filters pretty unresponsive.
Don't revert commit b7b504d624 tho
because it also moves the #defines to a proper place.
Let GimpTileHandlerProjection know how large the projection is so it
can calculate the number of levels in the pyramid, and always
invalidate all levels.
This does not make any difference for normal images, but for images
without display (like when creating thumbnails, or for GUI-less
scripting), this is now needed because we create the initial
projection much more lazily, and got an empty projection.
And along with it a lot of stuff like the drawable preview cache, the
gegl tile manager backend, temporary gimp_gegl_buffer_foo() stuff, and
the remaining bits of performance.
The projection is in an evil semi-ported state which makes it work
ok-ish for stuff like layer moving, but absolutely unbearable for
painting, there is also an off-by-one rendering glitch at some zoom
levels.