Commit f96ad858 authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Ozone/DRM: Alternative fix for cursor stopping on Chrome OS

We would like the bitmap list in BitmapCursorOzone to be either empty
or every bitmap be valid. If the provided bitmap is null, just don't
add it to the list. Instances created from WebCursors can sometimes
have null bitmaps.

Bug: 620927
Change-Id: I0e78bfcb544fe6751dc48e378e495feaec220af8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1789909Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Commit-Queue: Saman Sami <samans@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694320}
parent d521671f
......@@ -38,7 +38,8 @@ scoped_refptr<BitmapCursorOzone> CreateDefaultBitmapCursor(CursorType type) {
BitmapCursorOzone::BitmapCursorOzone(const SkBitmap& bitmap,
const gfx::Point& hotspot)
: hotspot_(hotspot), frame_delay_ms_(0) {
bitmaps_.push_back(bitmap);
if (!bitmap.isNull())
bitmaps_.push_back(bitmap);
}
BitmapCursorOzone::BitmapCursorOzone(const std::vector<SkBitmap>& bitmaps,
......@@ -47,6 +48,11 @@ BitmapCursorOzone::BitmapCursorOzone(const std::vector<SkBitmap>& bitmaps,
: bitmaps_(bitmaps), hotspot_(hotspot), frame_delay_ms_(frame_delay_ms) {
DCHECK_LT(0U, bitmaps.size());
DCHECK_LE(0, frame_delay_ms);
// No null bitmap should be in the list. Blank cursors should just be an empty
// vector.
DCHECK(std::find_if(bitmaps_.begin(), bitmaps_.end(),
[](const SkBitmap& bitmap) { return bitmap.isNull(); }) ==
bitmaps_.end());
}
BitmapCursorOzone::~BitmapCursorOzone() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment