source: trunk/src/gui/painting/qwindowsurface_s60.cpp@ 938

Last change on this file since 938 was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

  • Property svn:eol-style set to native
File size: 7.7 KB
RevLine 
[556]1/****************************************************************************
2**
[846]3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
[556]4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#include <qglobal.h> // for Q_WS_WIN define (non-PCH)
43
44#include <QtGui/qpaintdevice.h>
45#include <private/qwidget_p.h>
[846]46#include <private/qwindowsurface_s60_p.h>
47#include <private/qpixmap_s60_p.h>
48#include <private/qt_s60_p.h>
49#include <private/qapplication_p.h>
50#include <private/qdrawhelper_p.h>
[556]51
[846]52#ifdef QT_GRAPHICSSYSTEM_RUNTIME
53#include <private/qgraphicssystem_runtime_p.h>
54#endif
55
[556]56QT_BEGIN_NAMESPACE
57
58struct QS60WindowSurfacePrivate
59{
60 QPixmap device;
61 QList<QImage*> bufferImages;
62};
63
[846]64TDisplayMode displayMode(bool opaque)
[556]65{
66
67 TDisplayMode mode = S60->screenDevice()->DisplayMode();
[846]68 if (opaque) {
69 mode = EColor16MU;
70 } else {
71 if (QSysInfo::symbianVersion() >= QSysInfo::SV_SF_3)
72 mode = Q_SYMBIAN_ECOLOR16MAP; // Symbian^3 WServ has support for ARGB32_PRE
73 else
74 mode = EColor16MA; // Symbian prior to Symbian^3 sw accelerates EColor16MA
75 }
76 return mode;
77}
[556]78
[846]79QS60WindowSurface::QS60WindowSurface(QWidget* widget)
80 : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate)
81{
82 TDisplayMode mode = displayMode(qt_widget_private(widget)->isOpaque);
[556]83 // We create empty CFbsBitmap here -> it will be resized in setGeometry
84 CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new
85 qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) );
[769]86
[556]87 QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType);
88 if (data) {
89 data->fromSymbianBitmap(bitmap, true);
90 d_ptr->device = QPixmap(data);
91 }
[769]92
[556]93 setStaticContentsSupport(true);
94}
[846]95
[556]96QS60WindowSurface::~QS60WindowSurface()
97{
[846]98#if defined(QT_GRAPHICSSYSTEM_RUNTIME) && defined(Q_SYMBIAN_SUPPORTS_SURFACES)
99 if(QApplicationPrivate::runtime_graphics_system) {
100 QRuntimeGraphicsSystem *runtimeGraphicsSystem =
101 static_cast<QRuntimeGraphicsSystem*>(QApplicationPrivate::graphics_system);
102 if(runtimeGraphicsSystem->graphicsSystemName() == QLatin1String("openvg")) {
103
104 // Graphics system has been switched from raster to openvg.
105 // Issue empty redraw to clear the UI surface
106
107 QWidget *w = window();
108 if (w->testAttribute(Qt::WA_WState_Created)) {
109 RWindow *const window = static_cast<RWindow *>(w->winId()->DrawableWindow());
110 window->BeginRedraw();
111 window->EndRedraw();
112 }