OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // This file defines utility functions for X11 (Linux only). This code has been | 5 // This file defines utility functions for X11 (Linux only). This code has been |
6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support | 6 // ported from XCB since we can't use XCB on Ubuntu while its 32-bit support |
7 // remains woefully incomplete. | 7 // remains woefully incomplete. |
8 | 8 |
9 #include "chrome/common/x11_util.h" | 9 #include "chrome/common/x11_util.h" |
10 #include "chrome/common/x11_util_internal.h" | 10 #include "chrome/common/x11_util_internal.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 templ.direct.alphaMask = 0; | 127 templ.direct.alphaMask = 0; |
128 | 128 |
129 static const unsigned long kMask = | 129 static const unsigned long kMask = |
130 PictFormatType | PictFormatDepth | | 130 PictFormatType | PictFormatDepth | |
131 PictFormatRed | PictFormatRedMask | | 131 PictFormatRed | PictFormatRedMask | |
132 PictFormatGreen | PictFormatGreenMask | | 132 PictFormatGreen | PictFormatGreenMask | |
133 PictFormatBlue | PictFormatBlueMask | | 133 PictFormatBlue | PictFormatBlueMask | |
134 PictFormatAlphaMask; | 134 PictFormatAlphaMask; |
135 | 135 |
136 pictformat = XRenderFindFormat(dpy, kMask, &templ, 0 /* first result */); | 136 pictformat = XRenderFindFormat(dpy, kMask, &templ, 0 /* first result */); |
137 CHECK(pictformat) << "XRENDER doesn't not support a Skia compatable format"; | 137 |
138 // TODO(agl): fallback to a picture format with an alpha channel | 138 if (!pictformat) { |
| 139 // Not all X servers support xRGB32 formats. However, the XRENDER spec says |
| 140 // that they must support an ARGB32 format, so we can always return that. |
| 141 pictformat = XRenderFindStandardFormat(dpy, PictStandardARGB32); |
| 142 CHECK(pictformat) << "XRENDER ARGB32 not supported."; |
| 143 } |
139 | 144 |
140 return pictformat; | 145 return pictformat; |
141 } | 146 } |
142 | 147 |
143 XID AttachSharedMemory(Display* display, int shared_memory_key) { | 148 XID AttachSharedMemory(Display* display, int shared_memory_key) { |
144 DCHECK(QuerySharedMemorySupport(display)); | 149 DCHECK(QuerySharedMemorySupport(display)); |
145 | 150 |
146 XShmSegmentInfo shminfo; | 151 XShmSegmentInfo shminfo; |
147 memset(&shminfo, 0, sizeof(shminfo)); | 152 memset(&shminfo, 0, sizeof(shminfo)); |
148 shminfo.shmid = shared_memory_key; | 153 shminfo.shmid = shared_memory_key; |
(...skipping 27 matching lines...) Expand all Loading... |
176 | 181 |
177 void FreePicture(Display* display, XID picture) { | 182 void FreePicture(Display* display, XID picture) { |
178 XRenderFreePicture(display, picture); | 183 XRenderFreePicture(display, picture); |
179 } | 184 } |
180 | 185 |
181 void FreePixmap(Display* display, XID pixmap) { | 186 void FreePixmap(Display* display, XID pixmap) { |
182 XFreePixmap(display, pixmap); | 187 XFreePixmap(display, pixmap); |
183 } | 188 } |
184 | 189 |
185 } // namespace x11_util | 190 } // namespace x11_util |
OLD | NEW |