| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "ui/base/x/x11_util.h" | 9 #include "ui/base/x/x11_util.h" |
| 10 | 10 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 hotspot_point = gfx::ScaleToFlooredPoint(hotspot, scale); | 312 hotspot_point = gfx::ScaleToFlooredPoint(hotspot, scale); |
| 313 needs_scale = true; | 313 needs_scale = true; |
| 314 } | 314 } |
| 315 | 315 |
| 316 const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image; | 316 const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image; |
| 317 XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height()); | 317 XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height()); |
| 318 image->xhot = std::min(bitmap->width() - 1, hotspot_point.x()); | 318 image->xhot = std::min(bitmap->width() - 1, hotspot_point.x()); |
| 319 image->yhot = std::min(bitmap->height() - 1, hotspot_point.y()); | 319 image->yhot = std::min(bitmap->height() - 1, hotspot_point.y()); |
| 320 | 320 |
| 321 if (bitmap->width() && bitmap->height()) { | 321 if (bitmap->width() && bitmap->height()) { |
| 322 bitmap->lockPixels(); | |
| 323 // The |bitmap| contains ARGB image, so just copy it. | 322 // The |bitmap| contains ARGB image, so just copy it. |
| 324 memcpy(image->pixels, | 323 memcpy(image->pixels, |
| 325 bitmap->getPixels(), | 324 bitmap->getPixels(), |
| 326 bitmap->width() * bitmap->height() * 4); | 325 bitmap->width() * bitmap->height() * 4); |
| 327 bitmap->unlockPixels(); | |
| 328 } | 326 } |
| 329 | 327 |
| 330 return image; | 328 return image; |
| 331 } | 329 } |
| 332 | 330 |
| 333 int CoalescePendingMotionEvents(const XEvent* xev, XEvent* last_event) { | 331 int CoalescePendingMotionEvents(const XEvent* xev, XEvent* last_event) { |
| 334 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 332 XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
| 335 int num_coalesced = 0; | 333 int num_coalesced = 0; |
| 336 XDisplay* display = xev->xany.display; | 334 XDisplay* display = xev->xany.display; |
| 337 int event_type = xev->xgeneric.evtype; | 335 int event_type = xev->xgeneric.evtype; |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1477 return colormap_; | 1475 return colormap_; |
| 1478 } | 1476 } |
| 1479 | 1477 |
| 1480 #endif | 1478 #endif |
| 1481 | 1479 |
| 1482 // ---------------------------------------------------------------------------- | 1480 // ---------------------------------------------------------------------------- |
| 1483 // End of x11_util_internal.h | 1481 // End of x11_util_internal.h |
| 1484 | 1482 |
| 1485 | 1483 |
| 1486 } // namespace ui | 1484 } // namespace ui |
| OLD | NEW |