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

Unified Diff: trunk/src/chrome/browser/speech/speech_recognition_bubble.cc

Issue 24262008: Revert 224473 "Remove dependency on ui::ScaleFactor from ui/gfx" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: trunk/src/chrome/browser/speech/speech_recognition_bubble.cc
===================================================================
--- trunk/src/chrome/browser/speech/speech_recognition_bubble.cc (revision 224497)
+++ trunk/src/chrome/browser/speech/speech_recognition_bubble.cc (working copy)
@@ -95,7 +95,7 @@
// 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 image has the correct rowBytes and renders fine.
- frame.EnsureRepsForSupportedScales();
+ frame.EnsureRepsForSupportedScaleFactors();
std::vector<gfx::ImageSkiaRep> image_reps = frame.image_reps();
gfx::ImageSkia frame_copy;
for (size_t i = 0; i < image_reps.size(); ++i) {
@@ -103,7 +103,7 @@
SkBitmap copy_dst;
copy_src.copyTo(&copy_dst, SkBitmap::kARGB_8888_Config);
frame_copy.AddRepresentation(gfx::ImageSkiaRep(
- copy_dst, image_reps[i].scale()));
+ copy_dst, image_reps[i].scale_factor()));
}
spinner_.push_back(frame_copy);
@@ -140,15 +140,16 @@
animation_step_(0),
display_mode_(DISPLAY_MODE_RECORDING),
web_contents_(web_contents),
- scale_(1.0f) {
+ scale_factor_(ui::SCALE_FACTOR_NONE) {
gfx::NativeView view =
web_contents_ ? web_contents_->GetView()->GetNativeView() : NULL;
gfx::Screen* screen = gfx::Screen::GetScreenFor(view);
gfx::Display display = screen->GetDisplayNearestWindow(view);
- scale_ = display.device_scale_factor();
+ scale_factor_ = ui::GetScaleFactorFromScale(
+ display.device_scale_factor());
const gfx::ImageSkiaRep& rep =
- g_images.Get().mic_empty()->GetRepresentation(scale_);
+ g_images.Get().mic_empty()->GetRepresentation(scale_factor_);
mic_image_.reset(new SkBitmap());
mic_image_->setConfig(SkBitmap::kARGB_8888_Config,
rep.pixel_width(), rep.pixel_height());
@@ -234,12 +235,13 @@
(((1.0f - volume) * (width * (kVolumeSteps + 1))) - width) / kVolumeSteps;
buffer_canvas.clipRect(SkRect::MakeLTRB(0, 0,
SkIntToScalar(width) - clip_right, SkIntToScalar(height)));
- buffer_canvas.drawBitmap(image.GetRepresentation(scale_).sk_bitmap(), 0, 0);
+ buffer_canvas.drawBitmap(
+ image.GetRepresentation(scale_factor_).sk_bitmap(), 0, 0);
buffer_canvas.restore();
SkPaint multiply_paint;
multiply_paint.setXfermodeMode(SkXfermode::kModulate_Mode);
buffer_canvas.drawBitmap(
- g_images.Get().mic_mask()->GetRepresentation(scale_).sk_bitmap(),
+ g_images.Get().mic_mask()->GetRepresentation(scale_factor_).sk_bitmap(),
-clip_right, 0, &multiply_paint);
canvas->drawBitmap(*buffer_image_.get(), 0, 0);
@@ -253,12 +255,12 @@
// Draw the empty volume image first and the current volume image on top,
// and then the noise volume image on top of both.
canvas.drawBitmap(
- g_images.Get().mic_empty()->GetRepresentation(scale_).sk_bitmap(),
+ g_images.Get().mic_empty()->GetRepresentation(scale_factor_).sk_bitmap(),
0, 0);
DrawVolumeOverlay(&canvas, *g_images.Get().mic_full(), volume);
DrawVolumeOverlay(&canvas, *g_images.Get().mic_noise(), noise_volume);
- gfx::ImageSkia image(gfx::ImageSkiaRep(*mic_image_.get(), scale_));
+ gfx::ImageSkia image(gfx::ImageSkiaRep(*mic_image_.get(), scale_factor_));
SetImage(image);
}

Powered by Google App Engine
This is Rietveld 408576698