• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegraphics API Reference
  • KDE Home
  • Contact Us
 

okular

  • sources
  • kde-4.12
  • kdegraphics
  • okular
  • core
tilesmanager.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2012 by Mailson Menezes <mailson@gmail.com> *
3  * This program is free software; you can redistribute it and/or modify *
4  * it under the terms of the GNU General Public License as published by *
5  * the Free Software Foundation; either version 2 of the License, or *
6  * (at your option) any later version. *
7  ***************************************************************************/
8 
9 #include "tilesmanager_p.h"
10 
11 #include <QPixmap>
12 #include <QtCore/qmath.h>
13 #include <QList>
14 #include <QPainter>
15 
16 #include "tile.h"
17 
18 #define TILES_MAXSIZE 2000000
19 
20 using namespace Okular;
21 
22 static bool rankedTilesLessThan( TileNode *t1, TileNode *t2 )
23 {
24  // Order tiles by its dirty state and then by distance from the viewport.
25  if ( t1->dirty == t2->dirty )
26  return t1->distance < t2->distance;
27 
28  return !t1->dirty;
29 }
30 
31 class TilesManager::Private
32 {
33  public:
34  Private();
35 
36  bool hasPixmap( const NormalizedRect &rect, const TileNode &tile ) const;
37  void tilesAt( const NormalizedRect &rect, TileNode &tile, QList<Tile> &result, TileLeaf tileLeaf );
38  void setPixmap( const QPixmap *pixmap, const NormalizedRect &rect, TileNode &tile );
39 
43  static void markDirty( TileNode &tile );
44 
48  void deleteTiles( const TileNode &tile );
49 
50  void markParentDirty( const TileNode &tile );
51  void rankTiles( TileNode &tile, QList<TileNode*> &rankedTiles, const NormalizedRect &visibleRect, int visiblePageNumber );
59  void split( TileNode &tile, const NormalizedRect &rect );
60 
66  bool splitBigTiles( TileNode &tile, const NormalizedRect &rect );
67 
68  // The page is split in a 4x4 grid of tiles
69  TileNode tiles[16];
70  int width;
71  int height;
72  int pageNumber;
73  qulonglong totalPixels;
74  Rotation rotation;
75  NormalizedRect visibleRect;
76  NormalizedRect requestRect;
77  int requestWidth;
78  int requestHeight;
79 };
80 
81 TilesManager::Private::Private()
82  : width( 0 )
83  , height( 0 )
84  , pageNumber( 0 )
85  , totalPixels( 0 )
86  , rotation( Rotation0 )
87  , requestRect( NormalizedRect() )
88  , requestWidth( 0 )
89  , requestHeight( 0 )
90 {
91 }
92 
93 TilesManager::TilesManager( int pageNumber, int width, int height, Rotation rotation )
94  : d( new Private )
95 {
96  d->pageNumber = pageNumber;
97  d->width = width;
98  d->height = height;
99  d->rotation = rotation;
100 
101  // The page is split in a 4x4 grid of tiles
102  const double dim = 0.25;
103  for ( int i = 0; i < 16; ++i )
104  {
105  int x = i % 4;
106  int y = i / 4;
107  d->tiles[ i ].rect = NormalizedRect( x*dim, y*dim, x*dim+dim, y*dim+dim );
108  }
109 }
110 
111 TilesManager::~TilesManager()
112 {
113  for ( int i = 0; i < 16; ++i )
114  d->deleteTiles( d->tiles[ i ] );
115 
116  delete d;
117 }
118 
119 void TilesManager::Private::deleteTiles( const TileNode &tile )
120 {
121  if ( tile.pixmap )
122  {
123  totalPixels -= tile.pixmap->width()*tile.pixmap->height();
124  delete tile.pixmap;
125  }
126 
127  if ( tile.nTiles > 0 )
128  {
129  for ( int i = 0; i < tile.nTiles; ++i )
130  deleteTiles( tile.tiles[ i ] );
131 
132  delete [] tile.tiles;
133  }
134 }
135 
136 void TilesManager::setSize( int width, int height )
137 {
138  if ( width == d->width && height == d->height )
139  return;
140 
141  d->width = width;
142  d->height = height;
143 
144  markDirty();
145 }
146 
147 int TilesManager::width() const
148 {
149  return d->width;
150 }
151 
152 int TilesManager::height() const
153 {
154  return d->height;
155 }
156 
157 void TilesManager::setRotation( Rotation rotation )
158 {
159  if ( rotation == d->rotation )
160  return;
161 
162  d->rotation = rotation;
163 }
164 
165 Rotation TilesManager::rotation() const
166 {
167  return d->rotation;
168 }
169 
170 void TilesManager::markDirty()
171 {
172  for ( int i = 0; i < 16; ++i )
173  {
174  TilesManager::Private::markDirty( d->tiles[ i ] );
175  }
176 }
177 
178 void TilesManager::Private::markDirty( TileNode &tile )
179 {
180  tile.dirty = true;
181 
182  for ( int i = 0; i < tile.nTiles; ++i )
183  {
184  markDirty( tile.tiles[ i ] );
185  }
186 }
187 
188 void TilesManager::setPixmap( const QPixmap *pixmap, const NormalizedRect &rect )
189 {
190  NormalizedRect rotatedRect = TilesManager::fromRotatedRect( rect, d->rotation );
191  if ( !d->requestRect.isNull() )
192  {
193  if ( !(d->requestRect == rect) )
194  return;
195 
196  // Check whether the pixmap has the same absolute size of the expected
197  // request.
198  // If the document is rotated, rotate requestRect back to the original
199  // rotation before comparing to pixmap's size. This is to avoid
200  // conversion issues. The pixmap request was made using an unrotated
201  // rect.
202  QSize pixmapSize = pixmap->size();
203  int w = width();
204  int h = height();
205  if ( d->rotation % 2 )
206  {
207  qSwap(w, h);
208  pixmapSize.transpose();
209  }
210 
211  if ( rotatedRect.geometry( w, h ).size() != pixmapSize )
212  return;
213 
214  d->requestRect = NormalizedRect();
215  }
216 
217  for ( int i = 0; i < 16; ++i )
218  {
219  d->setPixmap( pixmap, rotatedRect, d->tiles[ i ] );
220  }
221 }
222 
223 void TilesManager::Private::setPixmap( const QPixmap *pixmap, const NormalizedRect &rect, TileNode &tile )
224 {
225  QRect pixmapRect = TilesManager::toRotatedRect( rect, rotation ).geometry( width, height );
226 
227  // Exclude tiles outside the viewport
228  if ( !tile.rect.intersects( rect ) )
229  return;
230 
231  // if the tile is not entirely within the viewport (the tile intersects an
232  // edged of the viewport), attempt to set the pixmap in the children tiles
233  if ( !((tile.rect & rect) == tile.rect) )
234  {
235  // paint children tiles
236  if ( tile.nTiles > 0 )
237  {
238  for ( int i = 0; i < tile.nTiles; ++i )
239  setPixmap( pixmap, rect, tile.tiles[ i ] );
240 
241  delete tile.pixmap;
242  tile.pixmap = 0;
243  }
244 
245  return;
246  }
247 
248  // the tile lies entirely within the viewport
249  if ( tile.nTiles == 0 )
250  {
251  tile.dirty = false;
252 
253  // check whether the tile size is big and split it if necessary
254  if ( !splitBigTiles( tile, rect ) )
255  {
256  if ( tile.pixmap )
257  {
258  totalPixels -= tile.pixmap->width()*tile.pixmap->height();
259  delete tile.pixmap;
260  }
261  NormalizedRect rotatedRect = TilesManager::toRotatedRect( tile.rect, rotation );
262  tile.pixmap = new QPixmap( pixmap->copy( rotatedRect.geometry( width, height ).translated( -pixmapRect.topLeft() ) ) );
263  tile.rotation = rotation;
264  totalPixels += tile.pixmap->width()*tile.pixmap->height();
265  }
266  else
267  {
268  if ( tile.pixmap )
269  {
270  totalPixels -= tile.pixmap->width()*tile.pixmap->height();
271  delete tile.pixmap;
272  tile.pixmap = 0;
273  }
274 
275  for ( int i = 0; i < tile.nTiles; ++i )
276  setPixmap( pixmap, rect, tile.tiles[ i ] );
277  }
278  }
279  else
280  {
281  QRect tileRect = tile.rect.geometry( width, height );
282  // sets the pixmap of the children tiles. if the tile's size is too
283  // small, discards the children tiles and use the current one
284  if ( tileRect.width()*tileRect.height() >= TILES_MAXSIZE )
285  {
286  tile.dirty = false;
287  if ( tile.pixmap )
288  {
289  totalPixels -= tile.pixmap->width()*tile.pixmap->height();
290  delete tile.pixmap;
291  tile.pixmap = 0;
292  }
293 
294  for ( int i = 0; i < tile.nTiles; ++i )
295  setPixmap( pixmap, rect, tile.tiles[ i ] );
296  }
297  else
298  {
299  // remove children tiles
300  for ( int i = 0; i < tile.nTiles; ++i )
301  {
302  deleteTiles( tile.tiles[ i ] );
303  tile.tiles[ i ].pixmap = 0;
304  }
305 
306  delete [] tile.tiles;
307  tile.tiles = 0;
308  tile.nTiles = 0;
309 
310  // paint tile
311  if ( tile.pixmap )
312  {
313  totalPixels -= tile.pixmap->width()*tile.pixmap->height();
314  delete tile.pixmap;
315  }
316  NormalizedRect rotatedRect = TilesManager::toRotatedRect( tile.rect, rotation );
317  tile.pixmap = new QPixmap( pixmap->copy( rotatedRect.geometry( width, height ).translated( -pixmapRect.topLeft() ) ) );
318  tile.rotation = rotation;
319  totalPixels += tile.pixmap->width()*tile.pixmap->height();
320  tile.dirty = false;
321  }
322  }
323 }
324 
325 bool TilesManager::hasPixmap( const NormalizedRect &rect )
326 {
327  NormalizedRect rotatedRect = fromRotatedRect( rect, d->rotation );
328  for ( int i = 0; i < 16; ++i )
329  {
330  if ( !d->hasPixmap( rotatedRect, d->tiles[ i ] ) )
331  return false;
332  }
333 
334  return true;
335 }
336 
337 bool TilesManager::Private::hasPixmap( const NormalizedRect &rect, const TileNode &tile ) const
338 {
339  if ( !tile.rect.intersects( rect ) )
340  return true;
341 
342  if ( tile.nTiles == 0 )
343  return tile.isValid();
344 
345  // all children tiles are clean. doesn't need to go deeper
346  if ( !tile.dirty )
347  return true;
348 
349  for ( int i = 0; i < tile.nTiles; ++i )
350  {
351  if ( !hasPixmap( rect, tile.tiles[ i ] ) )
352  return false;
353  }
354 
355  return true;
356 }
357 
358 QList<Tile> TilesManager::tilesAt( const NormalizedRect &rect, TileLeaf tileLeaf )
359 {
360  QList<Tile> result;
361 
362  NormalizedRect rotatedRect = fromRotatedRect( rect, d->rotation );
363  for ( int i = 0; i < 16; ++i )
364  {
365  d->tilesAt( rotatedRect, d->tiles[ i ], result, tileLeaf );
366  }
367 
368  return result;
369 }
370 
371 void TilesManager::Private::tilesAt( const NormalizedRect &rect, TileNode &tile, QList<Tile> &result, TileLeaf tileLeaf )
372 {
373  if ( !tile.rect.intersects( rect ) )
374  return;
375 
376  // split big tiles before the requests are made, otherwise we would end up
377  // requesting huge areas unnecessarily
378  splitBigTiles( tile, rect );
379 
380  if ( ( tileLeaf == TerminalTile && tile.nTiles == 0 ) || ( tileLeaf == PixmapTile && tile.pixmap ) )
381  {
382  NormalizedRect rotatedRect;
383  if ( rotation != Rotation0 )
384  rotatedRect = TilesManager::toRotatedRect( tile.rect, rotation );
385  else
386  rotatedRect = tile.rect;
387 
388  if ( tile.pixmap && tileLeaf == PixmapTile && tile.rotation != rotation )
389  {
390  // Lazy tiles rotation
391  int angleToRotate = (rotation - tile.rotation)*90;
392  int xOffset = 0, yOffset = 0;
393  int w = 0, h = 0;
394  switch( angleToRotate )
395  {
396  case 0:
397  xOffset = 0;
398  yOffset = 0;
399  w = tile.pixmap->width();
400  h = tile.pixmap->height();
401  break;
402  case 90:
403  case -270:
404  xOffset = 0;
405  yOffset = -tile.pixmap->height();
406  w = tile.pixmap->height();
407  h = tile.pixmap->width();
408  break;
409  case 180:
410  case -180:
411  xOffset = -tile.pixmap->width();
412  yOffset = -tile.pixmap->height();
413  w = tile.pixmap->width();
414  h = tile.pixmap->height();
415  break;
416  case 270:
417  case -90:
418  xOffset = -tile.pixmap->width();
419  yOffset = 0;
420  w = tile.pixmap->height();
421  h = tile.pixmap->width();
422  break;
423  }
424  QPixmap *rotatedPixmap = new QPixmap( w, h );
425  QPainter p( rotatedPixmap );
426  p.rotate( angleToRotate );
427  p.translate( xOffset, yOffset );
428  p.drawPixmap( 0, 0, *tile.pixmap );
429  p.end();
430 
431  delete tile.pixmap;
432  tile.pixmap = rotatedPixmap;
433  tile.rotation = rotation;
434  }
435  result.append( Tile( rotatedRect, tile.pixmap, tile.isValid() ) );
436  }
437  else
438  {
439  for ( int i = 0; i < tile.nTiles; ++i )
440  tilesAt( rect, tile.tiles[ i ], result, tileLeaf );
441  }
442 }
443 
444 qulonglong TilesManager::totalMemory() const
445 {
446  return 4*d->totalPixels;
447 }
448 
449 void TilesManager::cleanupPixmapMemory( qulonglong numberOfBytes, const NormalizedRect &visibleRect, int visiblePageNumber )
450 {
451  QList<TileNode*> rankedTiles;
452  for ( int i = 0; i < 16; ++i )
453  {
454  d->rankTiles( d->tiles[ i ], rankedTiles, visibleRect, visiblePageNumber );
455  }
456  qSort( rankedTiles.begin(), rankedTiles.end(), rankedTilesLessThan );
457 
458  while ( numberOfBytes > 0 && !rankedTiles.isEmpty() )
459  {
460  TileNode *tile = rankedTiles.takeLast();
461  if ( !tile->pixmap )
462  continue;
463 
464  // do not evict visible pixmaps
465  if ( tile->rect.intersects( visibleRect ) )
466  continue;
467 
468  qulonglong pixels = tile->pixmap->width()*tile->pixmap->height();
469  d->totalPixels -= pixels;
470  if ( numberOfBytes < 4*pixels )
471  numberOfBytes = 0;
472  else
473  numberOfBytes -= 4*pixels;
474 
475  delete tile->pixmap;
476  tile->pixmap = 0;
477 
478  d->markParentDirty( *tile );
479  }
480 }
481 
482 void TilesManager::Private::markParentDirty( const TileNode &tile )
483 {
484  if ( !tile.parent )
485  return;
486 
487  if ( !tile.parent->dirty )
488  {
489  tile.parent->dirty = true;
490  markParentDirty( *tile.parent );
491  }
492 }
493 
494 void TilesManager::Private::rankTiles( TileNode &tile, QList<TileNode*> &rankedTiles, const NormalizedRect &visibleRect, int visiblePageNumber )
495 {
496  // If the page is visible, visibleRect is not null.
497  // Otherwise we use the number of one of the visible pages to calculate the
498  // distance.
499  // Note that the current page may be visible and yet its pageNumber is
500  // different from visiblePageNumber. Since we only use this value on hidden
501  // pages, any visible page number will fit.
502  if ( visibleRect.isNull() && visiblePageNumber < 0 )
503  return;
504 
505  if ( tile.pixmap )
506  {
507  // Update distance
508  if ( !visibleRect.isNull() )
509  {
510  NormalizedPoint viewportCenter = visibleRect.center();
511  NormalizedPoint tileCenter = tile.rect.center();
512  // Manhattan distance. It's a good and fast approximation.
513  tile.distance = qAbs(viewportCenter.x - tileCenter.x) + qAbs(viewportCenter.y - tileCenter.y);
514  }
515  else
516  {
517  // For non visible pages only the vertical distance is used
518  if ( pageNumber < visiblePageNumber )
519  tile.distance = 1 - tile.rect.bottom;
520  else
521  tile.distance = tile.rect.top;
522  }
523  rankedTiles.append( &tile );
524  }
525  else
526  {
527  for ( int i = 0; i < tile.nTiles; ++i )
528  {
529  rankTiles( tile.tiles[ i ], rankedTiles, visibleRect, visiblePageNumber );
530  }
531  }
532 }
533 
534 bool TilesManager::isRequesting( const NormalizedRect &rect, int pageWidth, int pageHeight ) const
535 {
536  return rect == d->requestRect && pageWidth == d->requestWidth && pageHeight == d->requestHeight;
537 }
538 
539 void TilesManager::setRequest( const NormalizedRect &rect, int pageWidth, int pageHeight )
540 {
541  d->requestRect = rect;
542  d->requestWidth = pageWidth;
543  d->requestHeight = pageHeight;
544 }
545 
546 bool TilesManager::Private::splitBigTiles( TileNode &tile, const NormalizedRect &rect )
547 {
548  QRect tileRect = tile.rect.geometry( width, height );
549  if ( tileRect.width()*tileRect.height() < TILES_MAXSIZE )
550  return false;
551 
552  split( tile, rect );
553  return true;
554 }
555 
556 void TilesManager::Private::split( TileNode &tile, const NormalizedRect &rect )
557 {
558  if ( tile.nTiles != 0 )
559  return;
560 
561  if ( rect.isNull() || !tile.rect.intersects( rect ) )
562  return;
563 
564  tile.nTiles = 4;
565  tile.tiles = new TileNode[4];
566  double hCenter = (tile.rect.left + tile.rect.right)/2;
567  double vCenter = (tile.rect.top + tile.rect.bottom)/2;
568 
569  tile.tiles[0].rect = NormalizedRect( tile.rect.left, tile.rect.top, hCenter, vCenter );
570  tile.tiles[1].rect = NormalizedRect( hCenter, tile.rect.top, tile.rect.right, vCenter );
571  tile.tiles[2].rect = NormalizedRect( tile.rect.left, vCenter, hCenter, tile.rect.bottom );
572  tile.tiles[3].rect = NormalizedRect( hCenter, vCenter, tile.rect.right, tile.rect.bottom );
573 
574  for ( int i = 0; i < tile.nTiles; ++i )
575  {
576  tile.tiles[ i ].parent = &tile;
577  splitBigTiles( tile.tiles[ i ], rect );
578  }
579 }
580 
581 NormalizedRect TilesManager::fromRotatedRect( const NormalizedRect &rect, Rotation rotation )
582 {
583  if ( rotation == Rotation0 )
584  return rect;
585 
586  NormalizedRect newRect;
587  switch ( rotation )
588  {
589  case Rotation90:
590  newRect = NormalizedRect( rect.top, 1 - rect.right, rect.bottom, 1 - rect.left );
591  break;
592  case Rotation180:
593  newRect = NormalizedRect( 1 - rect.right, 1 - rect.bottom, 1 - rect.left, 1 - rect.top );
594  break;
595  case Rotation270:
596  newRect = NormalizedRect( 1 - rect.bottom, rect.left, 1 - rect.top, rect.right );
597  break;
598  default:
599  newRect = rect;
600  break;
601  }
602 
603  return newRect;
604 }
605 
606 NormalizedRect TilesManager::toRotatedRect( const NormalizedRect &rect, Rotation rotation )
607 {
608  if ( rotation == Rotation0 )
609  return rect;
610 
611  NormalizedRect newRect;
612  switch ( rotation )
613  {
614  case Rotation90:
615  newRect = NormalizedRect( 1 - rect.bottom, rect.left, 1 - rect.top, rect.right );
616  break;
617  case Rotation180:
618  newRect = NormalizedRect( 1 - rect.right, 1 - rect.bottom, 1 - rect.left, 1 - rect.top );
619  break;
620  case Rotation270:
621  newRect = NormalizedRect( rect.top, 1 - rect.right, rect.bottom, 1 - rect.left );
622  break;
623  default:
624  newRect = rect;
625  break;
626  }
627 
628  return newRect;
629 }
630 
631 TileNode::TileNode()
632  : pixmap( 0 )
633  , rotation( Rotation0 )
634  , dirty ( true )
635  , distance( -1 )
636  , tiles( 0 )
637  , nTiles( 0 )
638  , parent( 0 )
639 {
640 }
641 
642 bool TileNode::isValid() const
643 {
644  return pixmap && !dirty;
645 }
646 
647 class Tile::Private
648 {
649  public:
650  Private();
651 
652  NormalizedRect rect;
653  QPixmap *pixmap;
654  bool isValid;
655 };
656 
657 Tile::Private::Private()
658  : pixmap( 0 )
659  , isValid( false )
660 {
661 }
662 
663 Tile::Tile( const NormalizedRect &rect, QPixmap *pixmap, bool isValid )
664  : d( new Tile::Private )
665 {
666  d->rect = rect;
667  d->pixmap = pixmap;
668  d->isValid = isValid;
669 }
670 
671 Tile::Tile( const Tile &t )
672  : d( new Tile::Private )
673 {
674  d->rect = t.d->rect;
675  d->pixmap = t.d->pixmap;
676  d->isValid = t.d->isValid;
677 }
678 
679 Tile& Tile::operator=( const Tile &other )
680 {
681  if ( this == &other )
682  return *this;
683 
684  d->rect = other.d->rect;
685  d->pixmap = other.d->pixmap;
686  d->isValid = other.d->isValid;
687 
688  return *this;
689 }
690 
691 Tile::~Tile()
692 {
693  delete d;
694 }
695 
696 NormalizedRect Tile::rect() const
697 {
698  return d->rect;
699 }
700 
701 QPixmap * Tile::pixmap() const
702 {
703  return d->pixmap;
704 }
705 
706 bool Tile::isValid() const
707 {
708  return d->isValid;
709 }
Okular::TileNode::tiles
TileNode * tiles
Children tiles When a tile is split into multiple tiles, they're added as children.
Definition: tilesmanager_p.h:83
Okular::TilesManager::setRotation
void setRotation(Rotation rotation)
Inform the new rotation of the page.
Definition: tilesmanager.cpp:157
Okular::NormalizedPoint
NormalizedPoint is a helper class which stores the coordinates of a normalized point.
Definition: area.h:47
Okular::TilesManager::cleanupPixmapMemory
void cleanupPixmapMemory(qulonglong numberOfBytes, const NormalizedRect &visibleRect, int visiblePageNumber)
Removes at least numberOfBytes bytes worth of tiles (least ranked tiles are removed first)...
Definition: tilesmanager.cpp:449
Okular::Rotation
Rotation
A rotation.
Definition: global.h:44
Okular::Tile::Tile
Tile(const NormalizedRect &rect, QPixmap *pixmap, bool isValid)
Definition: tilesmanager.cpp:663
Okular::TilesManager::height
int height() const
Gets the height of the page in tiles manager.
Definition: tilesmanager.cpp:152
Okular::TilesManager::fromRotatedRect
static NormalizedRect fromRotatedRect(const NormalizedRect &rect, Rotation rotation)
Returns a non rotated version of rect, which is rotated by rotation.
Definition: tilesmanager.cpp:581
tilesmanager_p.h
Okular::TileNode::nTiles
int nTiles
Definition: tilesmanager_p.h:84
Okular::Tile::operator=
Tile & operator=(const Tile &other)
Definition: tilesmanager.cpp:679
Okular::NormalizedRect::center
NormalizedPoint center() const
Returns the center of the rectangle.
Definition: area.cpp:227
Okular::NormalizedRect::left
double left
The normalized left coordinate.
Definition: area.h:305
Okular::Tile::isValid
bool isValid() const
True if the pixmap is available and updated.
Definition: tilesmanager.cpp:706
Okular::NormalizedRect
NormalizedRect is a helper class which stores the coordinates of a normalized rect, which is a rectangle of.
Definition: area.h:105
Okular::NormalizedPoint::y
double y
The normalized y coordinate.
Definition: area.h:97
Okular::TileNode::distance
double distance
Distance between the tile and the viewport.
Definition: tilesmanager_p.h:76
Okular::Rotation180
Rotated 180 degrees clockwise.
Definition: global.h:48
Okular::Rotation0
Not rotated.
Definition: global.h:46
Okular::Tile
This class represents a rectangular portion of a page.
Definition: tile.h:25
Okular::NormalizedRect::intersects
bool intersects(const NormalizedRect &other) const
Returns whether the normalized rectangle intersects the other normalized rectangle.
Definition: area.cpp:161
TILES_MAXSIZE
#define TILES_MAXSIZE
Definition: tilesmanager.cpp:18
rankedTilesLessThan
static bool rankedTilesLessThan(TileNode *t1, TileNode *t2)
Definition: tilesmanager.cpp:22
Okular::NormalizedRect::right
double right
The normalized right coordinate.
Definition: area.h:315
Okular::TilesManager::TileLeaf
TileLeaf
Definition: tilesmanager_p.h:101
Okular::TilesManager::tilesAt
QList< Tile > tilesAt(const NormalizedRect &rect, TileLeaf tileLeaf)
Returns a list of all tiles intersecting with rect.
Definition: tilesmanager.cpp:358
Okular::TilesManager::setRequest
void setRequest(const NormalizedRect &rect, int pageWidth, int pageHeight)
Sets a region to be requested so the tiles manager knows which pixmaps to expect and discard those no...
Definition: tilesmanager.cpp:539
Okular::TilesManager::rotation
Rotation rotation() const
Definition: tilesmanager.cpp:165
Okular::TilesManager::markDirty
void markDirty()
Mark all tiles as dirty.
Definition: tilesmanager.cpp:170
tile.h
Okular::Rotation270
Rotated 2700 degrees clockwise.
Definition: global.h:49
Okular::TilesManager::~TilesManager
~TilesManager()
Definition: tilesmanager.cpp:111
Okular::NormalizedRect::geometry
QRect geometry(int xScale, int yScale) const
Returns the rectangle that accrues when the normalized rectangle is multiplyed with the scaling xScal...
Definition: area.cpp:239
Okular::TilesManager::toRotatedRect
static NormalizedRect toRotatedRect(const NormalizedRect &rect, Rotation rotation)
Returns a rotated NormalizedRect given a rotation.
Definition: tilesmanager.cpp:606
Okular::TilesManager::width
int width() const
Gets the width of the page in tiles manager.
Definition: tilesmanager.cpp:147
Okular::TileNode::parent
TileNode * parent
Definition: tilesmanager_p.h:85
Okular::NormalizedRect::top
double top
The normalized top coordinate.
Definition: area.h:310
Okular::TileNode::pixmap
QPixmap * pixmap
Associated pixmap or NULL if not present.
Definition: tilesmanager_p.h:55
Okular::Tile::pixmap
QPixmap * pixmap() const
Pixmap (may also be NULL)
Definition: tilesmanager.cpp:701
Okular::TileNode
Node in the quadtree structure used by the tiles manager to store tiles.
Definition: tilesmanager_p.h:34
Okular::TilesManager::totalMemory
qulonglong totalMemory() const
The total memory consumed by the tiles manager.
Definition: tilesmanager.cpp:444
Okular::TilesManager::setSize
void setSize(int width, int height)
Inform the new size of the page and mark all tiles to repaint.
Definition: tilesmanager.cpp:136
Okular::Rotation90
Rotated 90 degrees clockwise.
Definition: global.h:47
Okular::TileNode::isValid
bool isValid() const
Definition: tilesmanager.cpp:642
Okular::NormalizedPoint::x
double x
The normalized x coordinate.
Definition: area.h:92
Okular::TileNode::dirty
bool dirty
Whether the tile needs to be repainted (after a zoom or rotation) If a tile doesn't have a pixmap but...
Definition: tilesmanager_p.h:70
Okular::Tile::rect
NormalizedRect rect() const
Location of the tile.
Definition: tilesmanager.cpp:696
Okular::NormalizedRect::isNull
bool isNull() const
Returns whether this normalized rectangle is a null normalized rect.
Definition: area.cpp:151
Okular::TilesManager::Private
friend class Private
Definition: tilesmanager_p.h:202
Okular::TilesManager::setPixmap
void setPixmap(const QPixmap *pixmap, const NormalizedRect &rect)
Sets the pixmap of the tiles covered by rect (which represents the location of pixmap on the page)...
Definition: tilesmanager.cpp:188
Okular::TilesManager::isRequesting
bool isRequesting(const NormalizedRect &rect, int pageWidth, int pageHeight) const
Checks whether a given region has already been requested.
Definition: tilesmanager.cpp:534
Okular::Tile::~Tile
~Tile()
Definition: tilesmanager.cpp:691
Okular::NormalizedRect::bottom
double bottom
The normalized bottom coordinate.
Definition: area.h:320
Okular::TileNode::rect
NormalizedRect rect
Location on the page in normalized coords.
Definition: tilesmanager_p.h:44
Okular::TilesManager::hasPixmap
bool hasPixmap(const NormalizedRect &rect)
Checks whether all tiles intersecting with rect are available.
Definition: tilesmanager.cpp:325
Okular::TileNode::rotation
Rotation rotation
Rotation of this individual tile.
Definition: tilesmanager_p.h:63
Okular::TileNode::TileNode
TileNode()
Definition: tilesmanager.cpp:631
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:45:03 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

okular

Skip menu "okular"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdegraphics API Reference

Skip menu "kdegraphics API Reference"
  •     libkdcraw
  •     libkexiv2
  •     libkipi
  •     libksane
  • okular

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal