1// Aseprite
2// Copyright (C) 2017 David Capello
3//
4// This program is distributed under the terms of
5// the End-User License Agreement for Aseprite.
6
7#ifdef HAVE_CONFIG_H
8#include "config.h"
9#endif
10
11#include "app/sprite_job.h"
12
13namespace app {
14
15SpriteJob::SpriteJob(const ContextReader& reader, const char* jobName)
16 : Job(jobName)
17 , m_writer(reader, 500)
18 , m_document(m_writer.document())
19 , m_sprite(m_writer.sprite())
20 , m_tx(m_writer.context(), jobName, ModifyDocument)
21{
22}
23
24SpriteJob::~SpriteJob()
25{
26 if (!isCanceled())
27 m_tx.commit();
28}
29
30void SpriteJob::onJob()
31{
32 m_callback();
33}
34
35bool SpriteJob::continueTask()
36{
37 return !isCanceled();
38}
39
40void SpriteJob::notifyTaskProgress(double progress)
41{
42 jobProgress(progress);
43}
44
45} // namespace app
46