MCPcopy Create free account
hub / github.com/LibreSprite/LibreSprite / dispose

Method dispose

src/app/ui/editor/tool_loop_impl.cpp:399–443  ·  view source on GitHub ↗

IToolLoop interface

Source from the content-addressed store, hash-verified

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

Callers 7

destroyLoopMethod · 0.45
clearMethod · 0.45
~SkinThemeMethod · 0.45
loadSheetMethod · 0.45
sliceSheetMethod · 0.45

Calls 6

isPaintMethod · 0.45
commitMethod · 0.45
isSelectionMethod · 0.45
rollbackMethod · 0.45

Tested by

no test coverage detected