File indexing completed on 2024-12-22 04:14:58
0001 /* 0002 * SPDX-FileCopyrightText: 2020 Saurabh Kumar <saurabhk660@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "KisAsyncStoryboardThumbnailRenderer.h" 0008 #include "kis_image_animation_interface.h" 0009 #include "kis_image.h" 0010 0011 KisAsyncStoryboardThumbnailRenderer::KisAsyncStoryboardThumbnailRenderer(QObject *parent) 0012 : KisAsyncAnimationRendererBase(parent) 0013 { 0014 connect(this, SIGNAL(sigNotifyFrameCompleted(int)), SLOT(notifyFrameCompleted(int)), Qt::QueuedConnection); 0015 connect(this, 0016 SIGNAL(sigNotifyFrameCancelled(int, KisAsyncAnimationRendererBase::CancelReason)), 0017 SLOT(notifyFrameCancelled(int, KisAsyncAnimationRendererBase::CancelReason)), Qt::QueuedConnection); 0018 } 0019 0020 KisAsyncStoryboardThumbnailRenderer::~KisAsyncStoryboardThumbnailRenderer() 0021 { 0022 } 0023 0024 void KisAsyncStoryboardThumbnailRenderer::frameCompletedCallback(int frameTime, const KisRegion &/*requestedRegion*/) 0025 { 0026 KisImageSP image = requestedImage(); 0027 KisPaintDeviceSP requestedFrame = image ? new KisPaintDevice(*image->projection(), KritaUtils::CopySnapshot) : nullptr; 0028 0029 if (requestedFrame) { 0030 emit sigNotifyFrameCompleted(frameTime); 0031 emit sigNotifyFrameCompleted(frameTime, requestedFrame); 0032 } else { 0033 emit sigNotifyFrameCancelled(frameTime, KisAsyncAnimationRendererBase::RenderingFailed); 0034 } 0035 } 0036 0037 void KisAsyncStoryboardThumbnailRenderer::frameCancelledCallback(int frame, CancelReason cancelReason) 0038 { 0039 emit sigNotifyFrameCancelled(frame, cancelReason); 0040 } 0041 0042 void KisAsyncStoryboardThumbnailRenderer::clearFrameRegenerationState(bool isCancelled) 0043 { 0044 KisAsyncAnimationRendererBase::clearFrameRegenerationState(isCancelled); 0045 }