diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 661ac65..2144f27 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -1857,6 +1857,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
     case CC_SpinBox:
         if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(option))
         {
+            qDebug() << __FUNCTION__ << "drawing spinbox";
             XPThemeData theme(widget, painter, QWindowsXPStylePrivate::SpinTheme);
             if (sb->frame && (sub & SC_SpinBoxFrame)) {
                 partId = EP_EDITBORDER_NOSCROLL;
@@ -1880,6 +1881,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
                 d->drawBackground(ftheme);
             }
             if (sub & SC_SpinBoxUp) {
+                qDebug() << __FUNCTION__ << ">drawing spinbox UP";
                 theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget).adjusted(0, 0, 0, 1);
                 partId = SPNP_UP;
                 if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
@@ -1893,8 +1895,10 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
                 theme.partId = partId;
                 theme.stateId = stateId;
                 d->drawBackground(theme);
+                qDebug() << __FUNCTION__ << "<done drawing spinbox UP";
             }
             if (sub & SC_SpinBoxDown) {
+                qDebug() << __FUNCTION__ << ">drawing spinbox DOWN";
                 theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxDown, widget);
                 partId = SPNP_DOWN;
                 if (!(sb->stepEnabled & QAbstractSpinBox::StepDownEnabled) || !(flags & State_Enabled))
@@ -1908,6 +1912,7 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
                 theme.partId = partId;
                 theme.stateId = stateId;
                 d->drawBackground(theme);
+                qDebug() << __FUNCTION__ << "<done drawing spinbox DOWN";
             }
         }
         break;
diff --git a/src/widgets/styles/qwindowsxpstyle.cpp b/src/widgets/styles/qwindowsxpstyle.cpp
index 1431d6a..d7f8b0d 100644
--- a/src/widgets/styles/qwindowsxpstyle.cpp
+++ b/src/widgets/styles/qwindowsxpstyle.cpp
@@ -690,12 +690,18 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
 {
     if (themeData.rect.isEmpty())
         return;
+    bool vb = themeData.partId == 1;
+    if (vb)
+        qDebug() << __FUNCTION__ << ">partId=" << themeData.partId << "themeData.rect=" << themeData.rect;
 
     QPainter *painter = themeData.painter;
     Q_ASSERT_X(painter != 0, "QWindowsXPStylePrivate::drawBackground()", "Trying to draw a theme part without a painter");
     if (!painter || !painter->isActive())
         return;
 
+    if (vb)
+        qDebug() <<  __FUNCTION__  << "painter->transform" << painter->transform()
+                 << "painter->deviceTransform" << painter->deviceTransform();
     painter->save();
 
     bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate;
@@ -730,13 +736,18 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
     }
 
     const HDC dc = canDrawDirectly ? hdcForWidgetBackingStore(themeData.widget) : HDC(0);
-    if (dc) {
+    if (vb)
+        qDebug() << __FUNCTION__  << "canDrawDirectly" <<canDrawDirectly <<  dc;
+
+    if (dc) {        
         drawBackgroundDirectly(themeData);
     } else {
         drawBackgroundThruNativeBuffer(themeData);
     }
 
     painter->restore();
+    if (vb)
+        qDebug() << __FUNCTION__  << '<';
 }
 
 /*! \internal
@@ -746,6 +757,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData)
 */
 void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
 {
+    qDebug() << __FUNCTION__ << ">partId=" << themeData.partId << "themeData.rect=" << themeData.rect;
     QPainter *painter = themeData.painter;
     HDC dc = 0;
     if (themeData.widget)
@@ -831,6 +843,7 @@ void QWindowsXPStylePrivate::drawBackgroundDirectly(XPThemeData &themeData)
 */
 void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeData)
 {
+    qDebug() << __FUNCTION__ << ">partId=" << themeData.partId << "themeData.rect=" << themeData.rect;
     QPainter *painter = themeData.painter;
     QRect rect = themeData.rect;
 
@@ -886,6 +899,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
                haveCachedPixmap ? buf : "]-------------------",
                qPrintable(themeData.name), themeData.partId, themeData.stateId);
 #endif
