Qt 4.8
Functions | Variables
qmeegolivepixmapdata.cpp File Reference
#include "qmeegolivepixmapdata.h"
#include "qmeegorasterpixmapdata.h"
#include <private/qimage_p.h>
#include <private/qwindowsurface_gl_p.h>
#include <private/qeglcontext_p.h>
#include <private/qapplication_p.h>
#include <private/qgraphicssystem_runtime_p.h>
#include <private/qpixmap_x11_p.h>
#include <stdio.h>

Go to the source code of this file.

Functions

void qt_scrollRectInImage (QImage &img, const QRect &rect, const QPoint &offset)
 

Variables

static QMeeGoLivePixmapDataList all_live_pixmaps
 
static EGLint lock_attribs []
 
static EGLint preserved_attribs []
 

Function Documentation

◆ qt_scrollRectInImage()

void qt_scrollRectInImage ( QImage img,
const QRect rect,
const QPoint offset 
)

Definition at line 66 of file qmeegolivepixmapdata.cpp.

Referenced by QWSMemorySurface::beginPaint(), QXlibWindowSurface::flush(), QRasterPixmapData::fromImageReader(), QXcbWindowSurface::resize(), QMeeGoLivePixmapData::scroll(), QXcbWindowSurface::scroll(), QXlibWindowSurface::scroll(), QRasterPixmapData::scroll(), QRasterWindowSurface::scroll(), QWSMemorySurface::scroll(), and QRasterWindowSurface::setGeometry().

67 {
68  // make sure we don't detach
69  uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());
70 
71  int lineskip = img.bytesPerLine();
72  int depth = img.depth() >> 3;
73 
74  const QRect imageRect(0, 0, img.width(), img.height());
75  const QRect r = rect & imageRect & imageRect.translated(-offset);
76  const QPoint p = rect.topLeft() + offset;
77 
78  if (r.isEmpty())
79  return;
80 
81  const uchar *src;
82  uchar *dest;
83 
84  if (r.top() < p.y()) {
85  src = mem + r.bottom() * lineskip + r.left() * depth;
86  dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth;
87  lineskip = -lineskip;
88  } else {
89  src = mem + r.top() * lineskip + r.left() * depth;
90  dest = mem + p.y() * lineskip + p.x() * depth;
91  }
92 
93  const int w = r.width();
94  int h = r.height();
95  const int bytes = w * depth;
96 
97  // overlapping segments?
98  if (offset.y() == 0 && qAbs(offset.x()) < w) {
99  do {
100  ::memmove(dest, src, bytes);
101  dest += lineskip;
102  src += lineskip;
103  } while (--h);
104  } else {
105  do {
106  ::memcpy(dest, src, bytes);
107  dest += lineskip;
108  src += lineskip;
109  } while (--h);
110  }
111 }
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
Q_DECL_CONSTEXPR T qAbs(const T &t)
Definition: qglobal.h:1201
unsigned char uchar
Definition: qglobal.h:994
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
QPoint topLeft() const
Returns the position of the rectangle&#39;s top-left corner.
Definition: qrect.h:288

Variable Documentation

◆ all_live_pixmaps

QMeeGoLivePixmapDataList all_live_pixmaps
static

Definition at line 52 of file qmeegolivepixmapdata.cpp.

◆ lock_attribs

EGLint lock_attribs[]
static
Initial value:
= {
EGL_NONE
}
#define EGL_WRITE_SURFACE_BIT_KHR
#define EGL_MAP_PRESERVE_PIXELS_KHR
#define EGL_READ_SURFACE_BIT_KHR
#define EGL_LOCK_USAGE_HINT_KHR

Definition at line 54 of file qmeegolivepixmapdata.cpp.

Referenced by QMeeGoLivePixmapData::lock().

◆ preserved_attribs

EGLint preserved_attribs[]
static
Initial value:
= {
EGL_NONE
}
#define EGL_IMAGE_PRESERVED_KHR
Definition: qegl_p.h:172

Definition at line 60 of file qmeegolivepixmapdata.cpp.

Referenced by QMeeGoLivePixmapData::initializeThroughEGLImage().