IToolLoop interface
| 397 | |
| 398 | // IToolLoop interface |
| 399 | void dispose() override |
| 400 | { |
| 401 | bool redraw = false; |
| 402 | |
| 403 | if (!m_canceled) { |
| 404 | // Paint ink |
| 405 | if (getInk()->isPaint()) { |
| 406 | try { |
| 407 | ContextReader reader(m_context, 500); |
| 408 | ContextWriter writer(reader, 500); |
| 409 | m_expandCelCanvas->commit(); |
| 410 | } |
| 411 | catch (const LockedDocumentException& ex) { |
| 412 | Console::showException(ex); |
| 413 | } |
| 414 | } |
| 415 | // Selection ink |
| 416 | else if (getInk()->isSelection()) { |
| 417 | m_document->generateMaskBoundaries(); |
| 418 | redraw = true; |
| 419 | |
| 420 | // Show selection edges |
| 421 | m_docPref.show.selectionEdges(true); |
| 422 | } |
| 423 | |
| 424 | m_transaction.commit(); |
| 425 | } |
| 426 | else |
| 427 | redraw = true; |
| 428 | |
| 429 | // If the trace was canceled or it is not a 'paint' ink... |
| 430 | if (m_canceled || !getInk()->isPaint()) { |
| 431 | try { |
| 432 | ContextReader reader(m_context, 500); |
| 433 | ContextWriter writer(reader, 500); |
| 434 | m_expandCelCanvas->rollback(); |
| 435 | } |
| 436 | catch (const LockedDocumentException& ex) { |
| 437 | Console::showException(ex); |
| 438 | } |
| 439 | } |
| 440 | |
| 441 | if (redraw) |
| 442 | update_screen_for_document(m_document); |
| 443 | } |
| 444 | |
| 445 | const Image* getSrcImage() override { return m_expandCelCanvas->getSourceCanvas(); } |
| 446 | const Image* getFloodFillSrcImage() override { return m_floodfillSrcImage; } |
no test coverage detected