Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpixmap_x11.cpp File Reference

(f84e654a620a4f04817b70bd1e7eab8a09a25526)

#include <QGuiApplication>
#include <private/qdrawhelper_p.h>
#include <private/qimage_p.h>
#include <private/qimagepixmapcleanuphooks_p.h>
#include "qxcbnativepainting.h"
#include "qpixmap_x11_p.h"
#include "qcolormap_x11_p.h"
#include "qpaintengine_x11_p.h"
+ Include dependency graph for qpixmap_x11.cpp:

Go to the source code of this file.

Classes

struct  QXImageWrapper
 
struct  QX11AlphaDetector
 

Macros

#define GET_PIXEL
 
#define GET_PIXEL_DITHER_TC
 
#define GET_PIXEL_DITHER_TC_OPT(red_shift, green_shift, blue_shift, red_mask, green_mask, blue_mask, rbits, gbits, bbits)
 
#define CYCLE(body)
 

Functions

QT_BEGIN_NAMESPACE Q_ALWAYS_INLINE uint PREMUL (uint x)
 
QPixmap qt_toX11Pixmap (const QImage &image)
 
QPixmap qt_toX11Pixmap (const QPixmap &pixmap)
 
static void qSafeXDestroyImage (XImage *x)
 
Drawable qt_x11Handle (const QPixmap &pixmap)
 
static int highest_bit (uint v)
 
static uint n_bits (uint v)
 
static void cleanup_scale_tables ()
 
static void build_scale_table (uint **table, uint nBits)
 
int qt_x11SetDefaultScreen (int screen)
 
void qt_x11SetScreen (QPixmap &pixmap, int screen)
 

Variables

static uintred_scale_table = nullptr
 
static uintgreen_scale_table = nullptr
 
static uintblue_scale_table = nullptr
 
static int defaultScreen = -1
 
QBasicAtomicInt qt_pixmap_serial = Q_BASIC_ATOMIC_INITIALIZER(0)
 
int Q_GUI_EXPORT qt_x11_preferred_pixmap_depth = 0
 

Macro Definition Documentation

◆ CYCLE

#define CYCLE ( body)
Value:
for (int y=0; y<h; y++) { \
const uchar* src = cimage.scanLine(y); \
uchar* dst = newbits + xi->bytes_per_line*y; \
const QRgb* p = (const QRgb *)src; \
body \
}
GLenum src
GLenum GLenum dst
GLint y
GLfloat GLfloat GLfloat GLfloat h
GLfloat GLfloat p
[1]
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
Definition qrgb.h:13
unsigned char uchar
Definition qtypes.h:32

◆ GET_PIXEL

#define GET_PIXEL
Value:
uint pixel; \
if (d8) pixel = pix[*src++]; \
else { \
int r = qRed (*p); \
int g = qGreen(*p); \
int b = qBlue (*p++); \
r = red_shift > 0 \
? r << red_shift : r >> -red_shift; \
g = green_shift > 0 \
? g << green_shift : g >> -green_shift; \
b = blue_shift > 0 \
? b << blue_shift : b >> -blue_shift; \
pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask) \
| ~(blue_mask | green_mask | red_mask); \
}
QPixmap pix
GLboolean GLboolean GLboolean b
GLboolean r
[2]
GLboolean GLboolean g
constexpr int qRed(QRgb rgb)
Definition qrgb.h:18
constexpr int qGreen(QRgb rgb)
Definition qrgb.h:21
constexpr int qBlue(QRgb rgb)
Definition qrgb.h:24
unsigned int uint
Definition qtypes.h:34

◆ GET_PIXEL_DITHER_TC

#define GET_PIXEL_DITHER_TC
Value:
int r = qRed (*p); \
int g = qGreen(*p); \
int b = qBlue (*p++); \
const int thres = D[x%16][y%16]; \
if (r <= (255-(1<<(8-rbits))) && ((r<<rbits) & 255) \
> thres) \
r += (1<<(8-rbits)); \
if (g <= (255-(1<<(8-gbits))) && ((g<<gbits) & 255) \
> thres) \
g += (1<<(8-gbits)); \
if (b <= (255-(1<<(8-bbits))) && ((b<<bbits) & 255) \
> thres) \
b += (1<<(8-bbits)); \
r = red_shift > 0 \
? r << red_shift : r >> -red_shift; \
g = green_shift > 0 \
? g << green_shift : g >> -green_shift; \
b = blue_shift > 0 \
? b << blue_shift : b >> -blue_shift; \
uint pixel = (r & red_mask)|(g & green_mask) | (b & blue_mask);
GLint GLint GLint GLint GLint x
[0]

◆ GET_PIXEL_DITHER_TC_OPT

