Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

static bool sp_canvas_paint_rect ( SPCanvas canvas,
int  xx0,
int  yy0,
int  xx1,
int  yy1 
) [static]

Helper that draws a specific rectangular part of the canvas.

Returns:
true if the rectangle painting succeeds.

Definition at line 1861 of file sp-canvas.cpp.

References sp_canvas_paint_rect_internal(), and sp_canvas_window_to_world().

Referenced by paint().

{
    g_return_val_if_fail (!canvas->need_update, false);

    NRRectL rect;
    rect.x0 = xx0;
    rect.x1 = xx1;
    rect.y0 = yy0;
    rect.y1 = yy1;

    // Clip rect-to-draw by the current visible area
    rect.x0 = MAX (rect.x0, canvas->x0);
    rect.y0 = MAX (rect.y0, canvas->y0);
    rect.x1 = MIN (rect.x1, canvas->x0/*draw_x1*/ + GTK_WIDGET (canvas)->allocation.width);
    rect.y1 = MIN (rect.y1, canvas->y0/*draw_y1*/ + GTK_WIDGET (canvas)->allocation.height);

#ifdef DEBUG_REDRAW
    // paint the area to redraw yellow
    gdk_rgb_gc_set_foreground (canvas->pixmap_gc, 0xFFFF00);
    gdk_draw_rectangle (SP_CANVAS_WINDOW (canvas),
                        canvas->pixmap_gc,
                        TRUE,
                        rect.x0 - canvas->x0, rect.y0 - canvas->y0,
                        rect.x1 - rect.x0, rect.y1 - rect.y0);
#endif

    PaintRectSetup setup;

    setup.canvas = canvas;
    setup.big_rect = rect;

    // Save the mouse location
    gint x, y;
    gdk_window_get_pointer (GTK_WIDGET(canvas)->window, &x, &y, NULL);
    setup.mouse_loc = sp_canvas_window_to_world (canvas, Geom::Point(x,y));

    if (canvas->rendermode != Inkscape::RENDERMODE_OUTLINE) {
        // use 256K as a compromise to not slow down gradients
        // 256K is the cached buffer and we need 4 channels
        setup.max_pixels = 65536; // 256K/4
    } else {
        // paths only, so 1M works faster
        // 1M is the cached buffer and we need 4 channels
        setup.max_pixels = 262144;
    }

    // Start the clock
    g_get_current_time(&(setup.start_time));

    // Go
    return sp_canvas_paint_rect_internal(&setup, rect);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index