+        qDebug() << __FUNCTION__ << "from cache" << cachedPixmap;
     } else {
         // Not cached, so get values from Theme Engine
         BOOL tmt_borderonly = false;
@@ -912,6 +926,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
         printf("-->potentialInvalidAlpha = %d\n", potentialInvalidAlpha);
         showProperties(themeData);
 #endif
+         qDebug() << __FUNCTION__ << "data from theme engine";
     }
     bool wasAlphaSwapped = false;
     bool wasAlphaFixed = false;
@@ -1038,8 +1053,10 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
 #if defined(DEBUG_XP_STYLE) && 1
         printf("Image format is: %s\n", alphaType == RealAlpha ? "Real Alpha" : alphaType == MaskAlpha ? "Masked Alpha" : "No Alpha");
 #endif
-        img = QImage(bufferPixels, bufferW, bufferH, format);
+        img = QImage(bufferPixels, bufferW, bufferH, format);        
+        qDebug() << __FUNCTION__ << "created img=" << img;
     }
+    qDebug() << __FUNCTION__ << "img=" << img;
 
     // Blitting backing store
     bool useRegion = partIsTransparent && !hasAlpha && !wasAlphaSwapped;
@@ -1050,6 +1067,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
         newRegion = region(themeData);
         oldRegion = painter->clipRegion();
         painter->setClipRegion(newRegion);
+        qDebug() << __FUNCTION__ << "clip region" << newRegion.boundingRect();
 #if defined(DEBUG_XP_STYLE) && 0
         printf("Using region:\n");
         QVector<QRect> rects = newRegion.rects();
@@ -1060,14 +1078,21 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
 #endif
     }
 
-    if (addBorderContentClipping)
+    if (addBorderContentClipping) {
         painter->setClipRegion(extraClip, Qt::IntersectClip);
+        qDebug() << __FUNCTION__ <<"adding clip" << extraClip;
+    }
 
     if (!themeData.mirrorHorizontally && !themeData.mirrorVertically && !themeData.rotate) {
-        if (!haveCachedPixmap)
+        if (!haveCachedPixmap) {
+            qDebug() << __FUNCTION__ << "drawing " << img << "from src_rect="
+                     << rect << "to target=" << themeData.rect;
             painter->drawImage(themeData.rect, img, rect);
-        else
+        } else {
+            qDebug() << __FUNCTION__ << "drawing cachedPixmap"
+                     << cachedPixmap << "to target=" << themeData.rect;
             painter->drawPixmap(themeData.rect, cachedPixmap);
+        }
     } else {
         // This is _slow_!
         // Make a copy containing only the necessary data, and mirror
@@ -1088,6 +1113,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
         if (themeData.mirrorHorizontally || themeData.mirrorVertically) {
             imgCopy = imgCopy.mirrored(themeData.mirrorHorizontally, themeData.mirrorVertically);
         }
+        qDebug() << __FUNCTION__ << "ROT/MIRROR" << imgCopy;
         painter->drawImage(themeData.rect,
                            imgCopy);
     }
@@ -1102,6 +1128,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
     // Cache the pixmap to avoid expensive swapAlphaChannel() calls
     if (!haveCachedPixmap && w && h) {
         QPixmap pix = QPixmap::fromImage(img).copy(rect);
+        qDebug() << "caching" << pixmapCacheKey << pix << "rect=" << rect;
         QPixmapCache::insert(pixmapCacheKey, pix);
 #ifdef DEBUG_XP_STYLE
         printf("+++Adding pixmap to cache, size(%d, %d), wasAlphaSwapped(%d), wasAlphaFixed(%d), name(%s)\n",
@@ -1120,6 +1147,7 @@ void QWindowsXPStylePrivate::drawBackgroundThruNativeBuffer(XPThemeData &themeDa
         data.hadInvalidAlpha = wasAlphaFixed;
         alphaCache.insert(key, data);
     }
+    qDebug() << __FUNCTION__ << '<' << themeData.partId;
 }
 
 
@@ -2566,6 +2594,7 @@ void QWindowsXPStyle::drawComplexControl(ComplexControl cc, const QStyleOptionCo
             }
             if (sub & SC_SpinBoxUp) {
                 theme.rect = proxy()->subControlRect(CC_SpinBox, option, SC_SpinBoxUp, widget);
+                qDebug() << __FUNCTION__ << "uprect" << theme.rect ;
                 partId = SPNP_UP;
                 if (!(sb->stepEnabled & QAbstractSpinBox::StepUpEnabled) || !(flags & State_Enabled))
                     stateId = UPS_DISABLED;
