Commit Graph

394 Commits

Author SHA1 Message Date
Ell 49285463e6 app: align projection update area to coarse grid
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.
2018-03-31 08:19:18 -04:00
Ell 61ae3089ad app: avoid begin_render()/end_render() when flushing projections
... since we don't actually render anything, only invalidate.
2017-12-02 10:38:34 -05:00
Ell 1a2c0e8198 app: add gimp_projection_{get,set}_priority()
... 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.)
2017-12-02 10:38:34 -05:00
Ell 1c68617302 app: use {begin,end}_render() and GimpTileHandlerProjectable ...
... in GimpProjection and gimp_display_shell_render() (the latter
is not really necessary, but whatever.)
2017-08-08 15:39:27 -04:00
Michael Natterer 12f920d8bf app: change GimpTileHandlerValidate's API to use GeglRectangle
instead of x, y, width, height.
2017-08-05 15:43:41 +02:00
Michael Natterer 0cb3e75f79 app: use a lot of g_clear_object() and g_clear_pointer()
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);
2017-07-15 18:42:44 +02:00
Michael Natterer 5b4d0219d8 app: add GimpPickable::srgb_to_pixel()
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.
2016-05-23 01:33:52 +02:00
Michael Natterer 26251695b0 Bug 748749 - picked colors don't match image colors...
...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().
2016-05-22 23:28:31 +02:00
Øyvind Kolås 9cc634e838 app: add new required arguments to gegl_node_blit_buffers 2015-11-21 03:18:56 +01:00
Michael Natterer 76ff1c1584 Revert "app: add ::get_color_profile() to GimpPickable and GimpProjectable"
This reverts commit 5c8ffdf6c5.

