| 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/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 visual, depth, | 38 visual, depth, |
| 39 pixmap, pixmap_gc, | 39 pixmap, pixmap_gc, |
| 40 data, width, height, | 40 data, width, height, |
| 41 0, 0, // src_x, src_y | 41 0, 0, // src_x, src_y |
| 42 0, 0, // dst_x, dst_y | 42 0, 0, // dst_x, dst_y |
| 43 width, height); | 43 width, height); |
| 44 } | 44 } |
| 45 | 45 |
| 46 int BitsPerPixelForPixmapDepth(XDisplay* dpy, int depth) { | 46 int BitsPerPixelForPixmapDepth(XDisplay* dpy, int depth) { |
| 47 int count; | 47 int count; |
| 48 XPixmapFormatValues* formats = XListPixmapFormats(dpy, &count); | 48 XScopedPtr<XPixmapFormatValues[]> formats(XListPixmapFormats(dpy, &count)); |
| 49 if (!formats) | 49 if (!formats) |
| 50 return -1; | 50 return -1; |
| 51 | 51 |
| 52 int bits_per_pixel = -1; | |
| 53 for (int i = 0; i < count; ++i) { | 52 for (int i = 0; i < count; ++i) { |
| 54 if (formats[i].depth == depth) { | 53 if (formats[i].depth == depth) |
| 55 bits_per_pixel = formats[i].bits_per_pixel; | 54 return formats[i].bits_per_pixel; |
| 56 break; | |
| 57 } | |
| 58 } | 55 } |
| 59 | 56 |
| 60 XFree(formats); | 57 return -1; |
| 61 return bits_per_pixel; | |
| 62 } | 58 } |
| 63 | 59 |
| 64 void PutARGBImage(XDisplay* display, | 60 void PutARGBImage(XDisplay* display, |
| 65 void* visual, int depth, | 61 void* visual, int depth, |
| 66 XID pixmap, void* pixmap_gc, | 62 XID pixmap, void* pixmap_gc, |
| 67 const uint8* data, | 63 const uint8* data, |
| 68 int data_width, int data_height, | 64 int data_width, int data_height, |
| 69 int src_x, int src_y, | 65 int src_x, int src_y, |
| 70 int dst_x, int dst_y, | 66 int dst_x, int dst_y, |
| 71 int copy_width, int copy_height) { | 67 int copy_width, int copy_height) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 free(orig_bitmap16); | 157 free(orig_bitmap16); |
| 162 } else { | 158 } else { |
| 163 LOG(FATAL) << "Sorry, we don't support your visual depth without " | 159 LOG(FATAL) << "Sorry, we don't support your visual depth without " |
| 164 "Xrender support (depth:" << depth | 160 "Xrender support (depth:" << depth |
| 165 << " bpp:" << pixmap_bpp << ")"; | 161 << " bpp:" << pixmap_bpp << ")"; |
| 166 } | 162 } |
| 167 } | 163 } |
| 168 | 164 |
| 169 } // namespace gfx | 165 } // namespace gfx |
| 170 | 166 |
| OLD | NEW |