Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: ui/base/x/x11_util.cc

Issue 2686163002: Remove bad DCHECK in SkBitmapToXcursorImage (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 void RefCustomXCursor(::Cursor cursor) { 281 void RefCustomXCursor(::Cursor cursor) {
282 XCustomCursorCache::GetInstance()->Ref(cursor); 282 XCustomCursorCache::GetInstance()->Ref(cursor);
283 } 283 }
284 284
285 void UnrefCustomXCursor(::Cursor cursor) { 285 void UnrefCustomXCursor(::Cursor cursor) {
286 XCustomCursorCache::GetInstance()->Unref(cursor); 286 XCustomCursorCache::GetInstance()->Unref(cursor);
287 } 287 }
288 288
289 XcursorImage* SkBitmapToXcursorImage(const SkBitmap* cursor_image, 289 XcursorImage* SkBitmapToXcursorImage(const SkBitmap* cursor_image,
290 const gfx::Point& hotspot) { 290 const gfx::Point& hotspot) {
291 DCHECK(cursor_image->colorType() == kN32_SkColorType); 291 // TODO(crbug.com/596782): It is possible for cursor_image to be zeroed out
292 // at this point, which leads to benign debug errors. Once this is fixed, we
293 // should DCHECK_EQ(cursor_image->colorType(), kN32_SkColorType).
292 gfx::Point hotspot_point = hotspot; 294 gfx::Point hotspot_point = hotspot;
293 SkBitmap scaled; 295 SkBitmap scaled;
294 296
295 // X11 seems to have issues with cursors when images get larger than 64 297 // X11 seems to have issues with cursors when images get larger than 64
296 // pixels. So rescale the image if necessary. 298 // pixels. So rescale the image if necessary.
297 const float kMaxPixel = 64.f; 299 const float kMaxPixel = 64.f;
298 bool needs_scale = false; 300 bool needs_scale = false;
299 if (cursor_image->width() > kMaxPixel || cursor_image->height() > kMaxPixel) { 301 if (cursor_image->width() > kMaxPixel || cursor_image->height() > kMaxPixel) {
300 float scale = 1.f; 302 float scale = 1.f;
301 if (cursor_image->width() > cursor_image->height()) 303 if (cursor_image->width() > cursor_image->height())
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after
1475 return colormap_; 1477 return colormap_;
1476 } 1478 }
1477 1479
1478 #endif 1480 #endif
1479 1481
1480 // ---------------------------------------------------------------------------- 1482 // ----------------------------------------------------------------------------
1481 // End of x11_util_internal.h 1483 // End of x11_util_internal.h
1482 1484
1483 1485
1484 } // namespace ui 1486 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698