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 @@ -538,18 +538,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 @@ -109,5 +109,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);
33 changes: 17 additions & 16 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 @@ -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