qbackingstore.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/gui/painting/qbackingstore.cpp
Switch to Source codePreprocessed file
LineSourceCount
1-
2-
3-
4-
5-
6class QBackingStorePrivate-
7{-
8public:-
9 QBackingStorePrivate(QWindow *w)-
10 : window(w)-
11 {-
12 }
never executed: end of block
0
13-
14 QWindow *window;-
15 QPlatformBackingStore *platformBackingStore;-
16 QScopedPointer<QImage> highDpiBackingstore;-
17 QRegion staticContents;-
18 QSize size;-
19};-
20void QBackingStore::flush(const QRegion &region, QWindow *win, const QPoint &offset)-
21{-
22 if (!win
!winDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
23 win = window();
never executed: win = window();
0
24 if (!win->handle()
!win->handle()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
25 QMessageLogger(__FILE__, 103, __PRETTY_FUNCTION__).warning() << "QBackingStore::flush() called for "-
26 << win << " which does not have a handle.";-
27 return;
never executed: return;
0
28 }-
29 d_ptr->platformBackingStore->flush(win, QHighDpi::toNativeLocalRegion(region, win),-
30 QHighDpi::toNativeLocalPosition(offset, win));-
31}
never executed: end of block
0
32-
33-
34-
35-
36-
37-
38QPaintDevice *QBackingStore::paintDevice()-
39{-
40 QPaintDevice *device = d_ptr->platformBackingStore->paintDevice();-
41-
42 if (QHighDpiScaling::isActive()
QHighDpiScaling::isActive()Description
TRUEnever evaluated
FALSEnever evaluated
&& device->devType() == QInternal::Image
device->devTyp...nternal::ImageDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
43 return
never executed: return d_ptr->highDpiBackingstore.data();
d_ptr->highDpiBackingstore.data();
never executed: return d_ptr->highDpiBackingstore.data();
0
44-
45 return
never executed: return device;
device;
never executed: return device;
0
46}-
47-
48-
49-
50-
51QBackingStore::QBackingStore(QWindow *window)-
52 : d_ptr(new QBackingStorePrivate(window))-
53{-
54 d_ptr->platformBackingStore = QGuiApplicationPrivate::platformIntegration()->createPlatformBackingStore(window);-
55}
never executed: end of block
0
56-
57-
58-
59-
60QBackingStore::~QBackingStore()-
61{-
62 delete d_ptr->platformBackingStore;-
63}
never executed: end of block
0
64-
65-
66-
67-
68-
69QWindow* QBackingStore::window() const-
70{-
71 return
never executed: return d_ptr->window;
d_ptr->window;
never executed: return d_ptr->window;
0
72}-
73void QBackingStore::beginPaint(const QRegion &region)-
74{-
75 if (d_ptr->highDpiBackingstore
d_ptr->highDpiBackingstoreDescription
TRUEnever evaluated
FALSEnever evaluated
&&
0
76 d_ptr->highDpiBackingstore->devicePixelRatio() != d_ptr->window->devicePixelRatio()
d_ptr->highDpi...cePixelRatio()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
77 resize(size());
never executed: resize(size());
0
78-
79 d_ptr->platformBackingStore->beginPaint(QHighDpi::toNativeLocalRegion(region, d_ptr->window));-
80-
81-
82-
83-
84-
85-
86-
87 QPaintDevice *device = d_ptr->platformBackingStore->paintDevice();-
88 if (QHighDpiScaling::isActive()
QHighDpiScaling::isActive()Description
TRUEnever evaluated
FALSEnever evaluated
&& device->devType() == QInternal::Image
device->devTyp...nternal::ImageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
89 QImage *source = static_cast<QImage *>(device);-
90 const bool needsNewImage = d_ptr->highDpiBackingstore.isNull()
d_ptr->highDpi...store.isNull()Description
TRUEnever evaluated
FALSEnever evaluated
0
91 || source->data_ptr() != d_ptr->highDpiBackingstore->data_ptr()
source->data_p...re->data_ptr()Description
TRUEnever evaluated
FALSEnever evaluated
0
92 || source->size() != d_ptr->highDpiBackingstore->size()
source->size()...gstore->size()Description
TRUEnever evaluated
FALSEnever evaluated
0
93 || source->devicePixelRatio() != d_ptr->highDpiBackingstore->devicePixelRatio()
source->device...cePixelRatio()Description
TRUEnever evaluated
FALSEnever evaluated
;
0
94 if (needsNewImage
needsNewImageDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
95 for (bool qt_category_enabled = lcScaling().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 189, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() << "QBackingStore::beginPaint new backingstore for" << d_ptr->window;
never executed: QMessageLogger(__FILE__, 189, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() << "QBackingStore::beginPaint new backingstore for" << d_ptr->window;
0
96 for (bool qt_category_enabled = lcScaling().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 190, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() << " source size" << source->size() << "dpr" << source->devicePixelRatio();
never executed: QMessageLogger(__FILE__, 190, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() << " source size" << source->size() << "dpr" << source->devicePixelRatio();
0
97 d_ptr->highDpiBackingstore.reset(-
98 new QImage(source->bits(), source->width(), source->height(), source->bytesPerLine(), source->format()));-
99-
100 qreal targetDevicePixelRatio = d_ptr->window->devicePixelRatio();-
101 d_ptr->highDpiBackingstore->setDevicePixelRatio(targetDevicePixelRatio);-
102 for (bool qt_category_enabled = lcScaling().isDebugEnabled(); qt_category_enabled
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
; qt_category_enabled = false) QMessageLogger(__FILE__, 196, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() <<" destination size" << d_ptr->highDpiBackingstore->size()
never executed: QMessageLogger(__FILE__, 196, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() <<" destination size" << d_ptr->highDpiBackingstore->size() << "dpr" << targetDevicePixelRatio;
0
103 << "dpr" << targetDevicePixelRatio;
never executed: QMessageLogger(__FILE__, 196, __PRETTY_FUNCTION__, lcScaling().categoryName()).debug() <<" destination size" << d_ptr->highDpiBackingstore->size() << "dpr" << targetDevicePixelRatio;
0
104 }
never executed: end of block
0
105 }
never executed: end of block
0
106}
never executed: end of block
0
107-
108-
109-
110-
111-
112-
113void QBackingStore::endPaint()-
114{-
115 d_ptr->platformBackingStore->endPaint();-
116}
never executed: end of block
0
117-
118-
119-
120-
121-
122-
123void QBackingStore::resize(const QSize &size)-
124{-
125 d_ptr->size = size;-
126 d_ptr->platformBackingStore->resize(QHighDpi::toNativePixels(size, d_ptr->window), d_ptr->staticContents);-
127}
never executed: end of block
0
128-
129-
130-
131-
132QSize QBackingStore::size() const-
133{-
134 return
never executed: return d_ptr->size;
d_ptr->size;
never executed: return d_ptr->size;
0
135}-
136-
137-
138-
139-
140-
141-
142-
143bool QBackingStore::scroll(const QRegion &area, int dx, int dy)-
144{-
145-
146-
147-
148 const qreal nativeDx = QHighDpi::toNativePixels(qreal(dx), d_ptr->window);-
149 const qreal nativeDy = QHighDpi::toNativePixels(qreal(dy), d_ptr->window);-
150 if (qFloor(nativeDx) != nativeDx
qFloor(nativeDx) != nativeDxDescription
TRUEnever evaluated
FALSEnever evaluated
|| qFloor(nativeDy) != nativeDy
qFloor(nativeDy) != nativeDyDescription
TRUEnever evaluated
FALSEnever evaluated
)
0
151 return
never executed: return false;
false;
never executed: return false;
0
152-
153 return
never executed: return d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window), nativeDx, nativeDy);
d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window),
never executed: return d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window), nativeDx, nativeDy);
0
154 nativeDx, nativeDy);
never executed: return d_ptr->platformBackingStore->scroll(QHighDpi::toNativeLocalRegion(area, d_ptr->window), nativeDx, nativeDy);
0
155}-
156-
157-
158-
159-
160void QBackingStore::setStaticContents(const QRegion &region)-
161{-
162 d_ptr->staticContents = region;-
163}
never executed: end of block
0
164-
165-
166-
167-
168-
169QRegion QBackingStore::staticContents() const-
170{-
171 return
never executed: return d_ptr->staticContents;
d_ptr->staticContents;
never executed: return d_ptr->staticContents;
0
172}-
173-
174-
175-
176-
177-
178bool QBackingStore::hasStaticContents() const-
179{-
180 return
never executed: return !d_ptr->staticContents.isEmpty();
!d_ptr->staticContents.isEmpty();
never executed: return !d_ptr->staticContents.isEmpty();
0
181}-
182-
183void __attribute__((visibility("default"))) qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)-
184{-
185-
186 uchar *mem = const_cast<uchar*>(const_cast<const QImage &>(img).bits());-
187-
188 int lineskip = img.bytesPerLine();-
189 int depth = img.depth() >> 3;-
190-
191 const QRect imageRect(0, 0, img.width(), img.height());-
192 const QRect r = rect & imageRect & imageRect.translated(-offset);-
193 const QPoint p = rect.topLeft() + offset;-
194-
195 if (r.isEmpty()
r.isEmpty()Description
TRUEnever evaluated
FALSEnever evaluated
)
0
196 return;
never executed: return;
0
197-
198 const uchar *src;-
199 uchar *dest;-
200-
201 if (r.top() < p.y()
r.top() < p.y()Description
TRUEnever evaluated
FALSEnever evaluated
) {
0
202 src = mem + r.bottom() * lineskip + r.left() * depth;-
203 dest = mem + (p.y() + r.height() - 1) * lineskip + p.x() * depth;-
204 lineskip = -lineskip;-
205 }
never executed: end of block
else {
0
206 src = mem + r.top() * lineskip + r.left() * depth;-
207 dest = mem + p.y() * lineskip + p.x() * depth;-
208 }
never executed: end of block
0
209-
210 const int w = r.width();-
211 int h = r.height();-
212 const int bytes = w * depth;-
213-
214-
215 if (offset.y() == 0
offset.y() == 0Description
TRUEnever evaluated
FALSEnever evaluated
&& qAbs(offset.x()) < w
qAbs(offset.x()) < wDescription
TRUEnever evaluated
FALSEnever evaluated
) {
0
216 do {-
217 ::memmove(dest, src, bytes);-
218 dest += lineskip;-
219 src += lineskip;-
220 }
never executed: end of block
while (--
--hDescription
TRUEnever evaluated
FALSEnever evaluated
h
--hDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
221 }
never executed: end of block
else {
0
222 do {-
223 ::memcpy(dest, src, bytes);-
224 dest += lineskip;-
225 src += lineskip;-
226 }
never executed: end of block
while (--
--hDescription
TRUEnever evaluated
FALSEnever evaluated
h
--hDescription
TRUEnever evaluated
FALSEnever evaluated
);
0
227 }
never executed: end of block
0
228}-
229-
230-
231-
232-
233QPlatformBackingStore *QBackingStore::handle() const-
234{-
235 return
never executed: return d_ptr->platformBackingStore;
d_ptr->platformBackingStore;
never executed: return d_ptr->platformBackingStore;
0
236}-
237-
238-
Switch to Source codePreprocessed file

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