It was a bad idea, we have the GimpColorManaged interface for that.
2015-09-03 00:21:09 +02:00
Michael Natterer 5c8ffdf6c5 app: add ::get_color_profile() to GimpPickable and GimpProjectable
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.
2015-09-01 22:27:31 +02:00
Michael Natterer 8c6e890835 app: rename GimpTileHandlerProjection to GimpTileHandlerValidate
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.
2015-03-15 22:09:04 +01:00
Michael Natterer 980ba7f85a app: move memsize functions into their own files gimp-memsize.[ch] 2014-08-12 13:57:57 +02:00
Michael Natterer c88800e840 app: add gimp-priorities.h and keep the most important priorities there
also add comments with all predefined priorities as documentation.
2014-07-02 04:47:24 +02:00
Michael Natterer f2b265f751 app: more correct code in gimp_projection_chunk_render_iteration()
wasn't broken before, just too obscure.
2014-06-30 23:12:53 +02:00
Michael Natterer 3795c597ba app: add gimp_projection_stop_rendering()
which stops a running chunk renderer and moves its remaining
unrendered region back to the projection's dirty region.
2014-06-29 23:57:22 +02:00
Michael Henning ef79cfdade app: Make GIMP_PROJECTION_CHUNK_TIME a gdouble
Otherwise, it's immediately rounded to 0.
2014-06-22 10:38:44 -04:00
Michael Natterer 3af1fff5af app: make the first image jump to the center of the canvas before rendering
Make GIMP_DISPLAY_SHELL_FILL_IDLE_PRIORITY a bit higher than
GIMP_PROJECTION_IDLE_PRIORITY which is the priority of chunk
rendering.
2014-06-17 23:29:24 +02:00
Michael Natterer 9f0fde1397 app: add gimp_gegl_pyramid_get_memsize(), used by gimp_projection_get_memsize() 2014-06-15 18:21:05 +02:00
Michael Natterer 02c9dacc8f app: s/GimpPrecision/GimpComponentType/ in gimp_projection_estimate_memsize() 2014-06-14 23:20:52 +02:00
Øyvind Kolås 69b7cda375 app: fix projection and display render chunk-size envvars 2014-06-04 02:07:08 +02:00
Michael Natterer 2c4d5e4391 app: make projection chunk size and display render chunk size configurable
Set the GIMP_PROJECTION_CHUNK_SIZE and GIMP_DISPLAY_RENDER_BUF_SIZE
environment variables to "WIDTHxHEIGHT".
2014-06-04 01:23:41 +02:00
Øyvind Kolås dcc60e12b6 app: aim for 15fps projection rendering
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.
2014-06-03 01:31:02 +02:00
Michael Natterer 06d91251da Bug 731085 - Dragging an image out of the image area freezes GIMP
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).
2014-06-01 21:30:11 +02:00
Michael Natterer 49818c7179 app: more cleanup in GimpProjection
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.
2014-05-31 15:13:32 +02:00
Michael Natterer 0b01f3b2b8 app: remove duplicate typedef GimpProjectionPrivate 2014-05-31 09:58:14 +02:00
Michael Natterer 5db796e17d app: improve code readability in GimpProjection 2014-05-31 02:58:21 +02:00
Michael Natterer 639319367a app: allow to set a "priority rectangle" on GimpProjection
If it is set, that rectangle gets processed first when
idle-constructing the image via ChunkRender.
2014-05-31 02:34:56 +02:00
Michael Natterer f509fce5d2 app: clean up the projections ChunkRender code
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.
2014-05-31 01:42:28 +02:00
Michael Natterer 9b341d05bb app: remove GimpArea and use cairo_region_t instead
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.
2014-05-31 01:26:06 +02:00
Michael Natterer a8f0c0e998 app: move all GimpProjection members to a private struct 2014-05-31 00:08:43 +02:00
Daniel Sabo db52f88308 app: Set Gimp specific TileHandler properties
Remove a dependency on GEGL setting Gimp specific properties
on custom tile handlers.
2014-02-02 02:12:02 -08:00
Michael Natterer 697572ccc0 app,libgimp*: fix includes to follow our include policy
- 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
2013-10-15 01:58:39 +02:00
Michael Natterer a4dd86fcda app: add a read-only "buffer" property to GimpPickableInterface
and implement it in GimpDrawable and GimpProjection. Will need this
later.
2013-09-05 10:37:09 +02:00
Massimo Valentini 8ec824f158 app: do not render many tiles twice
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
2013-08-11 08:49:38 +02:00
Massimo Valentini 5b7953a423 app: do not invalidate always the whole layer 2013-08-10 16:43:08 +02:00
Massimo Valentini 40f41055b9 app: fix the tile pyramid invalidation bug
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.
2013-08-10 16:22:27 +02:00
Michael Natterer 40e7ca7442 app: speed up image rendering by removing expose overhead
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.
2013-08-09 20:20:02 +02:00
Michael Natterer b05ff480fd app: move the work of construction the projection into the chunk renderer
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.
2013-08-09 19:17:02 +02:00
Michael Natterer 3b12541d61 app: rename GimpProjection's IdleRender stuff to ChunkRender
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.
2013-07-28 15:57:28 +02:00
Michael Natterer a9ddcde6ed app: change projection idle chunk size back to 256x128
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.
2013-05-25 16:37:52 +02:00
Michael Natterer b7b504d624 app: double the chunks of the projection idle renderer: 256x128 -> 512x256 2013-05-22 21:20:23 +02:00
Michael Natterer 06968d9bf9 Bug 690325 - Image Display broken: a rectangle undrawn to the top left
Let GimpTileHandlerProjection know how large the projection is so it
can calculate the number of levels in the pyramid, and always
invalidate all levels.
2013-03-30 17:44:59 +01:00
Michael Natterer 766999ce3f app: make sure the projection buffer exists in gimp_projection_pickable_flush()
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.
2012-12-18 19:30:33 +01:00
Michael Natterer 2ad8373c42 app: construct the image's first projection incrementally
just as all subsequent ones. Fixes potentially huge delay for new
images, because we used to construct the entire projection in one go.
2012-12-15 19:33:21 +01:00
Michael Natterer 101a9b9887 app: make image and projection size estimations precision-aware
GimpProjection estimation was still assuming 8 bit, so was
GimpTemplate. Also, calculate GIMP_PROJECTION_IDLE_PRIORITY
inatead of hardcoding it.
2012-08-24 22:16:02 +02:00
Michael Natterer 6b6d39fc64 app: add GimpTileHandlerProjection and use it to validate the projection
as the projection buffer is being read from. Projection performance is
now back at its old speed.
2012-07-05 21:42:26 +02:00
Michael Natterer 8c871b3a5f app: fix buffer == NULL warning in GimpProjection 2012-06-26 16:09:29 +02:00
Michael Natterer 373a4e7469 app: completely remove TileManager and friends (base/ and paint-funcs/)
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.
2012-06-20 21:44:09 +02:00
Michael Natterer 7539b9e359 app: simplify projection construction by not doing things GEGL should do 2012-05-20 20:24:45 +02:00