static void set_clipping_rects(void* _context, size_t numRects, const BRect rects[]) { DrawingContext* context = reinterpret_cast<DrawingContext *>(_context); // TODO: This might be too slow, we should copy the rects // directly to BRegion's internal data BRegion region; for (uint32 c = 0; c < numRects; c++) region.Include(rects[c]); context->SetUserClipping(®ion); context->UpdateCurrentDrawingRegion(); }
static void clip_to_picture(void* _context, int32 pictureToken, const BPoint& where, bool clipToInverse) { DrawingContext* context = reinterpret_cast<DrawingContext *>(_context); ServerPicture* picture = context->GetPicture(pictureToken); if (picture == NULL) return; AlphaMask* mask = new(std::nothrow) AlphaMask( picture, clipToInverse, where, *context->CurrentState()); context->SetAlphaMask(mask); context->UpdateCurrentDrawingRegion(); if (mask != NULL) mask->ReleaseReference(); picture->ReleaseReference(); }