2012-07-11 00:48:30 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2012 by Mailson Menezes <mailson@gmail.com> *
|
|
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
|
|
* it under the terms of the GNU General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
|
|
* (at your option) any later version. *
|
|
|
|
***************************************************************************/
|
|
|
|
|
2012-07-07 17:40:52 +00:00
|
|
|
#ifndef _OKULAR_TILES_MANAGER_H_
|
|
|
|
#define _OKULAR_TILES_MANAGER_H_
|
|
|
|
|
|
|
|
#include "okular_export.h"
|
|
|
|
#include "area.h"
|
|
|
|
|
2012-08-04 21:00:19 +00:00
|
|
|
#define TILES_MAXSIZE 2000000
|
|
|
|
|
2012-07-07 17:40:52 +00:00
|
|
|
class QPixmap;
|
|
|
|
|
|
|
|
namespace Okular {
|
|
|
|
|
2012-07-11 05:14:50 +00:00
|
|
|
class OKULAR_EXPORT Tile
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
Tile();
|
|
|
|
|
|
|
|
bool isValid() const;
|
|
|
|
|
|
|
|
NormalizedRect rect;
|
|
|
|
QPixmap *pixmap;
|
|
|
|
uint dirty : 1;
|
2012-08-04 21:00:19 +00:00
|
|
|
|
|
|
|
Tile *tiles;
|
|
|
|
int nTiles;
|
2012-08-13 04:09:05 +00:00
|
|
|
|
|
|
|
Tile *parent;
|
|
|
|
int miss;
|
2012-07-11 05:14:50 +00:00
|
|
|
};
|
2012-07-07 17:40:52 +00:00
|
|
|
|
|
|
|
class OKULAR_EXPORT TilesManager
|
|
|
|
{
|
|
|
|
public:
|
2012-08-17 17:25:58 +00:00
|
|
|
TilesManager( int width, int height, Rotation rotation = Rotation0 );
|
2012-07-07 17:40:52 +00:00
|
|
|
virtual ~TilesManager();
|
|
|
|
|
2012-07-12 05:20:03 +00:00
|
|
|
void setPixmap( const QPixmap *pixmap, const NormalizedRect &rect );
|
2012-07-07 17:40:52 +00:00
|
|
|
bool hasPixmap( const NormalizedRect &rect );
|
2012-08-13 04:09:05 +00:00
|
|
|
QList<Tile> tilesAt( const NormalizedRect &rect );
|
2012-07-16 15:57:51 +00:00
|
|
|
long totalMemory() const;
|
2012-08-13 04:09:05 +00:00
|
|
|
void cleanupPixmapMemory( qulonglong numberOfBytes = 1 );
|
2012-07-07 17:40:52 +00:00
|
|
|
|
2012-08-04 21:00:19 +00:00
|
|
|
int width() const;
|
2012-07-11 05:14:50 +00:00
|
|
|
void setWidth( int width );
|
2012-08-04 21:00:19 +00:00
|
|
|
int height() const;
|
2012-07-11 05:14:50 +00:00
|
|
|
void setHeight( int height );
|
2012-08-17 17:25:58 +00:00
|
|
|
Rotation rotation() const;
|
|
|
|
void setRotation( Rotation rotation );
|
|
|
|
|
|
|
|
static NormalizedRect toRotatedRect( const NormalizedRect &rect, Rotation rotation );
|
|
|
|
static NormalizedRect fromRotatedRect( const NormalizedRect &rect, Rotation rotation );
|
2012-07-07 17:40:52 +00:00
|
|
|
|
|
|
|
private:
|
2012-08-04 21:00:19 +00:00
|
|
|
class Private;
|
|
|
|
Private * const d;
|
|
|
|
friend class Private;
|
2012-07-07 17:40:52 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // _OKULAR_TILES_MANAGER_H_
|