Skip to content
This repository has been archived by the owner on May 14, 2022. It is now read-only.

Commit

Permalink
modify Page::size()
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangxw committed Jun 30, 2014
1 parent ea64ffe commit 9dcc2ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/mupdf-page.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

class QImage;
class QString;
class QRect;
class QSizeF;

namespace MuPDF
{
Expand All @@ -26,7 +26,7 @@ class Page
~Page();
bool isValid() const;
QImage renderImage() const;
QRect size() const;
QSizeF size() const;
void setTransparentRendering(bool enable);
void setBackgroundColor(int r, int g, int b, int a = 255);
void setTransform(float scaleX, float scaleY, float rotation = 0.0f);
Expand Down
12 changes: 4 additions & 8 deletions src/mupdf-page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern "C" {
#include <mupdf/fitz.h>
}
#include <QImage>
#include <QRect>
#include <QSizeF>

static void clear_bgr_samples_with_value(
unsigned char *samples, int size,
Expand Down Expand Up @@ -201,16 +201,12 @@ QImage Page::renderImage() const
/**
* @brief Page size at 72 dpi
*/
QRect Page::size() const
QSizeF Page::size() const
{
//fz_rect rect = fz_bound_page(d->document, d->page);
fz_rect rect;

fz_bound_page(d->document, d->page, &rect);
//fz_bbox bbox = fz_round_rect(rect);
fz_irect bbox;
fz_round_rect(&bbox, &rect);
return QRect(bbox.x0, bbox.y0,
bbox.x1 - bbox.x0, bbox.y1 - bbox.y0);
return QSizeF(rect.x1 - rect.x0, rect.y1 - rect.y0);
}

/**
Expand Down

0 comments on commit 9dcc2ec

Please sign in to comment.