diff options
author | Timothy Pearson <[email protected]> | 2012-11-21 20:19:51 -0600 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-11-21 20:19:51 -0600 |
commit | 25eb56b1afbf770ece64541bff15893bf909ce1a (patch) | |
tree | 952691552f848ec310a7a277fdf8270f41ce2a53 /tdegtk/tdegtk-draw.cpp | |
parent | 0762fd31c7ac342ef87b651c2b29ccc037e33091 (diff) | |
download | gtk3-tqt-engine-25eb56b1afbf770ece64541bff15893bf909ce1a.tar.gz gtk3-tqt-engine-25eb56b1afbf770ece64541bff15893bf909ce1a.zip |
Increase drawing speed
Diffstat (limited to 'tdegtk/tdegtk-draw.cpp')
-rw-r--r-- | tdegtk/tdegtk-draw.cpp | 145 |
1 files changed, 71 insertions, 74 deletions
diff --git a/tdegtk/tdegtk-draw.cpp b/tdegtk/tdegtk-draw.cpp index fe03272..4d34823 100644 --- a/tdegtk/tdegtk-draw.cpp +++ b/tdegtk/tdegtk-draw.cpp @@ -455,8 +455,8 @@ draw_combobox_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, G if (GTK_IS_COMBO_BOX(parent)) { const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(parent); TQRect boundingRect(0, 0, allocation.width, allocation.height); - TQt3CairoPaintDevice pd2(NULL, allocation.x, allocation.y, allocation.width, allocation.height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, allocation.x, allocation.y, allocation.width, allocation.height, cr); + TQPainter p(&pd); TQStringList objectTypes; objectTypes.append(TQCOMBOBOX_OBJECT_NAME_STRING); @@ -478,8 +478,8 @@ draw_combobox_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, G } // Draw item - //tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ComboBoxFrame, TQStyle::SC_None); - tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_All, TQStyle::SC_None); + //tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_ComboBoxFrame, TQStyle::SC_None); + tqApp->style().drawComplexControl(TQStyle::CC_ComboBox, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget), TQStyle::SC_All, TQStyle::SC_None); } cairo_restore(cr); @@ -498,8 +498,8 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state if (GTK_IS_PROGRESS_BAR(widget)) { const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); TQRect boundingRect(0, 0, allocation.width, allocation.height); - TQt3CairoPaintDevice pd2(NULL, allocation.x, allocation.y, allocation.width, allocation.height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, allocation.x, allocation.y, allocation.width, allocation.height, cr); + TQPainter p(&pd); TQStringList objectTypes; objectTypes.append(TQPROGRESSBAR_OBJECT_NAME_STRING); @@ -529,13 +529,13 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state // Draw background TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Base); - DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p2, brush) + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) // Draw frame progressBarGrooveRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); progressBarContentsRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); - tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &p2, ceData, elementFlags, progressBarGrooveRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); + tqApp->style().drawControl(TQStyle::CE_ProgressBarGroove, &p, ceData, elementFlags, progressBarGrooveRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); // Draw contents if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_VERTICAL)) { @@ -551,7 +551,7 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state m.rotate(-90.0); m.translate((allocation.height)*(-1.0), 0); - p2.setWorldMatrix(m, TRUE); + p.setWorldMatrix(m, TRUE); boundingRect = TQRect(0, 0, allocation.height, allocation.width); ceData.rect = boundingRect; @@ -560,7 +560,7 @@ draw_progressbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state progressBarGrooveRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarGroove, ceData, elementFlags, NULL), ceData, elementFlags); progressBarContentsRect = TQStyle::visualRect(tqApp->style().subRect(TQStyle::SR_ProgressBarContents, ceData, elementFlags, NULL), ceData, elementFlags); - tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p2, ceData, elementFlags, progressBarContentsRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); + tqApp->style().drawControl(TQStyle::CE_ProgressBarContents, &p, ceData, elementFlags, progressBarContentsRect, ((state & GTK_STATE_FLAG_INSENSITIVE)?objectPalette.disabled():objectPalette.active()), sflags); } cairo_restore(cr); @@ -583,8 +583,8 @@ draw_slider_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, Gtk gtk_range_get_range_rect(GTK_RANGE(widget), &rangeRect); TQRect boundingRect(0, 0, rangeRect.width, rangeRect.height); - TQt3CairoPaintDevice pd2(NULL, allocation.x + rangeRect.x, allocation.y + rangeRect.y, rangeRect.width, rangeRect.height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, allocation.x + rangeRect.x, allocation.y + rangeRect.y, rangeRect.width, rangeRect.height, cr); + TQPainter p(&pd); bool mousedown = (state & GTK_STATE_FLAG_ACTIVE) != 0; bool prelight = (state & GTK_STATE_FLAG_PRELIGHT) != 0; @@ -616,7 +616,7 @@ draw_slider_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, Gtk } // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_All, ((mousedown)?TQStyle::SC_All:TQStyle::SC_None)); + tqApp->style().drawComplexControl(TQStyle::CC_Slider, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQSlider, widget) | ((ceData.orientation == TQt::Horizontal)?TQStyle::Style_Horizontal:TQStyle::Style_Default), TQStyle::SC_All, ((mousedown)?TQStyle::SC_All:TQStyle::SC_None)); } cairo_restore(cr); @@ -641,8 +641,8 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, gtk_range_get_range_rect(GTK_RANGE(widget), &rangeRect); TQRect boundingRect(0, 0, rangeRect.width, rangeRect.height); - TQt3CairoPaintDevice pd2(NULL, allocation.x + rangeRect.x, allocation.y + rangeRect.y, rangeRect.width, rangeRect.height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, allocation.x + rangeRect.x, allocation.y + rangeRect.y, rangeRect.width, rangeRect.height, cr); + TQPainter p(&pd); GtkStateFlags widgetStateFlags = gtk_widget_get_state_flags(widget); @@ -785,7 +785,7 @@ draw_scrollbar_frame(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, } // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ScrollBar, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), sflags, TQStyle::SC_All, activeSubControl); + tqApp->style().drawComplexControl(TQStyle::CC_ScrollBar, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), sflags, TQStyle::SC_All, activeSubControl); } cairo_restore(cr); @@ -798,8 +798,8 @@ draw_checkbox(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidg TQPalette objectPalette = tqApp->palette(objectTypes); TQRect boundingRect(0, 0, width, height); - TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); + TQPainter p(&pd); TQStyleControlElementData ceData; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; @@ -811,7 +811,7 @@ draw_checkbox(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWidg } // Draw item - tqApp->style().drawControl(TQStyle::CE_CheckBox, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); + tqApp->style().drawControl(TQStyle::CE_CheckBox, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); } static void @@ -821,8 +821,8 @@ draw_radiobutton(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkW TQPalette objectPalette = tqApp->palette(objectTypes); TQRect boundingRect(0, 0, width, height); - TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); + TQPainter p(&pd); TQStyleControlElementData ceData; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; @@ -834,7 +834,7 @@ draw_radiobutton(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkW } // Draw item - tqApp->style().drawControl(TQStyle::CE_RadioButton, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); + tqApp->style().drawControl(TQStyle::CE_RadioButton, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); } static void @@ -844,8 +844,8 @@ draw_pushbutton(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWi TQPalette objectPalette = tqApp->palette(objectTypes); TQRect boundingRect(0, 0, width, height); - TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); + TQPainter p(&pd); TQStyleControlElementData ceData; TQStyle::ControlElementFlags elementFlags = TQStyle::CEF_None; @@ -860,7 +860,7 @@ draw_pushbutton(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, GtkWi } // Draw item - tqApp->style().drawControl(TQStyle::CE_PushButton, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); + tqApp->style().drawControl(TQStyle::CE_PushButton, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget)); } static void @@ -878,8 +878,8 @@ draw_toolbar_button(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, G ceData.orientation = TQt::Horizontal; TQRect boundingRect(0, 0, width, height); - TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); - TQPainter p2(&pd2); + TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); + TQPainter p(&pd); ceData.rect = boundingRect; @@ -896,7 +896,7 @@ draw_toolbar_button(DRAW_ARGS, const GtkWidgetPath* path, GtkStateFlags state, G } // Draw item - tqApp->style().drawComplexControl(TQStyle::CC_ToolButton, &p2, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget), TQStyle::SC_ToolButton, ((mousedown)?TQStyle::SC_ToolButton:TQStyle::SC_None)); + tqApp->style().drawComplexControl(TQStyle::CC_ToolButton, &p, ceData, elementFlags, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, tqt3WidgetType, widget), TQStyle::SC_ToolButton, ((mousedown)?TQStyle::SC_ToolButton:TQStyle::SC_None)); } /* draw a texture placed on the centroid */ @@ -991,7 +991,7 @@ tdegtk_draw_activity (DRAW_ARGS) printf("[WARNING] tdegtk_draw_activity() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); } static void @@ -1206,7 +1206,7 @@ tdegtk_draw_cell_background (DRAW_ARGS, printf("[WARNING] tdegtk_draw_cell_background() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); cairo_restore(cr); } @@ -1260,16 +1260,12 @@ tdegtk_draw_cell_frame (DRAW_ARGS, printf("[WARNING] tdegtk_draw_cell_background() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); } static void tdegtk_draw_check (DRAW_ARGS) { - TQRect boundingRect(0, 0, width, height); - TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); - TQPainter p(&pd); - const GtkWidgetPath* path; GtkStateFlags state; GtkWidget* widget; @@ -1284,7 +1280,6 @@ tdegtk_draw_check (DRAW_ARGS) else { draw_checkbox(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQCheckBox); } - p.end(); } static void @@ -1301,7 +1296,7 @@ tdegtk_draw_common (DRAW_ARGS) state = gtk_theming_engine_get_state(engine); //tqApp->style().drawPrimitive(TQStyle::PE_Indicator, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); - p.end(); + if (p.isActive()) p.end(); } static void @@ -1658,7 +1653,7 @@ tdegtk_draw_common_background (DRAW_ARGS) printf("[WARNING] tdegtk_draw_common_background() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); cairo_restore(cr); } @@ -1857,7 +1852,7 @@ tdegtk_draw_common_frame (DRAW_ARGS) } else if (gtk_widget_path_is_type(path, GTK_TYPE_LABEL)) { - // Do mothing + // Do nothing } else if (gtk_widget_path_is_type(path, GTK_TYPE_NOTEBOOK)) { @@ -1867,7 +1862,8 @@ tdegtk_draw_common_frame (DRAW_ARGS) else if (gtk_widget_path_is_type(path, GTK_TYPE_LEVEL_BAR)) { const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); - + + p.end(); // Restore original Cairo context before creating a new TQt3 paint device based on that context boundingRect = TQRect(0, 0, allocation.width, allocation.height); TQt3CairoPaintDevice pd2(NULL, 0, 0, allocation.width, allocation.height, cr); TQPainter p2(&pd2); @@ -1908,7 +1904,7 @@ tdegtk_draw_common_frame (DRAW_ARGS) } } - p.end(); + if (p.isActive()) p.end(); cairo_restore(cr); } @@ -1933,7 +1929,7 @@ tdegtk_draw_expander (DRAW_ARGS) DEBUG_FILL_BACKGROUND_WITH_COLOR(p,255,255,0); printf("[WARNING] tdegtk_draw_expander() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); - p.end(); + if (p.isActive()) p.end(); #else GtkStateFlags state; GdkRGBA color; @@ -2081,6 +2077,7 @@ tdegtk_draw_extension (DRAW_ARGS, cairo_save(cr); cairo_reset_clip(cr); + p.end(); // Restore original Cairo context before creating a new TQt3 paint device based on that context TQt3CairoPaintDevice pd2(NULL, paintDeviceRect.x(), paintDeviceRect.y(), paintDeviceRect.width(), paintDeviceRect.height(), cr); TQPainter p2(&pd2); @@ -2099,7 +2096,7 @@ tdegtk_draw_extension (DRAW_ARGS, printf("[WARNING] tdegtk_draw_extension() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); } static void @@ -2194,7 +2191,7 @@ tdegtk_draw_focus (DRAW_ARGS) printf("[WARNING] tdegtk_draw_focus() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); } static void @@ -2272,7 +2269,7 @@ tdegtk_draw_frame_gap (DRAW_ARGS, printf("[WARNING] tdegtk_draw_frame_gap() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); } static void @@ -2306,7 +2303,7 @@ tdegtk_draw_grip (DRAW_ARGS) cairo_restore(cr); - p.end(); + if (p.isActive()) p.end(); } static void @@ -2347,7 +2344,7 @@ tdegtk_draw_handle (DRAW_ARGS) printf("[WARNING] tdegtk_draw_handle() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); } static void @@ -2391,8 +2388,6 @@ tdegtk_draw_notebook (DRAW_ARGS, TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); TQPainter p(&pd); - DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,255,0); - const GtkWidgetPath* path; GtkStateFlags state; GtkWidget* widget; @@ -2401,27 +2396,30 @@ tdegtk_draw_notebook (DRAW_ARGS, state = gtk_theming_engine_get_state(engine); widget = m_widgetLookup.find(cr, path); - TQStringList objectTypes; - objectTypes.append(TQTABWIDGET_OBJECT_NAME_STRING); - TQPalette objectPalette = tqApp->palette(objectTypes); - - // Draw background - TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); - DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_NOTEBOOK)) { + TQStringList objectTypes; + objectTypes.append(TQTABWIDGET_OBJECT_NAME_STRING); + TQPalette objectPalette = tqApp->palette(objectTypes); + + // Draw background + TQBrush brush = objectPalette.brush(gtkToTQPaletteColorGroup(engine, state), TQColorGroup::Background); + DRAW_FILLED_RECTANGLE_OVER_ENTIRE_AREA(p, brush) + + // Draw tab frame + tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); + } - // Draw tab frame - tqApp->style().drawPrimitive(TQStyle::PE_PanelTabWidget, &p, boundingRect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_NONE, widget)); + else { + DEBUG_FILL_BACKGROUND_WITH_COLOR(p,0,255,0); + printf("[WARNING] tdegtk_draw_notebook() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); + } - p.end(); + if (p.isActive()) p.end(); } static void tdegtk_draw_radio (DRAW_ARGS) { - TQRect boundingRect(0, 0, width, height); - TQt3CairoPaintDevice pd(NULL, x, y, width, height, cr); - TQPainter p(&pd); - const GtkWidgetPath* path; GtkStateFlags state; GtkWidget* widget; @@ -2436,9 +2434,9 @@ tdegtk_draw_radio (DRAW_ARGS) else if (gtk_theming_engine_has_class(engine, GTK_STYLE_CLASS_MENUITEM)) { const GtkAllocation allocation = Gtk::gtk_widget_get_allocation(widget); - boundingRect = TQRect(0, 0, allocation.width, allocation.height); - TQt3CairoPaintDevice pd2(NULL, 0, 0, allocation.width, allocation.height, cr); - TQPainter p2(&pd2); + TQRect boundingRect(0, 0, allocation.width, allocation.height); + TQt3CairoPaintDevice pd(NULL, 0, 0, allocation.width, allocation.height, cr); + TQPainter p(&pd); bool checked = ((state & GTK_STATE_FLAG_ACTIVE) != 0); int maxAcceleratorTextWidth = 0; @@ -2459,15 +2457,13 @@ tdegtk_draw_radio (DRAW_ARGS) elementFlags = elementFlags | TQStyle::TQStyle::CEF_IsCheckable; if (checked) { - tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorFrame, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt); - tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorCheck, &p2, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt); + tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorFrame, &p, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt); + tqApp->style().drawPrimitive(TQStyle::PE_MenuItemIndicatorCheck, &p, ceData, elementFlags, ceData.rect, gtkToTQtColorGroup(engine, state), gtkToTQtStyleFlags(engine, state, TQT3WT_TQRadioButton, widget), menuOpt); } } else { draw_radiobutton(engine, cr, x, y, width, height, path, state, widget, TQT3WT_TQRadioButton); } - - p.end(); } static void @@ -2529,6 +2525,7 @@ tdegtk_draw_separator (DRAW_ARGS) else { y = y + (height/4); } + p.end(); // Restore original Cairo context before creating a new TQt3 paint device based on that context TQt3CairoPaintDevice pd2(NULL, x, y, width, height, cr); TQPainter p2(&pd2); @@ -2552,7 +2549,7 @@ tdegtk_draw_separator (DRAW_ARGS) printf("[WARNING] tdegtk_draw_separator() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); cairo_restore(cr); } @@ -2634,7 +2631,7 @@ tdegtk_draw_slider (DRAW_ARGS, printf("[WARNING] tdegtk_draw_slider() nonfunctional for widget with path '%s'\n\r", gtk_widget_path_to_string (gtk_theming_engine_get_path(engine))); fflush(stdout); } - p.end(); + if (p.isActive()) p.end(); cairo_restore(cr); } @@ -2648,7 +2645,7 @@ tdegtk_draw_spinbutton_background (DRAW_ARGS) DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,255,0); - p.end(); + if (p.isActive()) p.end(); } static void @@ -2660,7 +2657,7 @@ tdegtk_draw_spinbutton_frame (DRAW_ARGS) DEBUG_FILL_BACKGROUND_WITH_COLOR(p,128,255,128); - p.end(); + if (p.isActive()) p.end(); } void |