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 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 void RefCustomXCursor(::Cursor cursor) { | 322 void RefCustomXCursor(::Cursor cursor) { |
323 XCustomCursorCache::GetInstance()->Ref(cursor); | 323 XCustomCursorCache::GetInstance()->Ref(cursor); |
324 } | 324 } |
325 | 325 |
326 void UnrefCustomXCursor(::Cursor cursor) { | 326 void UnrefCustomXCursor(::Cursor cursor) { |
327 XCustomCursorCache::GetInstance()->Unref(cursor); | 327 XCustomCursorCache::GetInstance()->Unref(cursor); |
328 } | 328 } |
329 | 329 |
330 XcursorImage* SkBitmapToXcursorImage(const SkBitmap* cursor_image, | 330 XcursorImage* SkBitmapToXcursorImage(const SkBitmap* cursor_image, |
331 const gfx::Point& hotspot) { | 331 const gfx::Point& hotspot) { |
332 DCHECK(cursor_image->colorType() == kPMColor_SkColorType); | 332 DCHECK(cursor_image->colorType() == kN32_SkColorType); |
333 gfx::Point hotspot_point = hotspot; | 333 gfx::Point hotspot_point = hotspot; |
334 SkBitmap scaled; | 334 SkBitmap scaled; |
335 | 335 |
336 // X11 seems to have issues with cursors when images get larger than 64 | 336 // X11 seems to have issues with cursors when images get larger than 64 |
337 // pixels. So rescale the image if necessary. | 337 // pixels. So rescale the image if necessary. |
338 const float kMaxPixel = 64.f; | 338 const float kMaxPixel = 64.f; |
339 bool needs_scale = false; | 339 bool needs_scale = false; |
340 if (cursor_image->width() > kMaxPixel || cursor_image->height() > kMaxPixel) { | 340 if (cursor_image->width() > kMaxPixel || cursor_image->height() > kMaxPixel) { |
341 float scale = 1.f; | 341 float scale = 1.f; |
342 if (cursor_image->width() > cursor_image->height()) | 342 if (cursor_image->width() > cursor_image->height()) |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1417 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1418 << "minor_code " << static_cast<int>(error_event.minor_code) | 1418 << "minor_code " << static_cast<int>(error_event.minor_code) |
1419 << " (" << request_str << ")"; | 1419 << " (" << request_str << ")"; |
1420 } | 1420 } |
1421 | 1421 |
1422 // ---------------------------------------------------------------------------- | 1422 // ---------------------------------------------------------------------------- |
1423 // End of x11_util_internal.h | 1423 // End of x11_util_internal.h |
1424 | 1424 |
1425 | 1425 |
1426 } // namespace ui | 1426 } // namespace ui |
OLD | NEW |