Qt 4.8
Classes | Functions | Variables
qpaintengine.cpp File Reference
#include "qpaintengine.h"
#include "qpaintengine_p.h"
#include "qpainter_p.h"
#include "qpolygon.h"
#include "qbitmap.h"
#include "qapplication.h"
#include <qdebug.h>
#include <qmath.h>
#include <private/qtextengine_p.h>
#include <qvarlengtharray.h>
#include <private/qfontengine_p.h>
#include <private/qpaintengineex_p.h>

Go to the source code of this file.

Classes

struct  QT_Point
 
struct  QT_PointF
 

Functions

void qt_draw_tile (QPaintEngine *gc, qreal x, qreal y, qreal w, qreal h, const QPixmap &pixmap, qreal xOffset, qreal yOffset)
 
void qt_fill_tile (QPixmap *tile, const QPixmap &pixmap)
 

Variables

static QPaintEngineqt_polygon_recursion = 0
 

Function Documentation

◆ qt_draw_tile()

void qt_draw_tile ( QPaintEngine gc,
qreal  x,
qreal  y,
qreal  w,
qreal  h,
const QPixmap pixmap,
qreal  xOffset,
qreal  yOffset 
)

Definition at line 600 of file qpaintengine.cpp.

Referenced by QX11PaintEngine::drawTiledPixmap(), QPaintEngine::drawTiledPixmap(), and QX11PaintEngine::handle().

602 {
603  qreal yPos, xPos, drawH, drawW, yOff, xOff;
604  yPos = y;
605  yOff = yOffset;
606  while(yPos < y + h) {
607  drawH = pixmap.height() - yOff; // Cropping first row
608  if (yPos + drawH > y + h) // Cropping last row
609  drawH = y + h - yPos;
610  xPos = x;
611  xOff = xOffset;
612  while(xPos < x + w) {
613  drawW = pixmap.width() - xOff; // Cropping first column
614  if (xPos + drawW > x + w) // Cropping last column
615  drawW = x + w - xPos;
616  if (drawW > 0 && drawH > 0)
617  gc->drawPixmap(QRectF(xPos, yPos, drawW, drawH), pixmap, QRectF(xOff, yOff, drawW, drawH));
618  xPos += drawW;
619  xOff = 0;
620  }
621  yPos += drawH;
622  yOff = 0;
623  }
624 }
double qreal
Definition: qglobal.h:1193
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)=0
Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r...
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645

◆ qt_fill_tile()

void qt_fill_tile ( QPixmap tile,
const QPixmap pixmap 
)

Definition at line 584 of file qpaintengine.cpp.

Referenced by QPaintEngine::drawTiledPixmap().

585 {
586  QPainter p(tile);
587  p.drawPixmap(0, 0, pixmap);
588  int x = pixmap.width();
589  while (x < tile->width()) {
590  p.drawPixmap(x, 0, *tile, 0, 0, x, pixmap.height());
591  x *= 2;
592  }
593  int y = pixmap.height();
594  while (y < tile->height()) {
595  p.drawPixmap(0, y, *tile, 0, 0, tile->width(), y);
596  y *= 2;
597  }
598 }
The QPainter class performs low-level painting on widgets and other paint devices.
Definition: qpainter.h:86
int width() const
Returns the width of the pixmap.
Definition: qpixmap.cpp:630
int height() const
Returns the height of the pixmap.
Definition: qpixmap.cpp:645

Variable Documentation

◆ qt_polygon_recursion

QPaintEngine* qt_polygon_recursion = 0
static

Definition at line 344 of file qpaintengine.cpp.