qplatformgraphicsbufferhelper.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/kernel/qplatformgraphicsbufferhelper.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3bool QPlatformGraphicsBufferHelper::lockAndBindToTexture(QPlatformGraphicsBuffer *graphicsBuffer,-
4 bool *swizzle, bool *premultiplied,-
5 const QRect &rect)-
6{-
7 if (graphicsBuffer->lock(QPlatformGraphicsBuffer::TextureAccess)
graphicsBuffer...TextureAccess)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
8 if (!graphicsBuffer->bindToTexture(rect)
!graphicsBuffe...oTexture(rect)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
9 QMessageLogger(__FILE__, 86, __PRETTY_FUNCTION__).warning("Failed to bind %sgraphicsbuffer to texture", "");-
10 return
never executed: return false;
false;
never executed: return false;
0
11 }-
12 if (swizzle
swizzleDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
13 *
never executed: *swizzle = false;
swizzle = false;
never executed: *swizzle = false;
0
14 if (premultiplied
premultipliedDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
15 *
never executed: *premultiplied = false;
premultiplied = false;
never executed: *premultiplied = false;
0
16 }
never executed: end of block
else if (graphicsBuffer->lock(QPlatformGraphicsBuffer::SWReadAccess)
graphicsBuffer...:SWReadAccess)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
17 if (!bindSWToTexture(graphicsBuffer, swizzle, premultiplied, rect)
!bindSWToTextu...tiplied, rect)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
18 QMessageLogger(__FILE__, 95, __PRETTY_FUNCTION__).warning("Failed to bind %sgraphicsbuffer to texture", "SW ");-
19 return
never executed: return false;
false;
never executed: return false;
0
20 }-
21 }
never executed: end of block
else {
0
22 QMessageLogger(__FILE__, 99, __PRETTY_FUNCTION__).warning("Failed to lock");-
23 return
never executed: return false;
false;
never executed: return false;
0
24 }-
25 return
never executed: return true;
true;
never executed: return true;
0
26}-
27bool QPlatformGraphicsBufferHelper::bindSWToTexture(const QPlatformGraphicsBuffer *graphicsBuffer,-
28 bool *swizzleRandB, bool *premultipliedB,-
29 const QRect &subRect)-
30{-
31-
32 QOpenGLContext *ctx = QOpenGLContext::currentContext();-
33 if (!ctx
!ctxDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
34 return
never executed: return false;
false;
never executed: return false;
0
35-
36 if (!(graphicsBuffer->isLocked() & QPlatformGraphicsBuffer::SWReadAccess)
!(graphicsBuff...:SWReadAccess)Description
TRUEnever evaluated
FALSEnever evaluated
)
0
37 return
never executed: return false;
false;
never executed: return false;
0
38-
39 QSize size = graphicsBuffer->size();-
40-
41 ((!(subRect.isEmpty() || QRect(QPoint(0,0), size).contains(subRect))) ? qt_assert("subRect.isEmpty() || QRect(QPoint(0,0), size).contains(subRect)",__FILE__,141) : qt_noop());-
42-
43 GLenum internalFormat = 0x1908;-
44 GLuint pixelType = 0x1401;-
45-
46 bool needsConversion = false;-
47 bool swizzle = false;-
48 bool premultiplied = false;-
49 QImage::Format imageformat = QImage::toImageFormat(graphicsBuffer->format());-
50 QImage image(graphicsBuffer->data(), size.width(), size.height(), graphicsBuffer->bytesPerLine(), imageformat);-
51 if (graphicsBuffer->bytesPerLine() != (size.width() * 4)
graphicsBuffer...e.width() * 4)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
52 needsConversion = true;-
53 }
never executed: end of block
else {
0
54 switch (imageformat) {-
55 case
never executed: case QImage::Format_ARGB32_Premultiplied:
QImage::Format_ARGB32_Premultiplied:
never executed: case QImage::Format_ARGB32_Premultiplied:
0
56 premultiplied = true;-
57-
58 case
never executed: case QImage::Format_RGB32:
QImage::Format_RGB32:
never executed: case QImage::Format_RGB32:
code before this statement never executed: case QImage::Format_RGB32:
0
59 case
never executed: case QImage::Format_ARGB32:
QImage::Format_ARGB32:
never executed: case QImage::Format_ARGB32:
0
60 swizzle = true;-
61 break;
never executed: break;
0
62 case
never executed: case QImage::Format_RGBA8888_Premultiplied:
QImage::Format_RGBA8888_Premultiplied:
never executed: case QImage::Format_RGBA8888_Premultiplied:
0
63 premultiplied = true;-
64-
65 case
never executed: case QImage::Format_RGBX8888:
QImage::Format_RGBX8888:
never executed: case QImage::Format_RGBX8888:
code before this statement never executed: case QImage::Format_RGBX8888:
0
66 case
never executed: case QImage::Format_RGBA8888:
QImage::Format_RGBA8888:
never executed: case QImage::Format_RGBA8888:
0
67 break;
never executed: break;
0
68 case
never executed: case QImage::Format_BGR30:
QImage::Format_BGR30:
never executed: case QImage::Format_BGR30:
0
69 case
never executed: case QImage::Format_A2BGR30_Premultiplied:
QImage::Format_A2BGR30_Premultiplied:
never executed: case QImage::Format_A2BGR30_Premultiplied:
0
70 if (!ctx->isOpenGLES()
!ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
|| ctx->format().majorVersion() >= 3
ctx->format()....Version() >= 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
71 pixelType = 0x8368;-
72 internalFormat = 0x8059;-
73 premultiplied = true;-
74 }
never executed: end of block
else {
0
75 needsConversion = true;-
76 }
never executed: end of block
0
77 break;
never executed: break;
0
78 case
never executed: case QImage::Format_RGB30:
QImage::Format_RGB30:
never executed: case QImage::Format_RGB30:
0
79 case
never executed: case QImage::Format_A2RGB30_Premultiplied:
QImage::Format_A2RGB30_Premultiplied:
never executed: case QImage::Format_A2RGB30_Premultiplied:
0
80 if (!ctx->isOpenGLES()
!ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
|| ctx->format().majorVersion() >= 3
ctx->format()....Version() >= 3Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
81 pixelType = 0x8368;-
82 internalFormat = 0x8059;-
83 premultiplied = true;-
84 swizzle = true;-
85 }
never executed: end of block
else {
0
86 needsConversion = true;-
87 }
never executed: end of block
0
88 break;
never executed: break;
0
89 default
never executed: default:
:
never executed: default:
0
90 needsConversion = true;-
91 break;
never executed: break;
0
92 }-
93 }-
94 if (needsConversion
needsConversionDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
95 image = image.convertToFormat(QImage::Format_RGBA8888);
never executed: image = image.convertToFormat(QImage::Format_RGBA8888);
0
96-
97 QOpenGLFunctions *funcs = ctx->functions();-
98-
99 QRect rect = subRect;-
100 if (rect.isNull()
rect.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
|| rect == QRect(QPoint(0,0),size)
rect == QRect(...int(0,0),size)Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
101 funcs->glTexImage2D(0x0DE1, 0, internalFormat, size.width(), size.height(), 0, 0x1908, pixelType, image.constBits());-
102 }
never executed: end of block
else {
0
103-
104 if (!ctx->isOpenGLES()
!ctx->isOpenGLES()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
105 funcs->glPixelStorei(0x0CF2, image.width());-
106 funcs->glTexSubImage2D(0x0DE1, 0, rect.x(), rect.y(), rect.width(), rect.height(), 0x1908, pixelType,-
107 image.constScanLine(rect.y()) + rect.x() * 4);-
108 funcs->glPixelStorei(0x0CF2, 0);-
109 }
never executed: end of block
else
0
110-
111 {-
112-
113-
114 if (rect.width() >= size.width() / 2
rect.width() >...ze.width() / 2Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
115 rect.setX(0);-
116 rect.setWidth(size.width());-
117 }
never executed: end of block
0
118-
119-
120-
121-
122 if (rect.width() == size.width()
rect.width() == size.width()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
123 funcs->glTexSubImage2D(0x0DE1, 0, 0, rect.y(), rect.width(), rect.height(), 0x1908, pixelType,-
124 image.constScanLine(rect.y()));-
125 }
never executed: end of block
else {
0
126 funcs->glTexSubImage2D(0x0DE1, 0, rect.x(), rect.y(), rect.width(), rect.height(), 0x1908, pixelType,-
127 image.copy(rect).constBits());-
128 }
never executed: end of block
0
129 }-
130 }-
131 if (swizzleRandB
swizzleRandBDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
132 *
never executed: *swizzleRandB = swizzle;
swizzleRandB = swizzle;
never executed: *swizzleRandB = swizzle;
0
133 if (premultipliedB
premultipliedBDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
134 *
never executed: *premultipliedB = premultiplied;
premultipliedB = premultiplied;
never executed: *premultipliedB = premultiplied;
0
135-
136 return
never executed: return true;
true;
never executed: return true;
0
137}-
138-
139-
Switch to Source codePreprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9