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

Unified Diff: ash/frame/default_header_painter.cc

Issue 200493004: Make the header/content separator into a hairline for apps in hidpi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « ash/frame/custom_frame_view_ash_unittest.cc ('k') | ash/frame/header_painter_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/frame/default_header_painter.cc
diff --git a/ash/frame/default_header_painter.cc b/ash/frame/default_header_painter.cc
index d76096190a20796f31f46cc5c23e1757bb7f3887..a3372c62c6eed5528be20128b9b96b04fc93a3fc 100644
--- a/ash/frame/default_header_painter.cc
+++ b/ash/frame/default_header_painter.cc
@@ -30,8 +30,6 @@ namespace {
// Color for the window title text.
const SkColor kTitleTextColor = SkColorSetRGB(40, 40, 40);
-// Size of header/content separator line.
-const int kHeaderContentSeparatorSize = 1;
// Color of the active window header/content separator line.
const SkColor kHeaderContentSeparatorColor = SkColorSetRGB(180, 180, 182);
// Color of the inactive window header/content separator line.
@@ -218,13 +216,14 @@ void DefaultHeaderPainter::LayoutHeader() {
// Vertically center the window icon with respect to the caption button
// container.
int icon_size = HeaderPainterUtil::GetIconSize();
- int icon_offset_y = (caption_button_container_->height() - icon_size) / 2;
+ // Floor when computing the center of |caption_button_container|.
+ int icon_offset_y = caption_button_container_->height() / 2 - icon_size / 2;
window_icon_->SetBounds(HeaderPainterUtil::GetIconXOffset(), icon_offset_y,
icon_size, icon_size);
}
- SetHeaderHeightForPainting(caption_button_container_->height() +
- kHeaderContentSeparatorSize);
+ // The header/content separator line overlays the caption buttons.
+ SetHeaderHeightForPainting(caption_button_container_->height());
}
int DefaultHeaderPainter::GetHeaderHeightForPainting() const {
@@ -300,11 +299,14 @@ void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
kHeaderContentSeparatorColor :
kHeaderContentSeparatorInactiveColor;
- canvas->FillRect(gfx::Rect(0,
- height_ - kHeaderContentSeparatorSize,
- view_->width(),
- kHeaderContentSeparatorSize),
- color);
+ SkPaint paint;
+ paint.setColor(color);
+ // Draw the line as 1px thick regardless of scale factor.
James Cook 2014/03/17 16:55:59 Thanks for this comment. It saves the reader from
+ paint.setStrokeWidth(0);
+
+ float thickness = 1 / canvas->image_scale();
+ SkScalar y = SkIntToScalar(height_) - SkFloatToScalar(thickness);
+ canvas->sk_canvas()->drawLine(0, y, SkIntToScalar(view_->width()), y, paint);
}
gfx::Rect DefaultHeaderPainter::GetLocalBounds() const {
« no previous file with comments | « ash/frame/custom_frame_view_ash_unittest.cc ('k') | ash/frame/header_painter_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698