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

Side by Side Diff: ash/frame/default_header_painter.cc

Issue 1425163002: gfx: Rename canvas SaveAndUnscale to UnscaleTheDeviceScaleFactor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ninepatchscale
Patch Set: scopedunscale: . Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | ui/gfx/canvas.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/frame/default_header_painter.h" 5 #include "ash/frame/default_header_painter.h"
6 6
7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" 7 #include "ash/frame/caption_buttons/frame_caption_button_container_view.h"
8 #include "ash/frame/header_painter_util.h" 8 #include "ash/frame/header_painter_util.h"
9 #include "base/debug/leak_annotations.h" 9 #include "base/debug/leak_annotations.h"
10 #include "base/logging.h" // DCHECK 10 #include "base/logging.h" // DCHECK
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 gfx::Rect title_bounds = GetTitleBounds(); 255 gfx::Rect title_bounds = GetTitleBounds();
256 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds)); 256 title_bounds.set_x(view_->GetMirroredXForRect(title_bounds));
257 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(), 257 canvas->DrawStringRectWithFlags(frame_->widget_delegate()->GetWindowTitle(),
258 GetTitleFontList(), 258 GetTitleFontList(),
259 kTitleTextColor, 259 kTitleTextColor,
260 title_bounds, 260 title_bounds,
261 gfx::Canvas::NO_SUBPIXEL_RENDERING); 261 gfx::Canvas::NO_SUBPIXEL_RENDERING);
262 } 262 }
263 263
264 void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) { 264 void DefaultHeaderPainter::PaintHeaderContentSeparator(gfx::Canvas* canvas) {
265 const float scale = canvas->SaveAndUnscale(); 265 ScopedCanvas scoped(canvas);
Peter Kasting 2015/10/29 23:11:10 The variable name "scoped" doesn't really pass sty
danakj 2015/10/30 17:51:21 Done.
266 const float scale = canvas->UnscaleTheDeviceScaleFactor();
266 gfx::RectF rect(0, painted_height_ * scale - 1, view_->width() * scale, 1); 267 gfx::RectF rect(0, painted_height_ * scale - 1, view_->width() * scale, 1);
267 SkPaint paint; 268 SkPaint paint;
268 paint.setColor((mode_ == MODE_ACTIVE) ? 269 paint.setColor((mode_ == MODE_ACTIVE) ?
269 kHeaderContentSeparatorColor : kHeaderContentSeparatorInactiveColor); 270 kHeaderContentSeparatorColor : kHeaderContentSeparatorInactiveColor);
270 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); 271 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
271 canvas->Restore();
272 } 272 }
273 273
274 void DefaultHeaderPainter::LayoutLeftHeaderView() { 274 void DefaultHeaderPainter::LayoutLeftHeaderView() {
275 if (left_header_view_) { 275 if (left_header_view_) {
276 // Vertically center the left header view with respect to the caption button 276 // Vertically center the left header view with respect to the caption button
277 // container. 277 // container.
278 // Floor when computing the center of |caption_button_container_|. 278 // Floor when computing the center of |caption_button_container_|.
279 gfx::Size size = left_header_view_->GetPreferredSize(); 279 gfx::Size size = left_header_view_->GetPreferredSize();
280 int icon_offset_y = caption_button_container_->height() / 2 - 280 int icon_offset_y = caption_button_container_->height() / 2 -
281 size.height() / 2; 281 size.height() / 2;
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 return HeaderPainterUtil::GetTitleBounds( 347 return HeaderPainterUtil::GetTitleBounds(
348 left_header_view_, caption_button_container_, GetTitleFontList()); 348 left_header_view_, caption_button_container_, GetTitleFontList());
349 } 349 }
350 350
351 bool DefaultHeaderPainter::UsesCustomFrameColors() const { 351 bool DefaultHeaderPainter::UsesCustomFrameColors() const {
352 return active_frame_color_ != kDefaultFrameColor || 352 return active_frame_color_ != kDefaultFrameColor ||
353 inactive_frame_color_ != kDefaultFrameColor; 353 inactive_frame_color_ != kDefaultFrameColor;
354 } 354 }
355 355
356 } // namespace ash 356 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc » ('j') | ui/gfx/canvas.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698