2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2006-11-03 17:57:32 +00:00
|
|
|
|
2007-07-15 13:53:26 +00:00
|
|
|
#ifndef _OKULAR_ROTATIONJOB_P_H_
|
|
|
|
#define _OKULAR_ROTATIONJOB_P_H_
|
2006-11-03 17:57:32 +00:00
|
|
|
|
2018-08-31 09:23:45 +00:00
|
|
|
#include <QImage>
|
|
|
|
#include <QTransform>
|
2006-11-03 17:57:32 +00:00
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
#include <threadweaver/job.h>
|
|
|
|
#include <threadweaver/qobjectdecorator.h>
|
2007-07-04 16:55:33 +00:00
|
|
|
|
2012-08-17 17:25:58 +00:00
|
|
|
#include "core/area.h"
|
2007-01-05 17:09:47 +00:00
|
|
|
#include "core/global.h"
|
|
|
|
|
2006-11-03 17:57:32 +00:00
|
|
|
namespace Okular
|
|
|
|
{
|
2013-02-24 21:58:53 +00:00
|
|
|
class DocumentObserver;
|
2007-03-24 10:47:22 +00:00
|
|
|
class PagePrivate;
|
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
class RotationJobInternal : public ThreadWeaver::Job
|
2006-11-03 17:57:32 +00:00
|
|
|
{
|
2014-08-09 18:44:25 +00:00
|
|
|
friend class RotationJob;
|
|
|
|
|
|
|
|
public:
|
|
|
|
QImage image() const;
|
|
|
|
Rotation rotation() const;
|
|
|
|
NormalizedRect rect() const;
|
|
|
|
|
2020-02-21 15:11:42 +00:00
|
|
|
RotationJobInternal(const RotationJobInternal &) = delete;
|
|
|
|
RotationJobInternal &operator=(const RotationJobInternal &) = delete;
|
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
protected:
|
2017-03-02 19:39:24 +00:00
|
|
|
void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override;
|
2014-08-09 18:44:25 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
RotationJobInternal(const QImage &image, Rotation oldRotation, Rotation newRotation);
|
|
|
|
|
|
|
|
const QImage mImage;
|
|
|
|
Rotation mOldRotation;
|
|
|
|
Rotation mNewRotation;
|
|
|
|
QImage mRotatedImage;
|
|
|
|
};
|
2007-03-24 10:47:22 +00:00
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
class RotationJob : public ThreadWeaver::QObjectDecorator
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
2006-11-03 17:57:32 +00:00
|
|
|
public:
|
2013-02-24 21:58:53 +00:00
|
|
|
RotationJob(const QImage &image, Rotation oldRotation, Rotation newRotation, DocumentObserver *observer);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2007-03-24 10:47:22 +00:00
|
|
|
void setPage(PagePrivate *pd);
|
2012-08-17 17:25:58 +00:00
|
|
|
void setRect(const NormalizedRect &rect);
|
2018-02-01 18:42:37 +00:00
|
|
|
void setIsPartialUpdate(bool partialUpdate);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2014-08-09 18:44:25 +00:00
|
|
|
QImage image() const
|
|
|
|
{
|
|
|
|
return static_cast<const RotationJobInternal *>(job())->image();
|
|
|
|
}
|
|
|
|
Rotation rotation() const
|
|
|
|
{
|
|
|
|
return static_cast<const RotationJobInternal *>(job())->rotation();
|
2020-07-10 22:15:05 +00:00
|
|
|
}
|
2013-02-24 21:58:53 +00:00
|
|
|
DocumentObserver *observer() const;
|
2007-03-24 10:47:22 +00:00
|
|
|
PagePrivate *page() const;
|
2012-08-17 17:25:58 +00:00
|
|
|
NormalizedRect rect() const;
|
2018-02-01 18:42:37 +00:00
|
|
|
bool isPartialUpdate() const;
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2012-09-08 15:06:02 +00:00
|
|
|
static QTransform rotationMatrix(Rotation from, Rotation to);
|
2020-07-10 22:15:05 +00:00
|
|
|
|
2006-11-03 17:57:32 +00:00
|
|
|
private:
|
2013-02-24 21:58:53 +00:00
|
|
|
DocumentObserver *mObserver;
|
2007-03-24 10:47:22 +00:00
|
|
|
PagePrivate *m_pd;
|
2012-08-17 17:25:58 +00:00
|
|
|
NormalizedRect mRect;
|
2018-02-01 18:42:37 +00:00
|
|
|
bool mIsPartialUpdate;
|
2006-11-03 17:57:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|