source: trunk/src/gui/painting/qpaintengine_s60.cpp

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

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

  • Property svn:eol-style set to native
File size: 4.5 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
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#include <private/qpaintengine_s60_p.h>
42#include <private/qpixmap_s60_p.h>
43#include <private/qt_s60_p.h>
44
45QT_BEGIN_NAMESPACE
46
47class QS60PaintEnginePrivate : public QRasterPaintEnginePrivate
48{
49public:
50 QS60PaintEnginePrivate() {}
51};
52
53QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data)
54 : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data)
55{
56}
57
58bool QS60PaintEngine::begin(QPaintDevice *device)
59{
60 Q_D(QS60PaintEngine);
61
62 if (pixmapData->classId() == QPixmapData::RasterClass) {
63 pixmapData->beginDataAccess();
64 bool ret = QRasterPaintEngine::begin(device);
65 // Make sure QPaintEngine::paintDevice() returns the proper device.
66 // QRasterPaintEngine changes pdev to QImage in case of RasterClass QPixmapData
67 // which is incorrect in Symbian.
68 d->pdev = device;
69 return ret;
70 }
71
72 return QRasterPaintEngine::begin(device);
73}
74
75bool QS60PaintEngine::end()
76{
77 if (pixmapData->classId() == QPixmapData::RasterClass) {
78 bool ret = QRasterPaintEngine::end();
79 pixmapData->endDataAccess();
80 return ret;
81 }
82 return QRasterPaintEngine::end();
83}
84
85void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm)
86{
87 if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
88 QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
89 srcData->beginDataAccess();
90 QRasterPaintEngine::drawPixmap(p, pm);
91 srcData->endDataAccess();
92 } else {
93 QRasterPaintEngine::drawPixmap(p, pm);
94 }
95}
96
97void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr)
98{
99 if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
100 QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
101 srcData->beginDataAccess();
102 QRasterPaintEngine::drawPixmap(r, pm, sr);
103 srcData->endDataAccess();
104 } else {
105 QRasterPaintEngine::drawPixmap(r, pm, sr);
106 }
107}
108
109void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr)
110{
111 if (pm.pixmapData()->classId() == QPixmapData::RasterClass) {
112 QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData());
113 srcData->beginDataAccess();
114 QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
115 srcData->endDataAccess();
116 } else {
117 QRasterPaintEngine::drawTiledPixmap(r, pm, sr);
118 }
119}
120
121void QS60PaintEngine::prepare(QImage *image)
122{
123 QRasterBuffer *buffer = d_func()->rasterBuffer.data();
124 if (buffer)
125 buffer->prepare(image);
126}
127
128QT_END_NAMESPACE
Note: See TracBrowser for help on using the repository browser.