#define GET_PIXEL_DITHER_TC_OPT ( red_shift,
green_shift,
blue_shift,
red_mask,
green_mask,
blue_mask,
rbits,
gbits,
bbits )
Value:
const int thres = D[x%16][y%16]; \
int r = qRed (*p); \
if (r <= (255-(1<<(8-rbits))) && ((r<<rbits) & 255) \
> thres) \
r += (1<<(8-rbits)); \
int g = qGreen(*p); \
if (g <= (255-(1<<(8-gbits))) && ((g<<gbits) & 255) \
> thres) \
g += (1<<(8-gbits)); \
int b = qBlue (*p++); \
if (b <= (255-(1<<(8-bbits))) && ((b<<bbits) & 255) \
> thres) \
b += (1<<(8-bbits)); \
uint pixel = ((r red_shift) & red_mask) \
| ((g green_shift) & green_mask) \
| ((b blue_shift) & blue_mask);

Function Documentation

◆ build_scale_table()

static void build_scale_table ( uint ** table,
uint nBits )
static

Definition at line 264 of file qpixmap_x11.cpp.

References cleanup_scale_tables(), i, qAddPostRoutine(), and qWarning.

+ Here is the call graph for this function:

◆ cleanup_scale_tables()

static void cleanup_scale_tables ( )
static

Definition at line 253 of file qpixmap_x11.cpp.

References blue_scale_table, green_scale_table, and red_scale_table.

Referenced by build_scale_table().

+ Here is the caller graph for this function:

◆ highest_bit()

static int highest_bit ( uint v)
static

Definition at line 229 of file qpixmap_x11.cpp.

References i.

Referenced by QX11PlatformPixmap::fromImage().

+ Here is the caller graph for this function:

◆ n_bits()

static uint n_bits ( uint v)
static

Definition at line 239 of file qpixmap_x11.cpp.

References i.

Referenced by QX11PlatformPixmap::fromImage().

+ Here is the caller graph for this function:

◆ PREMUL()

Definition at line 29 of file qpixmap_x11.cpp.

Referenced by QX11PlatformPixmap::fill().

+ Here is the caller graph for this function:

◆ qSafeXDestroyImage()

static void qSafeXDestroyImage ( XImage * x)
inlinestatic

Definition at line 76 of file qpixmap_x11.cpp.

Referenced by QX11PlatformPixmap::fromImage(), QX11PlatformPixmap::toImage(), and QX11PlatformPixmap::transformed().

+ Here is the caller graph for this function:

◆ qt_toX11Pixmap() [1/2]

QPixmap qt_toX11Pixmap ( const QImage & image)

Definition at line 50 of file qpixmap_x11.cpp.

References Qt::AutoColor, QPlatformPixmap::BitmapType, QX11PlatformPixmap::fromImage(), and QPlatformPixmap::PixmapType.

Referenced by qt_toX11Pixmap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_toX11Pixmap() [2/2]

QPixmap qt_toX11Pixmap ( const QPixmap & pixmap)

Definition at line 62 of file qpixmap_x11.cpp.

References data_ptr(), pixmap, qt_toX11Pixmap(), and QPlatformPixmap::X11Class.

Referenced by QX11PaintEngine::drawPixmap(), and QX11PaintEngine::updateBrush().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qt_x11Handle()

Drawable qt_x11Handle ( const QPixmap & pixmap)

Definition at line 210 of file qpixmap_x11.cpp.

References pixmap, QPlatformPixmap::X11Class, and XNone.

◆ qt_x11SetDefaultScreen()

int qt_x11SetDefaultScreen ( int screen)

Definition at line 287 of file qpixmap_x11.cpp.

References defaultScreen, and screen.

Referenced by QX11PaintEngine::begin(), QX11PaintEngine::drawPixmap(), and QX11PaintEngine::drawTiledPixmap().

+ Here is the caller graph for this function:

◆ qt_x11SetScreen()

void qt_x11SetScreen ( QPixmap & pixmap,
int screen )

Definition at line 294 of file qpixmap_x11.cpp.

Referenced by QX11PaintEngine::drawPixmap(), QX11PaintEngine::drawTiledPixmap(), qt_patternForAlpha(), and QX11PaintEngine::updateBrush().

+ Here is the caller graph for this function:

Variable Documentation

◆ blue_scale_table

uint* blue_scale_table = nullptr
static

Definition at line 251 of file qpixmap_x11.cpp.

Referenced by cleanup_scale_tables().

◆ defaultScreen

◆ green_scale_table

uint* green_scale_table = nullptr
static

Definition at line 250 of file qpixmap_x11.cpp.

Referenced by cleanup_scale_tables().

◆ qt_pixmap_serial

◆ qt_x11_preferred_pixmap_depth

int Q_GUI_EXPORT qt_x11_preferred_pixmap_depth = 0

Definition at line 332 of file qpixmap_x11.cpp.

Referenced by QX11PlatformPixmap::fromImage(), and QX11PlatformPixmap::resize().

◆ red_scale_table

uint* red_scale_table = nullptr
static

Definition at line 249 of file qpixmap_x11.cpp.

Referenced by cleanup_scale_tables().