1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_GFX_X_X11_UTIL_H_
6 #define UI_GFX_X_X11_UTIL_H_
8 #include "base/basictypes.h"
9 #include "ui/gfx/gfx_export.h"
11 typedef unsigned long XID;
12 typedef struct _XImage XImage;
13 typedef struct _XGC *GC;
14 typedef struct _XDisplay XDisplay;
18 // TODO(oshima|evan): This assume there is one display and doesn't work
19 // undef multiple displays/monitor environment. Remove this and change the
20 // chrome codebase to get the display from window.
21 GFX_EXPORT XDisplay* GetXDisplay();
23 // Return the number of bits-per-pixel for a pixmap of the given depth
24 GFX_EXPORT int BitsPerPixelForPixmapDepth(XDisplay* display, int depth);
26 // Draws ARGB data on the given pixmap using the given GC, converting to the
27 // server side visual depth as needed. Destination is assumed to be the same
28 // dimensions as |data| or larger. |data| is also assumed to be in row order
29 // with each line being exactly |width| * 4 bytes long.
30 GFX_EXPORT void PutARGBImage(XDisplay* display,
31 void* visual, int depth,
32 XID pixmap, void* pixmap_gc,
34 int width, int height);
36 // Same as above only more general:
37 // - |data_width| and |data_height| refer to the data image
38 // - |src_x|, |src_y|, |copy_width| and |copy_height| define source region
39 // - |dst_x|, |dst_y|, |copy_width| and |copy_height| define destination region
40 GFX_EXPORT void PutARGBImage(XDisplay* display,
41 void* visual, int depth,
42 XID pixmap, void* pixmap_gc,
44 int data_width, int data_height,
47 int copy_width, int copy_height);
51 #endif // UI_GFX_X_X11_UTIL_H_