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(); }