Changeset View
Changeset View
Standalone View
Standalone View
plugins/scenes/xrender/scene_xrender.cpp
Show First 20 Lines • Show All 243 Lines • ▼ Show 20 Line(s) | |||||
244 | } | 244 | } | ||
245 | 245 | | |||
246 | bool SceneXrender::initFailed() const | 246 | bool SceneXrender::initFailed() const | ||
247 | { | 247 | { | ||
248 | return false; | 248 | return false; | ||
249 | } | 249 | } | ||
250 | 250 | | |||
251 | // the entry point for painting | 251 | // the entry point for painting | ||
252 | qint64 SceneXrender::paint(QRegion damage, QList<Toplevel *> toplevels) | 252 | qint64 SceneXrender::paint(const QRegion &damage, const QList<Toplevel *> &toplevels) | ||
253 | { | 253 | { | ||
254 | QElapsedTimer renderTimer; | 254 | QElapsedTimer renderTimer; | ||
255 | renderTimer.start(); | 255 | renderTimer.start(); | ||
256 | 256 | | |||
257 | createStackingOrder(toplevels); | 257 | createStackingOrder(toplevels); | ||
258 | 258 | | |||
259 | int mask = 0; | 259 | int mask = 0; | ||
260 | QRegion updateRegion, validRegion; | 260 | QRegion updateRegion, validRegion; | ||
261 | paintScreen(&mask, damage, QRegion(), &updateRegion, &validRegion); | 261 | paintScreen(&mask, damage, QRegion(), &updateRegion, &validRegion); | ||
262 | 262 | | |||
263 | m_backend->showOverlay(); | 263 | m_backend->showOverlay(); | ||
264 | 264 | | |||
265 | m_backend->present(mask, updateRegion); | 265 | m_backend->present(mask, updateRegion); | ||
266 | // do cleanup | 266 | // do cleanup | ||
267 | clearStackingOrder(); | 267 | clearStackingOrder(); | ||
268 | 268 | | |||
269 | return renderTimer.nsecsElapsed(); | 269 | return renderTimer.nsecsElapsed(); | ||
270 | } | 270 | } | ||
271 | 271 | | |||
272 | void SceneXrender::paintGenericScreen(int mask, ScreenPaintData data) | 272 | void SceneXrender::paintGenericScreen(int mask, const ScreenPaintData &data) | ||
273 | { | 273 | { | ||
274 | screen_paint = data; // save, transformations will be done when painting windows | 274 | screen_paint = data; // save, transformations will be done when painting windows | ||
275 | Scene::paintGenericScreen(mask, data); | 275 | Scene::paintGenericScreen(mask, data); | ||
276 | } | 276 | } | ||
277 | 277 | | |||
278 | void SceneXrender::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) | 278 | void SceneXrender::paintDesktop(int desktop, int mask, const QRegion ®ion, ScreenPaintData &data) | ||
279 | { | 279 | { | ||
280 | PaintClipper::push(region); | 280 | PaintClipper::push(region); | ||
281 | KWin::Scene::paintDesktop(desktop, mask, region, data); | 281 | KWin::Scene::paintDesktop(desktop, mask, region, data); | ||
282 | PaintClipper::pop(region); | 282 | PaintClipper::pop(region); | ||
283 | } | 283 | } | ||
284 | 284 | | |||
285 | // fill the screen background | 285 | // fill the screen background | ||
286 | void SceneXrender::paintBackground(QRegion region) | 286 | void SceneXrender::paintBackground(const QRegion ®ion) | ||
287 | { | 287 | { | ||
288 | xcb_render_color_t col = { 0, 0, 0, 0xffff }; // black | 288 | xcb_render_color_t col = { 0, 0, 0, 0xffff }; // black | ||
289 | const QVector<xcb_rectangle_t> &rects = Xcb::regionToRects(region); | 289 | const QVector<xcb_rectangle_t> &rects = Xcb::regionToRects(region); | ||
290 | xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, xrenderBufferPicture(), col, rects.count(), rects.data()); | 290 | xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, xrenderBufferPicture(), col, rects.count(), rects.data()); | ||
291 | } | 291 | } | ||
292 | 292 | | |||
293 | Scene::Window *SceneXrender::createWindow(Toplevel *toplevel) | 293 | Scene::Window *SceneXrender::createWindow(Toplevel *toplevel) | ||
294 | { | 294 | { | ||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Line(s) | 409 | if (!s_tempPicture) { | |||
413 | xcb_free_pixmap(connection(), pix); | 413 | xcb_free_pixmap(connection(), pix); | ||
414 | } | 414 | } | ||
415 | const xcb_render_color_t transparent = {0, 0, 0, 0}; | 415 | const xcb_render_color_t transparent = {0, 0, 0, 0}; | ||
416 | const xcb_rectangle_t rect = {0, 0, uint16_t(temp_visibleRect.width()), uint16_t(temp_visibleRect.height())}; | 416 | const xcb_rectangle_t rect = {0, 0, uint16_t(temp_visibleRect.width()), uint16_t(temp_visibleRect.height())}; | ||
417 | xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *s_tempPicture, transparent, 1, &rect); | 417 | xcb_render_fill_rectangles(connection(), XCB_RENDER_PICT_OP_SRC, *s_tempPicture, transparent, 1, &rect); | ||
418 | } | 418 | } | ||
419 | 419 | | |||
420 | // paint the window | 420 | // paint the window | ||
421 | void SceneXrender::Window::performPaint(int mask, QRegion region, WindowPaintData data) | 421 | void SceneXrender::Window::performPaint(int mask, const QRegion &_region, const WindowPaintData &data) | ||
422 | { | 422 | { | ||
423 | QRegion region = _region; | ||||
423 | setTransformedShape(QRegion()); // maybe nothing will be painted | 424 | setTransformedShape(QRegion()); // maybe nothing will be painted | ||
424 | // check if there is something to paint | 425 | // check if there is something to paint | ||
425 | bool opaque = isOpaque() && qFuzzyCompare(data.opacity(), 1.0); | 426 | bool opaque = isOpaque() && qFuzzyCompare(data.opacity(), 1.0); | ||
426 | /* HACK: It seems this causes painting glitches, disable temporarily | 427 | /* HACK: It seems this causes painting glitches, disable temporarily | ||
427 | if (( mask & PAINT_WINDOW_OPAQUE ) ^ ( mask & PAINT_WINDOW_TRANSLUCENT )) | 428 | if (( mask & PAINT_WINDOW_OPAQUE ) ^ ( mask & PAINT_WINDOW_TRANSLUCENT )) | ||
428 | { // We are only painting either opaque OR translucent windows, not both | 429 | { // We are only painting either opaque OR translucent windows, not both | ||
429 | if ( mask & PAINT_WINDOW_OPAQUE && !opaque ) | 430 | if ( mask & PAINT_WINDOW_OPAQUE && !opaque ) | ||
430 | return; // Only painting opaque and window is translucent | 431 | return; // Only painting opaque and window is translucent | ||
▲ Show 20 Lines • Show All 458 Lines • ▼ Show 20 Line(s) | 889 | { | |||
889 | // TODO: implement me | 890 | // TODO: implement me | ||
890 | } | 891 | } | ||
891 | 892 | | |||
892 | void SceneXrender::EffectFrame::crossFadeText() | 893 | void SceneXrender::EffectFrame::crossFadeText() | ||
893 | { | 894 | { | ||
894 | // TODO: implement me | 895 | // TODO: implement me | ||
895 | } | 896 | } | ||
896 | 897 | | |||
897 | void SceneXrender::EffectFrame::render(QRegion region, double opacity, double frameOpacity) | 898 | void SceneXrender::EffectFrame::render(const QRegion ®ion, double opacity, double frameOpacity) | ||
898 | { | 899 | { | ||
899 | Q_UNUSED(region) | 900 | Q_UNUSED(region) | ||
900 | if (m_effectFrame->geometry().isEmpty()) { | 901 | if (m_effectFrame->geometry().isEmpty()) { | ||
901 | return; // Nothing to display | 902 | return; // Nothing to display | ||
902 | } | 903 | } | ||
903 | 904 | | |||
904 | // Render the actual frame | 905 | // Render the actual frame | ||
905 | if (m_effectFrame->style() == EffectFrameUnstyled) { | 906 | if (m_effectFrame->style() == EffectFrameUnstyled) { | ||
▲ Show 20 Lines • Show All 450 Lines • Show Last 20 Lines |