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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 float scale = 1.f; | 338 float scale = 1.f; |
339 if (cursor_image->width() > cursor_image->height()) | 339 if (cursor_image->width() > cursor_image->height()) |
340 scale = kMaxPixel / cursor_image->width(); | 340 scale = kMaxPixel / cursor_image->width(); |
341 else | 341 else |
342 scale = kMaxPixel / cursor_image->height(); | 342 scale = kMaxPixel / cursor_image->height(); |
343 | 343 |
344 scaled = skia::ImageOperations::Resize(*cursor_image, | 344 scaled = skia::ImageOperations::Resize(*cursor_image, |
345 skia::ImageOperations::RESIZE_BETTER, | 345 skia::ImageOperations::RESIZE_BETTER, |
346 static_cast<int>(cursor_image->width() * scale), | 346 static_cast<int>(cursor_image->width() * scale), |
347 static_cast<int>(cursor_image->height() * scale)); | 347 static_cast<int>(cursor_image->height() * scale)); |
348 hotspot_point = gfx::ToFlooredPoint(gfx::ScalePoint(hotspot, scale)); | 348 hotspot_point = gfx::ScaleToFlooredPoint(hotspot, scale); |
349 needs_scale = true; | 349 needs_scale = true; |
350 } | 350 } |
351 | 351 |
352 const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image; | 352 const SkBitmap* bitmap = needs_scale ? &scaled : cursor_image; |
353 XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height()); | 353 XcursorImage* image = XcursorImageCreate(bitmap->width(), bitmap->height()); |
354 image->xhot = std::min(bitmap->width() - 1, hotspot_point.x()); | 354 image->xhot = std::min(bitmap->width() - 1, hotspot_point.x()); |
355 image->yhot = std::min(bitmap->height() - 1, hotspot_point.y()); | 355 image->yhot = std::min(bitmap->height() - 1, hotspot_point.y()); |
356 | 356 |
357 if (bitmap->width() && bitmap->height()) { | 357 if (bitmap->width() && bitmap->height()) { |
358 bitmap->lockPixels(); | 358 bitmap->lockPixels(); |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 << "request_code " << static_cast<int>(error_event.request_code) << ", " | 1407 << "request_code " << static_cast<int>(error_event.request_code) << ", " |
1408 << "minor_code " << static_cast<int>(error_event.minor_code) | 1408 << "minor_code " << static_cast<int>(error_event.minor_code) |
1409 << " (" << request_str << ")"; | 1409 << " (" << request_str << ")"; |
1410 } | 1410 } |
1411 | 1411 |
1412 // ---------------------------------------------------------------------------- | 1412 // ---------------------------------------------------------------------------- |
1413 // End of x11_util_internal.h | 1413 // End of x11_util_internal.h |
1414 | 1414 |
1415 | 1415 |
1416 } // namespace ui | 1416 } // namespace ui |
OLD | NEW |