Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions src/gtkutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,18 +621,3 @@ weakref_set(GObject **pointer, GObject *object)

#define WEAKREF_SET(A, B) weakref_set((GObject **) &(A), (GObject *) (B));

VipsRect *
rect_graphene_to_vips(graphene_rect_t *graphene, VipsRect *vips)
{
// round out to enclosing int area
graphene_rect_t bounds;
graphene_rect_round_extents(graphene, &bounds);

vips->left = bounds.origin.x;
vips->top = bounds.origin.y;
vips->width = bounds.size.width;
vips->height = bounds.size.height;

return vips;
}

2 changes: 0 additions & 2 deletions src/gtkutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,5 +116,3 @@ gboolean value_to_filename(const GValue *value,

void weakref_set(GObject **pointer, GObject *object);
#define WEAKREF_SET(A, B) weakref_set((GObject **) &(A), (GObject *) (B));

VipsRect *rect_graphene_to_vips(graphene_rect_t *graphene, VipsRect *vips);
6 changes: 3 additions & 3 deletions src/kplot/reallocarray.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Expand All @@ -21,7 +21,7 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif /*HAVE_CONFIG_H*/
Expand Down
51 changes: 26 additions & 25 deletions src/tilecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ tilecache_print(Tilecache *tilecache)

static void
tilecache_compute_visibility(Tilecache *tilecache,
graphene_rect_t *grect, int z)
VipsRect *viewport, int z)
{
int size0 = TILE_SIZE << z;
int start_time = tile_get_time();
Expand All @@ -727,10 +727,8 @@ tilecache_compute_visibility(Tilecache *tilecache,

/* The rect of tiles touched by the viewport.
*/
VipsRect viewport;
rect_graphene_to_vips(grect, &viewport);
VipsRect touches;
tilecache_tiles_for_rect(tilecache, &viewport, z, &touches);
tilecache_tiles_for_rect(tilecache, viewport, z, &touches);

#ifdef DEBUG_VERBOSE
printf("viewport in level0 coordinates: left = %d, top = %d, "
Expand Down Expand Up @@ -839,15 +837,15 @@ tilecache_draw_bounds(GtkSnapshot *snapshot,
static void
tilecache_snap_rect(graphene_rect_t *bounds)
{
double left = rint(bounds->origin.x);
double top = rint(bounds->origin.y);
double right = rint(bounds->origin.x + bounds->size.width);
double bottom = rint(bounds->origin.y + bounds->size.height);

bounds->origin.x = left;
bounds->origin.y = top;
bounds->size.width = right - left;
bounds->size.height = bottom - top;
double left = rint(bounds->origin.x);
double top = rint(bounds->origin.y);
double right = rint(bounds->origin.x + bounds->size.width);
double bottom = rint(bounds->origin.y + bounds->size.height);

bounds->origin.x = left;
bounds->origin.y = top;
bounds->size.width = right - left;
bounds->size.height = bottom - top;
}
#endif /*!HAVE_GTK_SNAPSHOT_SET_SNAP*/

Expand Down Expand Up @@ -907,18 +905,21 @@ tilecache_snapshot(Tilecache *tilecache, GtkSnapshot *snapshot,

/* paint_rect in level0 coordinates.
*/
graphene_rect_t viewport;
viewport.origin.x = x / scale;
viewport.origin.y = y / scale;
viewport.size.width = VIPS_MAX(1, paint->size.width / scale);
viewport.size.height = VIPS_MAX(1, paint->size.height / scale);
double left = floor(x / scale);
double top = floor(y / scale);
double right = ceil((x + paint->size.width) / scale);
double bottom = ceil((y + paint->size.height) / scale);

VipsRect viewport;
viewport.left = left;
viewport.top = top;
viewport.width = VIPS_MAX(1, right - left);
viewport.height = VIPS_MAX(1, bottom - top);

/* Fetch any tiles we are missing, update any tiles we have that have
* been flagged as having pixels ready for fetching.
*/
VipsRect bounds;
tilecache_request_area(tilecache,
rect_graphene_to_vips(&viewport, &bounds), z);
tilecache_request_area(tilecache, &viewport, z);

/* Find the set of visible tiles, sorted back to front.
*
Expand Down Expand Up @@ -987,10 +988,10 @@ tilecache_snapshot(Tilecache *tilecache, GtkSnapshot *snapshot,

gsk_rounded_rect_init_from_rect(&outline,
&GRAPHENE_RECT_INIT(
viewport.origin.x * scale - x + paint->origin.x,
viewport.origin.y * scale - y + paint->origin.y,
viewport.size.width * scale,
viewport.size.height * scale),
viewport.left * scale - x + paint->origin.x,
viewport.top * scale - y + paint->origin.y,
viewport.width * scale,
viewport.height * scale),
0);

gtk_snapshot_append_border(snapshot,
Expand Down