Bug 601451 - Allow compile qt port with system cairo which does not have QT_SURFACE compiled. r=joe a=npodb

--HG--
extra : rebase_source : a6bc7d01efb4a9d91418a33d43bbaf07139b4a18
This commit is contained in:
Oleg Romashin 2010-10-05 09:15:57 +03:00
parent 53b80cff95
commit 548468988c
5 changed files with 18 additions and 2 deletions

View File

@ -38,6 +38,8 @@
#include <assert.h>
#include "gfxQPainterSurface.h"
#ifdef CAIRO_HAS_QT_SURFACE
#include "gfxImageSurface.h"
#include "cairo-qt.h"
@ -106,3 +108,4 @@ gfxQPainterSurface::GetImageSurface()
nsRefPtr<gfxImageSurface> asurf = new gfxImageSurface(isurf);
return asurf.forget();
}
#endif

View File

@ -41,6 +41,9 @@
#include "gfxASurface.h"
#include "gfxImageSurface.h"
#include "cairo-features.h"
#ifdef CAIRO_HAS_QT_SURFACE
class QPainter;
class QImage;
@ -63,4 +66,6 @@ protected:
QPainter *mPainter;
};
#endif
#endif /* GFX_QPAINTERSURFACE_H */

View File

@ -200,10 +200,12 @@ gfxQtPlatform::CreateOffscreenSurface(const gfxIntSize& size,
&& 16 == QX11Info().depth())
imageFormat = gfxASurface::ImageFormatRGB16_565;
#ifdef CAIRO_HAS_QT_SURFACE
if (mRenderMode == RENDER_QPAINTER) {
newSurface = new gfxQPainterSurface(size, imageFormat);
return newSurface.forget();
}
#endif
if (mRenderMode == RENDER_BUFFERED &&
sDefaultQtPaintEngineType != QPaintEngine::X11) {

View File

@ -132,6 +132,7 @@ nsNativeThemeQt::DrawWidgetBackground(nsIRenderingContext* aContext,
gfxContext* context = aContext->ThebesContext();
nsRefPtr<gfxASurface> surface = context->CurrentSurface();
#ifdef CAIRO_HAS_QT_SURFACE
if (surface->GetType() == gfxASurface::SurfaceTypeQPainter) {
gfxQPainterSurface* qSurface = (gfxQPainterSurface*) (surface.get());
QPainter *painter = qSurface->GetQPainter();
@ -141,8 +142,9 @@ nsNativeThemeQt::DrawWidgetBackground(nsIRenderingContext* aContext,
return DrawWidgetBackground(painter, aContext,
aFrame, aWidgetType,
aRect, aClipRect);
}
else if (surface->GetType() == gfxASurface::SurfaceTypeImage) {
} else
#endif
if (surface->GetType() == gfxASurface::SurfaceTypeImage) {
gfxImageSurface* qSurface = (gfxImageSurface*) (surface.get());
QImage tempQImage(qSurface->Data(),
qSurface->Width(),

View File

@ -976,8 +976,10 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption)
targetSurface = gBufferSurface;
#ifdef CAIRO_HAS_QT_SURFACE
} else if (renderMode == gfxQtPlatform::RENDER_QPAINTER) {
targetSurface = new gfxQPainterSurface(aPainter);
#endif
}
if (NS_UNLIKELY(!targetSurface))
@ -2443,9 +2445,11 @@ nsWindow::GetThebesSurface()
return mThebesSurface;
gfxQtPlatform::RenderMode renderMode = gfxQtPlatform::GetPlatform()->GetRenderMode();
#ifdef CAIRO_HAS_QT_SURFACE
if (renderMode == gfxQtPlatform::RENDER_QPAINTER) {
mThebesSurface = new gfxQPainterSurface(gfxIntSize(1, 1), gfxASurface::CONTENT_COLOR);
}
#endif
if (!mThebesSurface) {
gfxASurface::gfxImageFormat imageFormat = gfxASurface::ImageFormatRGB24;
mThebesSurface = new gfxImageSurface(gfxIntSize(1, 1), imageFormat);