okular/core/rotationjob_p.h

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

83 lines
1.9 KiB
C
Raw Normal View History

2021-05-24 07:25:56 +00:00
/*
SPDX-FileCopyrightText: 2006 Tobias Koenig <tokoe@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef _OKULAR_ROTATIONJOB_P_H_
#define _OKULAR_ROTATIONJOB_P_H_
2018-08-31 09:23:45 +00:00
#include <QImage>
#include <QTransform>
#include <threadweaver/job.h>
#include <threadweaver/qobjectdecorator.h>
2012-08-17 17:25:58 +00:00
#include "core/area.h"
#include "core/global.h"
namespace Okular
{
class DocumentObserver;
class PagePrivate;
class RotationJobInternal : public ThreadWeaver::Job
{
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;
protected:
2017-03-02 19:39:24 +00:00
void run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *thread) override;
private:
RotationJobInternal(const QImage &image, Rotation oldRotation, Rotation newRotation);
const QImage mImage;
Rotation mOldRotation;
Rotation mNewRotation;
QImage mRotatedImage;
};
class RotationJob : public ThreadWeaver::QObjectDecorator
{
Q_OBJECT
public:
RotationJob(const QImage &image, Rotation oldRotation, Rotation newRotation, DocumentObserver *observer);
void setPage(PagePrivate *pd);
2012-08-17 17:25:58 +00:00
void setRect(const NormalizedRect &rect);
void setIsPartialUpdate(bool partialUpdate);
QImage image() const
{
return static_cast<const RotationJobInternal *>(job())->image();
}
Rotation rotation() const
{
return static_cast<const RotationJobInternal *>(job())->rotation();
}
DocumentObserver *observer() const;
PagePrivate *page() const;
2012-08-17 17:25:58 +00:00
NormalizedRect rect() const;
bool isPartialUpdate() const;
static QTransform rotationMatrix(Rotation from, Rotation to);
private:
DocumentObserver *mObserver;
PagePrivate *m_pd;
2012-08-17 17:25:58 +00:00
NormalizedRect mRect;
bool mIsPartialUpdate;
};
}
#endif