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

Unified Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear 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: chrome/browser/ui/views/tabs/tab.cc
diff --git a/chrome/browser/ui/views/tabs/tab.cc b/chrome/browser/ui/views/tabs/tab.cc
index b7871eb591b2508780431457ce9aa04408b20ebd..29e55e1046d684c6036d74f1844728bf2dfb0125 100644
--- a/chrome/browser/ui/views/tabs/tab.cc
+++ b/chrome/browser/ui/views/tabs/tab.cc
@@ -1191,13 +1191,13 @@ void Tab::PaintInactiveTabBackgroundWithTitleChange(
gfx::Canvas* canvas,
gfx::MultiAnimation* animation) {
// Render the inactive tab background. We'll use this for clipping.
- gfx::Canvas background_canvas(size(), canvas->scale_factor(), false);
+ gfx::Canvas background_canvas(size(), canvas->image_scale(), false);
PaintInactiveTabBackground(&background_canvas);
gfx::ImageSkia background_image(background_canvas.ExtractImageRep());
// Draw a radial gradient to hover_canvas.
- gfx::Canvas hover_canvas(size(), canvas->scale_factor(), false);
+ gfx::Canvas hover_canvas(size(), canvas->image_scale(), false);
int radius = kMiniTitleChangeGradientRadius;
int x0 = width() + radius - kMiniTitleChangeInitialXOffset;
int x1 = radius;
@@ -1260,13 +1260,14 @@ void Tab::PaintInactiveTabBackground(gfx::Canvas* canvas) {
!hover_controller_.ShouldDraw();
if (can_cache) {
- gfx::ImageSkia cached_image(
- GetCachedImage(tab_id, size(), canvas->scale_factor()));
+ ui::ScaleFactor scale_factor =
+ ui::GetSupportedScaleFactor(canvas->image_scale());
+ gfx::ImageSkia cached_image(GetCachedImage(tab_id, size(), scale_factor));
if (cached_image.width() == 0) {
- gfx::Canvas tmp_canvas(size(), canvas->scale_factor(), false);
+ gfx::Canvas tmp_canvas(size(), canvas->image_scale(), false);
PaintInactiveTabBackgroundUsingResourceId(&tmp_canvas, tab_id);
cached_image = gfx::ImageSkia(tmp_canvas.ExtractImageRep());
- SetCachedImage(tab_id, canvas->scale_factor(), cached_image);
+ SetCachedImage(tab_id, scale_factor, cached_image);
}
canvas->DrawImageInt(cached_image, 0, 0);
} else {
@@ -1299,7 +1300,7 @@ void Tab::PaintInactiveTabBackgroundUsingResourceId(gfx::Canvas* canvas,
// We need a gfx::Canvas object to be able to extract the image from.
// We draw everything to this canvas and then output it to the canvas
// parameter in addition to using it to mask the hover glow if needed.
- gfx::Canvas background_canvas(size(), canvas->scale_factor(), false);
+ gfx::Canvas background_canvas(size(), canvas->image_scale(), false);
// Draw left edge. Don't draw over the toolbar, as we're not the foreground
// tab.

Powered by Google App Engine
This is Rietveld 408576698