Changes between Version 1 and Version 2 of Ticket #19330, comment 2


Ignore:
Timestamp:
Jan 1, 2025, 6:22:37 PM (5 weeks ago)
Author:
grexe

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #19330, comment 2

    v1 v2  
    11I implemented this like so:
    22{{{
    3     BRegion* region = param->region;
    4     int32 regionRects = region->CountRects();
    5     BPoint points[regionRects * 4];
     3BRegion* region; // input
     4int32 regionRects = region->CountRects();
     5BPoint points[regionRects * 4];
    66
    7     for (int32 rectNum = 0; rectNum < regionRects; rectNum++) {
    8         int32 rectPoint = 0;
    9         BRect rect = region->RectAt(rectNum);
    10         points[rectPoint++] = rect.LeftTop();
    11         points[rectPoint++] = rect.RightTop();
    12         points[rectPoint++] = rect.RightBottom();
    13         points[rectPoint++] = rect.LeftBottom();
    14     }
    15     BPolygon poly(points, regionRects * 4);
    16     StrokePolygon(&poly);
     7for (int32 rectNum = 0; rectNum < regionRects; rectNum++) {
     8    int32 rectPoint = 0;
     9    BRect rect = region->RectAt(rectNum);
     10
     11    points[rectPoint++] = rect.LeftTop();
     12    points[rectPoint++] = rect.RightTop();
     13    points[rectPoint++] = rect.RightBottom();
     14    points[rectPoint++] = rect.LeftBottom();
     15}
     16BPolygon poly(points, regionRects * 4);
     17StrokePolygon(&poly);
    1718}}}