Ignore:
Timestamp:
Feb 11, 2010, 11:19:06 PM (15 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.6.1 sources.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/gui/styles/qgtkpainter.cpp

    r2 r561  
    22**
    33** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
    4 ** Contact: Qt Software Information ([email protected])
     4** All rights reserved.
     5** Contact: Nokia Corporation ([email protected])
    56**
    67** This file is part of the QtGui module of the Qt Toolkit.
     
    2122** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
    2223**
    23 ** In addition, as a special exception, Nokia gives you certain
    24 ** additional rights. These rights are described in the Nokia Qt LGPL
    25 ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
    26 ** package.
     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.
    2727**
    2828** GNU General Public License Usage
     
    3434** met: http://www.gnu.org/copyleft/gpl.html.
    3535**
    36 ** If you are unsure which license is appropriate for your use, please
    37 ** contact the sales department at qt-sales@nokia.com.
     36** If you
     37** @nokia.com.
    3838** $QT_END_LICENSE$
    3939**
     
    109109    QRect pixmapRect(0, 0, rect.width(), rect.height());                                           \
    110110    {                                                                                              \
    111         GdkPixmap *pixmap = QGtk::gdk_pixmap_new((GdkDrawable*)(m_window->window),                    \
     111        GdkPixmap *pixmap = QGtk::gdk_pixmap_new((GdkDrawable*)(m_window->window),                    \
    112112                                            rect.width(), rect.height(), -1);                      \
    113113        if (!pixmap)                                                                               \
    114114            return;                                                                                \
    115         style = QGtk::gtk_style_attach (style, m_window->window);                                  \
    116         QGtk::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true,                \
     115        style = QGtk::gtk_style_attach (style, m_window->window);                                  \
     116        QGtk::gdk_draw_rectangle(pixmap, m_alpha ? style->black_gc : *style->bg_gc, true,                \
    117117                           0, 0, rect.width(), rect.height());                                     \
    118118        draw_func;                                                                                 \
    119         GdkPixbuf *imgb = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\
     119        GdkPixbuf *imgb = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.width(), rect.height());\
    120120        if (!imgb)                                                                                 \
    121121            return;                                                                                \
    122         imgb = QGtk::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0,                  \
     122        imgb = QGtk::gdk_pixbuf_get_from_drawable(imgb, pixmap, NULL, 0, 0, 0, 0,                  \
    123123                                            rect.width(), rect.height());                          \
    124         uchar* bdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgb);                                  \
     124        uchar* bdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgb);                                  \
    125125        if (m_alpha) {                                                                             \
    126             QGtk::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height());  \
     126            QGtk::gdk_draw_rectangle(pixmap, style->white_gc, true, 0, 0, rect.width(), rect.height());  \
    127127            draw_func;                                                                             \
    128             GdkPixbuf *imgw = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.              \
     128            GdkPixbuf *imgw = QGtk::gdk_pixbuf_new(GDK_COLORSPACE_RGB, true, 8, rect.              \
    129129                                             width(), rect.height());                              \
    130130            if (!imgw)                                                                             \
    131131                return;                                                                            \
    132             imgw = QGtk::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0,              \
     132            imgw = QGtk::gdk_pixbuf_get_from_drawable(imgw, pixmap, NULL, 0, 0, 0, 0,              \
    133133                                                rect.width(), rect.height());                      \
    134             uchar* wdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgw);                                    \
     134            uchar* wdata = (uchar*)QGtk::gdk_pixbuf_get_pixels(imgw);                                    \
    135135            cache = renderTheme(bdata, wdata, rect);                                               \
    136             QGtk::gdk_pixbuf_unref(imgw);                                                          \
     136            QGtk::gdk_pixbuf_unref(imgw);                                                          \
    137137        } else {                                                                                   \
    138138            cache = renderTheme(bdata, 0, rect);                                                   \
    139139        }                                                                                          \
    140         QGtk::gdk_drawable_unref(pixmap);                                                          \
    141         QGtk::gdk_pixbuf_unref(imgb);                                                              \
     140        QGtk::gdk_drawable_unref(pixmap);                                                          \
     141        QGtk::gdk_pixbuf_unref(imgb);                                                              \
    142142    }
    143143
    144144QGtkPainter::QGtkPainter(QPainter *_painter)
    145         : m_window(QGtk::gtkWidget(QLatin1String("GtkWindow")))
     145        : m_window(QGtk::gtkWidget(QLatin1String("GtkWindow")))
    146146        , m_painter(_painter)
    147147        , m_alpha(true)
     
    186186QPixmap QGtkPainter::getIcon(const char* iconName, GtkIconSize size)
    187187{
    188     GtkStyle *style = QGtk::gtkStyle();
    189     GtkIconSet* iconSet  = QGtk::gtk_icon_factory_lookup_default (iconName);
    190     GdkPixbuf* icon = QGtk::gtk_icon_set_render_icon(iconSet,
     188    GtkStyle *style = QGtk::gtkStyle();
     189    GtkIconSet* iconSet  = QGtk::gtk_icon_factory_lookup_default (iconName);
     190    GdkPixbuf* icon = QGtk::gtk_icon_set_render_icon(iconSet,
    191191                                                 style,
    192192                                                 GTK_TEXT_DIR_LTR,
     
    195195                                                 NULL,
    196196                                                 "button");
    197     uchar* data = (uchar*)QGtk::gdk_pixbuf_get_pixels(icon);
    198     int width = QGtk::gdk_pixbuf_get_width(icon);
    199     int height = QGtk::gdk_pixbuf_get_height(icon);
     197    uchar* data = (uchar*)QGtk::gdk_pixbuf_get_pixels(icon);
     198    int width = QGtk::gdk_pixbuf_get_width(icon);
     199    int height = QGtk::gdk_pixbuf_get_height(icon);
    200200    QImage converted(width, height, QImage::Format_ARGB32);
    201201    uchar* tdata = (uchar*)converted.bits();
     
    209209    }
    210210
    211     QGtk::gdk_pixbuf_unref(icon);
     211    QGtk::gdk_pixbuf_unref(icon);
    212212
    213213    // should we free iconset?
     
    241241
    242242    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    243         DRAW_TO_CACHE(QGtk::gtk_paint_box_gap (style,
     243        DRAW_TO_CACHE(QGtk::gtk_paint_box_gap (style,
    244244                                           pixmap,
    245245                                           state,
     
    306306
    307307    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    308         DRAW_TO_CACHE(QGtk::gtk_paint_box (style,
     308        DRAW_TO_CACHE(QGtk::gtk_paint_box (style,
    309309                                           pixmap,
    310310                                           state,
     
    357357                         + hLineExtras + pmKey;
    358358    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    359         DRAW_TO_CACHE(QGtk::gtk_paint_hline (style,
     359        DRAW_TO_CACHE(QGtk::gtk_paint_hline (style,
    360360                                         pixmap,
    361361                                         state,
     
    384384                                    gtkWidget) + vLineExtras +pmKey;
    385385    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    386         DRAW_TO_CACHE(QGtk::gtk_paint_vline (style,
     386        DRAW_TO_CACHE(QGtk::gtk_paint_vline (style,
    387387                                         pixmap,
    388388                                         state,
     
    411411                                    gtkWidget) + QString::number(expander_state) + pmKey;
    412412    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    413         DRAW_TO_CACHE(QGtk::gtk_paint_expander (style, pixmap,
     413        DRAW_TO_CACHE(QGtk::gtk_paint_expander (style, pixmap,
    414414                                            state, NULL,
    415415                                            gtkWidget, part,
     
    434434    QString pixmapName = uniqueName(QLS(part), state, GTK_SHADOW_NONE, rect.size(), gtkWidget) + pmKey;
    435435    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    436         DRAW_TO_CACHE(QGtk::gtk_paint_focus (style, pixmap, state, NULL,
     436        DRAW_TO_CACHE(QGtk::gtk_paint_focus (style, pixmap, state, NULL,
    437437                                         gtkWidget,
    438438                                         part,
     
    459459    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey;
    460460    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    461         DRAW_TO_CACHE(QGtk::gtk_paint_resize_grip (style, pixmap, state,
     461        DRAW_TO_CACHE(QGtk::gtk_paint_resize_grip (style, pixmap, state,
    462462                                               NULL, gtkWidget,
    463463                                               part, edge, 0, 0,
     
    489489    int yOffset = m_cliprect.isValid() ? arrowrect.y() - m_cliprect.y() : 0;
    490490    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    491         DRAW_TO_CACHE(QGtk::gtk_paint_arrow (style, pixmap, state, shadow,
     491        DRAW_TO_CACHE(QGtk::gtk_paint_arrow (style, pixmap, state, shadow,
    492492                                         &gtkCliprect,
    493493                                         gtkWidget,
     
    516516                         + QString::number(orientation);
    517517    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    518         DRAW_TO_CACHE(QGtk::gtk_paint_handle (style,
     518        DRAW_TO_CACHE(QGtk::gtk_paint_handle (style,
    519519                                          pixmap,
    520520                                          state,
     
    544544    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size(), gtkWidget) + pmKey;
    545545    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    546         DRAW_TO_CACHE(QGtk::gtk_paint_slider (style,
     546        DRAW_TO_CACHE(QGtk::gtk_paint_slider (style,
    547547                                          pixmap,
    548548                                          state,
     
    575575    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey;
    576576    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    577         DRAW_TO_CACHE(QGtk::gtk_paint_shadow(style, pixmap, state, shadow, NULL,
     577        DRAW_TO_CACHE(QGtk::gtk_paint_shadow(style, pixmap, state, shadow, NULL,
    578578                                         gtkWidget, part, 0, 0, rect.width(), rect.height()));
    579579        if (m_usePixmapCache)
     
    594594    QString pixmapName = uniqueName(QLS(part), state, shadow, rect.size()) + pmKey;
    595595    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    596         DRAW_TO_CACHE(QGtk::gtk_paint_flat_box (style,
     596        DRAW_TO_CACHE(QGtk::gtk_paint_flat_box (style,
    597597                                            pixmap,
    598598                                            state,
     
    623623
    624624    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    625         DRAW_TO_CACHE(QGtk::gtk_paint_extension (style, pixmap, state, shadow,
     625        DRAW_TO_CACHE(QGtk::gtk_paint_extension (style, pixmap, state, shadow,
    626626                                             NULL, gtkWidget,
    627627                                             (gchar*)part, 0, 0,
     
    652652    int yOffset = m_cliprect.isValid() ? radiorect.y() - m_cliprect.y() : 0;
    653653    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    654         DRAW_TO_CACHE(QGtk::gtk_paint_option(style, pixmap,
     654        DRAW_TO_CACHE(QGtk::gtk_paint_option(style, pixmap,
    655655                                         state, shadow,
    656656                                         &gtkCliprect,
     
    684684    int yOffset = m_cliprect.isValid() ? checkrect.y() - m_cliprect.y() : 0;
    685685    if (!m_usePixmapCache || !QPixmapCache::find(pixmapName, cache)) {
    686         DRAW_TO_CACHE(QGtk::gtk_paint_check (style,
     686        DRAW_TO_CACHE(QGtk::gtk_paint_check (style,
    687687                                         pixmap,
    688688                                         state,
Note: See TracChangeset for help on using the changeset viewer.