source: trunk/src/openvg/qwindowsurface_vg.cpp@ 1028

Last change on this file since 1028 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.0 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 QtOpenVG 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 "qwindowsurface_vg_p.h"
43#include "qwindowsurface_vgegl_p.h"
44#include "qpaintengine_vg_p.h"
45#include "qpixmapdata_vg_p.h"
46#include "qvg_p.h"
47
48#if !defined(QT_NO_EGL)
49
50#include <QtGui/private/qeglcontext_p.h>
51#include <QtGui/private/qwidget_p.h>
52
53QT_BEGIN_NAMESPACE
54
55QVGWindowSurface::QVGWindowSurface(QWidget *window)
56 : QWindowSurface(window)
57{
58 // Create the default type of EGL window surface for windows.
59 d_ptr = new QVGEGLWindowSurfaceDirect(this);
60 setStaticContentsSupport(d_ptr->supportsStaticContents());
61}
62
63QVGWindowSurface::QVGWindowSurface
64 (QWidget *window, QVGEGLWindowSurfacePrivate *d)
65 : QWindowSurface(window), d_ptr(d)
66{
67}
68
69QVGWindowSurface::~QVGWindowSurface()
70{
71 delete d_ptr;
72}
73
74QPaintDevice *QVGWindowSurface::paintDevice()
75{
76 return this;
77}
78
79void QVGWindowSurface::flush(QWidget *widget, const QRegion &region, const QPoint &offset)
80{
81 Q_UNUSED(offset);
82 QWidget *parent = widget->internalWinId() ? widget : widget->nativeParentWidget();
83 d_ptr->endPaint(parent, region);
84}
85
86void QVGWindowSurface::setGeometry(const QRect &rect)
87{
88 QWindowSurface::setGeometry(rect);
89}
90
91bool QVGWindowSurface::scroll(const QRegion &area, int dx, int dy)
92{
93 if (!d_ptr->scroll(window(), area, dx, dy))
94 return QWindowSurface::scroll(area, dx, dy);
95 return true;
96}
97
98void QVGWindowSurface::beginPaint(const QRegion &region)
99{
100 d_ptr->beginPaint(window());
101
102 // If the window is not opaque, then fill the region we are about
103 // to paint with the transparent color.
104 if (!qt_widget_private(window())->isOpaque &&
105 window()->testAttribute(Qt::WA_TranslucentBackground)) {
106 QVGPaintEngine *engine = static_cast<QVGPaintEngine *>
107 (d_ptr->paintEngine());
108 engine->fillRegion(region, Qt::transparent, d_ptr->surfaceSize());
109 }
110}
111
112void QVGWindowSurface::endPaint(const QRegion &region)
113{
114 // Nothing to do here.
115 Q_UNUSED(region);
116}
117
118QPaintEngine *QVGWindowSurface::paintEngine() const
119{
120 return d_ptr->paintEngine();
121}
122
123int QVGWindowSurface::metric(PaintDeviceMetric met) const
124{
125 return qt_paint_device_metric(window(), met);
126}
127
128QT_END_NAMESPACE
129
130#endif
Note: See TracBrowser for help on using the repository browser.