Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(851)

Side by Side Diff: ui/gfx/x/x11_types.cc

Issue 989993002: x11: Use scoped_ptr<> for X11 objects where it makes sense. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gfx/x/x11_types.h ('k') | ui/gl/gl_image_glx.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/gfx/x/x11_types.h ('k') | ui/gl/gl_image_glx.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698