Commit 3094ebd5 authored by yoshiki@chromium.org's avatar yoshiki@chromium.org

Use SkBitmapOperations to extract a frame of animation cursors.

r201206 caused a regression. It broke animation cursors, because SkBitmap.extractSubset() doesn't extract a frame of animation cursor image. This patch fixes the regression, using SkBitmapOperations::CreateTiledBitmap to extract a frame of animation image instead of SkBitmap.extractSubset().

BUG=126942
TEST=The wait cursor animates correctly.

Review URL: https://chromiumcodereview.appspot.com/15896012

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202825 0039d316-1c4b-4281-b951-d872f2087c98
parent a9f0cfdf
...@@ -232,16 +232,13 @@ void CursorLoaderX11::LoadAnimatedCursor(int id, ...@@ -232,16 +232,13 @@ void CursorLoaderX11::LoadAnimatedCursor(int id,
int x_offset = frame_width * frame; int x_offset = frame_width * frame;
DCHECK_LE(x_offset + frame_width, total_width); DCHECK_LE(x_offset + frame_width, total_width);
SkBitmap cropped; SkBitmap cropped = SkBitmapOperations::CreateTiledBitmap(
SkIRect rect = SkIRect::MakeXYWH(x_offset, 0, frame_width, frame_height); bitmap, x_offset, 0, frame_width, frame_height);
bitmap.extractSubset(&cropped, rect);
DCHECK_EQ(frame_width, cropped.width()); DCHECK_EQ(frame_width, cropped.width());
DCHECK_EQ(frame_height, cropped.height()); DCHECK_EQ(frame_height, cropped.height());
if (scale() != 1.f)
ScaleCursorImageAndHotpoint(scale(), &cropped, &hotpoint);
XcursorImage* x_image = SkBitmapToXcursorImage(&cropped, hotpoint); XcursorImage* x_image = SkBitmapToXcursorImage(&cropped, hotpoint);
x_image->delay = frame_delay_ms; x_image->delay = frame_delay_ms;
x_images->images[frame] = x_image; x_images->images[frame] = x_image;
} }
......
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