// pr_tile_free_all(source);
}
-void pixbuf_renderer_area_changed(PixbufRenderer *pr, gint src_x, gint src_y, gint src_w, gint src_h)
+void pixbuf_renderer_area_changed(PixbufRenderer *pr, gint x, gint y, gint w, gint h)
{
- gint x, y, width, height, x1, y1, x2, y2;
-
g_return_if_fail(IS_PIXBUF_RENDERER(pr));
- pr_coords_map_orientation_reverse(pr->orientation,
- src_x, src_y,
- pr->image_width, pr->image_height,
- src_w, src_h,
- &x, &y,
- &width, &height);
-
if (pr->source_tiles_enabled)
{
- pr_source_tile_changed(pr, x, y, width, height);
- }
-
- if (pr->scale != 1.0 && pr->zoom_quality != GDK_INTERP_NEAREST)
- {
- /* increase region when using a zoom quality that may access surrounding pixels */
- y -= 1;
- height += 2;
+ pr_source_tile_changed(pr, x, y, w, h);
}
- x1 = (gint)floor((gdouble)x * pr->scale);
- y1 = (gint)floor((gdouble)y * pr->scale * pr->aspect_ratio);
- x2 = (gint)ceil((gdouble)(x + width) * pr->scale);
- y2 = (gint)ceil((gdouble)(y + height) * pr->scale * pr->aspect_ratio);
-
- pr->renderer->queue(pr->renderer, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE, TRUE);
- if (pr->renderer2) pr->renderer2->queue(pr->renderer2, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE, TRUE);
+ pr->renderer->area_changed(pr->renderer, x, y, w, h);
+ if (pr->renderer2) pr->renderer2->area_changed(pr->renderer2, x, y, w, h);
}
void pixbuf_renderer_zoom_adjust(PixbufRenderer *pr, gdouble increment)
}
+static gint rt_get_orientation(RendererTiles *rt)
+{
+ PixbufRenderer *pr = rt->pr;
+
+ gint orientation = pr->orientation;
+ static const gint mirror[] = {1, 2, 1, 4, 3, 6, 5, 8, 7};
+ static const gint flip[] = {1, 4, 3, 2, 1, 8, 7, 6, 5};
+
+ if (rt->stereo_mode & PR_STEREO_MIRROR) orientation = mirror[orientation];
+ if (rt->stereo_mode & PR_STEREO_FLIP) orientation = flip[orientation];
+ return orientation;
+}
static void rt_tile_render(RendererTiles *rt, ImageTile *it,
GtkWidget *box;
gboolean has_alpha;
gboolean draw = FALSE;
- gint orientation = pr->orientation;
- static const gint mirror[] = {1, 2, 1, 4, 3, 6, 5, 8, 7};
- static const gint flip[] = {1, 4, 3, 2, 1, 8, 7, 6, 5};
+ gint orientation = rt_get_orientation(rt);
if (it->render_todo == TILE_RENDER_NONE && it->pixmap && !new_data) return;
rt_tile_prepare(rt, it);
has_alpha = (pr->pixbuf && gdk_pixbuf_get_has_alpha(pr->pixbuf));
- if (rt->stereo_mode & PR_STEREO_MIRROR) orientation = mirror[orientation];
- if (rt->stereo_mode & PR_STEREO_FLIP) orientation = flip[orientation];
box = GTK_WIDGET(pr);
/* FIXME checker colors for alpha should be configurable,
}
}
+static void renderer_area_changed(void *renderer, gint src_x, gint src_y, gint src_w, gint src_h)
+{
+ RendererTiles *rt = (RendererTiles *)renderer;
+ PixbufRenderer *pr = rt->pr;
+ gint x, y, width, height, x1, y1, x2, y2;
+
+ gint orientation = rt_get_orientation(rt);
+ pr_coords_map_orientation_reverse(orientation,
+ src_x - GET_RIGHT_PIXBUF_OFFSET(rt), src_y,
+ pr->image_width, pr->image_height,
+ src_w, src_h,
+ &x, &y,
+ &width, &height);
+
+ if (pr->scale != 1.0 && pr->zoom_quality != GDK_INTERP_NEAREST)
+ {
+ /* increase region when using a zoom quality that may access surrounding pixels */
+ y -= 1;
+ height += 2;
+ }
+
+ x1 = (gint)floor((gdouble)x * pr->scale);
+ y1 = (gint)floor((gdouble)y * pr->scale * pr->aspect_ratio);
+ x2 = (gint)ceil((gdouble)(x + width) * pr->scale);
+ y2 = (gint)ceil((gdouble)(y + height) * pr->scale * pr->aspect_ratio);
+
+ rt_queue(rt, x1, y1, x2 - x1, y2 - y1, FALSE, TILE_RENDER_AREA, TRUE, TRUE);
+}
+
static void renderer_queue(void *renderer, gint x, gint y, gint w, gint h,
gint clamp, ImageRenderType render, gboolean new_data, gboolean only_existing)
{
rt->pr = pr;
rt->f.queue = renderer_queue;
+ rt->f.area_changed = renderer_area_changed;
rt->f.queue_clear = renderer_queue_clear;
rt->f.border_draw = renderer_border_draw;
rt->f.free = renderer_free;