~gerboland/qtubuntu/devicePixelRatio

« back to all changes in this revision

Viewing changes to src/plugins/platforms/hybris/qhybrisbackingstore.cpp

  • Committer: Loïc Molinari
  • Date: 2012-09-26 13:46:46 UTC
  • Revision ID: loic.molinari@canonical.com-20120926134646-4j5m7r0h5sikzoes
Initial import.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright © 2012 Canonical Ltd
 
2
// FIXME(loicm) Add copyright notice here.
 
3
 
 
4
#include "qhybrisbackingstore.h"
 
5
#include <QtGui/QOpenGLContext>
 
6
#include <QtGui/QOpenGLPaintDevice>
 
7
 
 
8
QT_BEGIN_NAMESPACE
 
9
 
 
10
QHybrisBackingStore::QHybrisBackingStore(QWindow* window)
 
11
    : QPlatformBackingStore(window)
 
12
    , m_context(new QOpenGLContext) {
 
13
  m_context->setFormat(window->requestedFormat());
 
14
  m_context->setScreen(window->screen());
 
15
  m_context->create();
 
16
}
 
17
 
 
18
QHybrisBackingStore::~QHybrisBackingStore() {
 
19
  delete m_context;
 
20
}
 
21
 
 
22
QPaintDevice *QHybrisBackingStore::paintDevice() {
 
23
  return m_device;
 
24
}
 
25
 
 
26
void QHybrisBackingStore::flush(QWindow* window, const QRegion& region, const QPoint& offset) {
 
27
  Q_UNUSED(region);
 
28
  Q_UNUSED(offset);
 
29
 
 
30
#ifdef QHYBRIS_DEBUG
 
31
  qWarning("QEglBackingStore::flush %p", window);
 
32
#endif
 
33
  m_context->swapBuffers(window);
 
34
}
 
35
 
 
36
void QHybrisBackingStore::beginPaint(const QRegion& ) {
 
37
  window()->setSurfaceType(QSurface::OpenGLSurface);
 
38
  m_context->makeCurrent(window());
 
39
  m_device = new QOpenGLPaintDevice(window()->size());
 
40
}
 
41
 
 
42
void QHybrisBackingStore::endPaint() {
 
43
  delete m_device;
 
44
}
 
45
 
 
46
void QHybrisBackingStore::resize(const QSize& size, const QRegion& staticContents) {
 
47
  Q_UNUSED(size);
 
48
  Q_UNUSED(staticContents);
 
49
}
 
50
 
 
51
QT_END_NAMESPACE