| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/x/x11_types.h" | 5 #include "ui/gfx/x/x11_types.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 | 10 |
| 11 namespace gfx { | 11 namespace gfx { |
| 12 | 12 |
| 13 XDisplay* GetXDisplay() { | 13 XDisplay* GetXDisplay() { |
| 14 return base::MessagePumpForUI::GetDefaultXDisplay(); | 14 static XDisplay* display = NULL; |
| 15 if (!display) |
| 16 display = XOpenDisplay(NULL); |
| 17 return display; |
| 15 } | 18 } |
| 16 | 19 |
| 17 void PutARGBImage(XDisplay* display, | 20 void PutARGBImage(XDisplay* display, |
| 18 void* visual, int depth, | 21 void* visual, int depth, |
| 19 XID pixmap, void* pixmap_gc, | 22 XID pixmap, void* pixmap_gc, |
| 20 const uint8* data, | 23 const uint8* data, |
| 21 int width, int height) { | 24 int width, int height) { |
| 22 PutARGBImage(display, | 25 PutARGBImage(display, |
| 23 visual, depth, | 26 visual, depth, |
| 24 pixmap, pixmap_gc, | 27 pixmap, pixmap_gc, |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 free(orig_bitmap16); | 149 free(orig_bitmap16); |
| 147 } else { | 150 } else { |
| 148 LOG(FATAL) << "Sorry, we don't support your visual depth without " | 151 LOG(FATAL) << "Sorry, we don't support your visual depth without " |
| 149 "Xrender support (depth:" << depth | 152 "Xrender support (depth:" << depth |
| 150 << " bpp:" << pixmap_bpp << ")"; | 153 << " bpp:" << pixmap_bpp << ")"; |
| 151 } | 154 } |
| 152 } | 155 } |
| 153 | 156 |
| 154 } // namespace gfx | 157 } // namespace gfx |
| 155 | 158 |
| OLD | NEW |