diff options
author | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 14:26:35 +0000 |
---|---|---|
committer | satish@chromium.org <satish@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-18 14:26:35 +0000 |
commit | 9f359e209f2e7cbbf93bf94f76937132c16b391d (patch) | |
tree | 21ec348a7264f6001787090b23c2d01fef492a4a /chrome/browser/speech | |
parent | 8c9d4ba6af47099c5ce030d0802b276cd8fd37b2 (diff) | |
download | chromium_src-9f359e209f2e7cbbf93bf94f76937132c16b391d.zip chromium_src-9f359e209f2e7cbbf93bf94f76937132c16b391d.tar.gz chromium_src-9f359e209f2e7cbbf93bf94f76937132c16b391d.tar.bz2 |
Fix 2 speech input display issues seen in the M8 dev channel build.
- The animation code was splitting the sprite into multiple bitmaps by drawing them onto a smaller canvas. In the mac build this was generating corrupted frames due to what appears like a Skia issue. I'm reporting this to the Skia team and in the mean time working around it by calling .extractSubset and copying it into a new bitmap. The copying-to-new-bitmap is required because without that it renders incorrectly squished vertically in Linux (!).
- The speech bubble was positioned at the wrong X coordinate on Mac. Earlier we had to manually adjust the X coordinate to get the arrow point at the position we want, but now the base info bubble code already takes care of it so our adjustment is no longer needed.
BUG=none
TEST=manual, try speech input and verify that the animation looks right on all platforms and the bubble is positioned pointing at the text.
Review URL: http://codereview.chromium.org/3859001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62924 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/speech')
-rw-r--r-- | chrome/browser/speech/speech_input_bubble.cc | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/chrome/browser/speech/speech_input_bubble.cc b/chrome/browser/speech/speech_input_bubble.cc index 44704dc..655415f 100644 --- a/chrome/browser/speech/speech_input_bubble.cc +++ b/chrome/browser/speech/speech_input_bubble.cc @@ -60,18 +60,21 @@ SpeechInputBubbleBase::SpeechInputBubbleBase() // The sprite image consists of all the animation frames put together in one // horizontal/wide image. Each animation frame is square in shape within the // sprite. - int frame_size = spinner_->height(); - SkRect dst_rect(SkRect::MakeWH(SkIntToScalar(frame_size), - SkIntToScalar(frame_size))); - for (SkIRect src_rect(SkIRect::MakeWH(frame_size, frame_size)); + const int kFrameSize = spinner_->height(); + for (SkIRect src_rect(SkIRect::MakeWH(kFrameSize, kFrameSize)); src_rect.fLeft < spinner_->width(); - src_rect.offset(frame_size, 0)) { + src_rect.offset(kFrameSize, 0)) { SkBitmap frame; - frame.setConfig(SkBitmap::kARGB_8888_Config, frame_size, frame_size); - frame.allocPixels(); - SkCanvas canvas(frame); - canvas.drawBitmapRect(*spinner_, &src_rect, dst_rect); - animation_frames_.push_back(frame); + spinner_->extractSubset(&frame, src_rect); + + // The bitmap created by extractSubset just points to the same pixels as + // the original and adjusts rowBytes accordingly. However that doesn't + // render properly and gets vertically squished in Linux due to a bug in + // Skia. Until that gets fixed we work around by taking a real copy of it + // below as the copied bitmap has the correct rowBytes and renders fine. + SkBitmap frame_copy; + frame.copyTo(&frame_copy, SkBitmap::kARGB_8888_Config); + animation_frames_.push_back(frame_copy); } } |