Home | History | Annotate | Download | only in x
      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.
      4 
      5 #ifndef UI_GFX_X_X11_UTIL_H_
      6 #define UI_GFX_X_X11_UTIL_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "ui/gfx/gfx_export.h"
     10 
     11 typedef unsigned long XAtom;
     12 typedef unsigned long XID;
     13 typedef struct _XImage XImage;
     14 typedef struct _XGC *GC;
     15 typedef struct _XDisplay XDisplay;
     16 
     17 namespace gfx {
     18 
     19 // TODO(oshima|evan): This assume there is one display and doesn't work
     20 // undef multiple displays/monitor environment. Remove this and change the
     21 // chrome codebase to get the display from window.
     22 GFX_EXPORT XDisplay* GetXDisplay();
     23 
     24 // This opens a new X11 XDisplay*, taking command line arguments into account.
     25 GFX_EXPORT XDisplay* OpenNewXDisplay();
     26 
     27 // Return the number of bits-per-pixel for a pixmap of the given depth
     28 GFX_EXPORT int BitsPerPixelForPixmapDepth(XDisplay* display, int depth);
     29 
     30 // Draws ARGB data on the given pixmap using the given GC, converting to the
     31 // server side visual depth as needed.  Destination is assumed to be the same
     32 // dimensions as |data| or larger.  |data| is also assumed to be in row order
     33 // with each line being exactly |width| * 4 bytes long.
     34 GFX_EXPORT void PutARGBImage(XDisplay* display,
     35                              void* visual, int depth,
     36                              XID pixmap, void* pixmap_gc,
     37                              const uint8* data,
     38                              int width, int height);
     39 
     40 // Same as above only more general:
     41 // - |data_width| and |data_height| refer to the data image
     42 // - |src_x|, |src_y|, |copy_width| and |copy_height| define source region
     43 // - |dst_x|, |dst_y|, |copy_width| and |copy_height| define destination region
     44 GFX_EXPORT void PutARGBImage(XDisplay* display,
     45                              void* visual, int depth,
     46                              XID pixmap, void* pixmap_gc,
     47                              const uint8* data,
     48                              int data_width, int data_height,
     49                              int src_x, int src_y,
     50                              int dst_x, int dst_y,
     51                              int copy_width, int copy_height);
     52 
     53 }  // namespace gfx
     54 
     55 #endif  // UI_GFX_X_X11_UTIL_H_
     56 
     57