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 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
464 float scale = 1.f; | 464 float scale = 1.f; |
465 if (cursor_image->width() > cursor_image->height()) | 465 if (cursor_image->width() > cursor_image->height()) |
466 scale = kMaxPixel / cursor_image->width(); | 466 scale = kMaxPixel / cursor_image->width(); |
467 else | 467 else |
468 scale = kMaxPixel / cursor_image->height(); | 468 scale = kMaxPixel / cursor_image->height(); |
469 | 469 |
470 scaled = skia::ImageOperations::Resize(*cursor_image, | 470 scaled = skia::ImageOperations::Resize(*cursor_image, |
471 skia::ImageOperations::RESIZE_BETTER, | 471 skia::ImageOperations::RESIZE_BETTER, |
472 static_cast<int>(cursor_image->width() * scale), | 472 static_cast<int>(cursor_image->width() * scale), |
473 static_cast<int>(cursor_image->height() * scale)); | 473 static_cast<int>(cursor_image->height() * scale)); |
474 hotspot_point = gfx::ToFlooredPoint(hotspot.Scale(scale)); | 474 hotspot_point = gfx::ToFlooredPoint(gfx::ScalePoint(hotspot, scale)); |
475 needs_scale = true; | 475 needs_scale = true; |
476 } | 476 } |
477 | 477 |
478 const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image; | 478 const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image; |
479 XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height()); | 479 XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height()); |
480 image->xhot = hotspot_point.x(); | 480 image->xhot = hotspot_point.x(); |
481 image->yhot = hotspot_point.y(); | 481 image->yhot = hotspot_point.y(); |
482 | 482 |
483 if (bitmap->width() && bitmap->height()) { | 483 if (bitmap->width() && bitmap->height()) { |
484 bitmap->lockPixels(); | 484 bitmap->lockPixels(); |
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1701 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1701 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1702 << "minor_code " << static_cast<int>(error_event.minor_code) | 1702 << "minor_code " << static_cast<int>(error_event.minor_code) |
1703 << " (" << request_str << ")"; | 1703 << " (" << request_str << ")"; |
1704 } | 1704 } |
1705 | 1705 |
1706 // ---------------------------------------------------------------------------- | 1706 // ---------------------------------------------------------------------------- |
1707 // End of x11_util_internal.h | 1707 // End of x11_util_internal.h |
1708 | 1708 |
1709 | 1709 |
1710 } // namespace ui | 1710 } // namespace ui |
OLD | NEW |