Crops the cel image leaving the same ID in the image.
| 42 | |
| 43 | // Crops the cel image leaving the same ID in the image. |
| 44 | void CropCel::cropImage(const gfx::Point& origin, |
| 45 | const gfx::Rect& bounds) |
| 46 | { |
| 47 | auto cel = this->cel(); |
| 48 | |
| 49 | if (bounds != cel->image()->bounds()) { |
| 50 | ImageRef image(crop_image(cel->image(), |
| 51 | bounds.x, bounds.y, |
| 52 | bounds.w, bounds.h, |
| 53 | cel->image()->maskColor())); |
| 54 | ObjectId id = cel->image()->id(); |
| 55 | ObjectVersion ver = cel->image()->version(); |
| 56 | |
| 57 | cel->image()->setId(NullId); |
| 58 | image->setId(id); |
| 59 | image->setVersion(ver); |
| 60 | image->incrementVersion(); |
| 61 | cel->data()->setImage(image); |
| 62 | cel->incrementVersion(); |
| 63 | } |
| 64 | |
| 65 | if (cel->data()->position() != origin) { |
| 66 | cel->data()->setPosition(origin); |
| 67 | cel->incrementVersion(); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | } // namespace cmd |
| 72 | } // namespace app |
nothing calls this directly
no test coverage detected