Changeset 202:3313d5e8d23c

Show
Ignore:
Timestamp:
03/08/08 10:32:26 (7 months ago)
Author:
Frank Benoit <benoit@tionex.de>
branch:
default
Message:

removed some heap allocs

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • dwt/graphics/GC.d

    r200 r202  
    396396    GdkRectangle* rects; 
    397397    OS.gdk_region_get_rectangles(rgn, &rects, &nRects); 
    398     GdkRectangle* rect = new GdkRectangle()
    399     int[] pointArray = new int[8]
     398    GdkRectangle* rect
     399    int[8] pointArray
    400400    double x, y; 
    401401    for (int i=0; i<nRects; i++) { 
    402         *rect = rects[i]
     402        rect = rects +i
    403403        x = rect.x; 
    404404        y = rect.y; 
     
    504504        OS.gdk_gc_set_exposures(handle, false); 
    505505        bool disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY); 
    506         GdkRectangle* rect = new GdkRectangle ()
     506        GdkRectangle rect
    507507        if (disjoint) { 
    508508            rect.x = srcX; 
     
    510510            rect.width = width; 
    511511            rect.height = height; 
    512             OS.gdk_window_invalidate_rect (cast(GdkWindow*)drawable, rect, false); 
     512            OS.gdk_window_invalidate_rect (cast(GdkWindow*)drawable, &rect, false); 
    513513//          OS.gdk_window_clear_area_e(drawable, srcX, srcY, width, height); 
    514514        } else { 
     
    520520                rect.width = Math.abs(deltaX); 
    521521                rect.height = height; 
    522                 OS.gdk_window_invalidate_rect (cast(GdkWindow*)drawable, rect, false); 
     522                OS.gdk_window_invalidate_rect (cast(GdkWindow*)drawable, &rect, false); 
    523523//              OS.gdk_window_clear_area_e(drawable, newX, srcY, Math.abs(deltaX), height); 
    524524            } 
     
    530530                rect.width = width; 
    531531                rect.height = Math.abs(deltaY); 
    532                 OS.gdk_window_invalidate_rect (cast(GdkWindow*)drawable, rect, false); 
     532                OS.gdk_window_invalidate_rect (cast(GdkWindow*)drawable, &rect, false); 
    533533//              OS.gdk_window_clear_area_e(drawable, srcX, newY, width, Math.abs(deltaY)); 
    534534            } 
     
    11021102        GdkRectangle* rects; 
    11031103        OS.gdk_region_get_rectangles(clipping, &rects, &nRects); 
    1104         GdkRectangle* rect = new GdkRectangle()
     1104        GdkRectangle* rect
    11051105        short[] xRects = new short[nRects * 4]; 
    11061106        for (int i=0, j=0; i<nRects; i++, j+=4) { 
    1107             *rect = rects[i]
    1108             xRects[j] = cast(short)rect.x; 
     1107            rect = rects +i
     1108            xRects[j  ] = cast(short)rect.x; 
    11091109            xRects[j+1] = cast(short)rect.y; 
    11101110            xRects[j+2] = cast(short)rect.width; 
     
    22942294    if (clipRgn !is null || damageRgn !is null || cairo !is null) { 
    22952295        auto rgn = OS.gdk_region_new(); 
    2296         GdkRectangle* rect = new GdkRectangle()
     2296        GdkRectangle rect
    22972297        rect.width = width; 
    22982298        rect.height = height; 
    2299         OS.gdk_region_union_with_rect(rgn, rect); 
     2299        OS.gdk_region_union_with_rect(rgn, &rect); 
    23002300        if (damageRgn !is null) { 
    23012301            OS.gdk_region_intersect (rgn, damageRgn); 
     
    23212321            rgn = clipRgn; 
    23222322        } 
    2323         OS.gdk_region_get_clipbox(rgn, rect); 
     2323        OS.gdk_region_get_clipbox(rgn, &rect); 
    23242324        OS.gdk_region_destroy(rgn); 
    23252325        x = rect.x; 
     
    23562356        int width,height; 
    23572357        OS.gdk_drawable_get_size(data.drawable, &width, &height); 
    2358         GdkRectangle* rect = new GdkRectangle()
     2358        GdkRectangle rect
    23592359        rect.width = width; 
    23602360        rect.height = height; 
    2361         OS.gdk_region_union_with_rect(clipping, rect); 
     2361        OS.gdk_region_union_with_rect(clipping, &rect); 
    23622362    } else { 
    23632363        /* Convert clipping to device space if needed */ 
     
    30803080        GdkRectangle * rects; 
    30813081        OS.gdk_region_get_rectangles(clipRgn, &rects, &nRects); 
    3082         GdkRectangle* rect = new GdkRectangle(); 
     3082        //GdkRectangle* rect = new GdkRectangle(); 
    30833083        for (int i=0; i<nRects; i++) { 
    30843084            Cairo.cairo_rectangle(cairo, rects[i].x, rects[i].y, rects[i].width, rects[i].height); 
     
    31573157        height = -height; 
    31583158    } 
    3159     GdkRectangle* rect = new GdkRectangle()
     3159    GdkRectangle rect
    31603160    rect.x = x; 
    31613161    rect.y = y; 
     
    31633163    rect.height = height; 
    31643164    auto clipRgn = OS.gdk_region_new(); 
    3165     OS.gdk_region_union_with_rect(clipRgn, rect); 
     3165    OS.gdk_region_union_with_rect(clipRgn, &rect); 
    31663166    setClipping(clipRgn); 
    31673167    OS.gdk_region_destroy(clipRgn);