1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #include "gfxQtNativeRenderer.h"
7 #include "gfxContext.h"
8 #include "gfxXlibSurface.h"
11 gfxQtNativeRenderer::Draw(gfxContext
* ctx
, nsIntSize size
,
12 uint32_t flags
, Screen
* screen
, Visual
* visual
,
15 Display
*dpy
= DisplayOfScreen(screen
);
16 bool isOpaque
= (flags
& DRAW_IS_OPAQUE
) ? true : false;
17 int screenNumber
= screen
- ScreenOfDisplay(dpy
, 0);
22 int foundVisual
= XMatchVisualInfo(dpy
, screenNumber
,
26 return NS_ERROR_FAILURE
;
28 visual
= vinfo
.visual
;
31 nsRefPtr
<gfxXlibSurface
> xsurf
=
32 gfxXlibSurface::Create(screen
, visual
,
33 gfxIntSize(size
.width
, size
.height
));
36 nsRefPtr
<gfxContext
> tempCtx
= new gfxContext(xsurf
);
37 tempCtx
->SetOperator(gfxContext::OPERATOR_CLEAR
);
41 nsresult rv
= DrawWithXlib(xsurf
.get(), nsIntPoint(0, 0), NULL
, 0);
46 ctx
->SetSource(xsurf
);