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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "chrome/browser/ui/views/frame/browser_view.h" 5 #include "chrome/browser/ui/views/frame/browser_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 543
544 // static 544 // static
545 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) { 545 BrowserView* BrowserView::GetBrowserViewForBrowser(const Browser* browser) {
546 return static_cast<BrowserView*>(browser->window()); 546 return static_cast<BrowserView*>(browser->window());
547 } 547 }
548 548
549 // static 549 // static
550 void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas, 550 void BrowserView::Paint1pxHorizontalLine(gfx::Canvas* canvas,
551 SkColor color, 551 SkColor color,
552 const gfx::Rect& bounds) { 552 const gfx::Rect& bounds) {
553 const float scale = canvas->SaveAndUnscale(); 553 ScopedCanvas scoped(canvas);
554 const float scale = canvas->UnscaleTheDeviceScaleFactor();
554 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale)); 555 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
555 rect.Inset(0, rect.height() - 1, 0, 0); 556 rect.Inset(0, rect.height() - 1, 0, 0);
556 SkPaint paint; 557 SkPaint paint;
557 paint.setColor(color); 558 paint.setColor(color);
558 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint); 559 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
559 canvas->Restore();
560 } 560 }
561 561
562 void BrowserView::InitStatusBubble() { 562 void BrowserView::InitStatusBubble() {
563 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); 563 status_bubble_.reset(new StatusBubbleViews(contents_web_view_));
564 contents_web_view_->SetStatusBubble(status_bubble_.get()); 564 contents_web_view_->SetStatusBubble(status_bubble_.get());
565 } 565 }
566 566
567 gfx::Rect BrowserView::GetToolbarBounds() const { 567 gfx::Rect BrowserView::GetToolbarBounds() const {
568 gfx::Rect toolbar_bounds(toolbar_->bounds()); 568 gfx::Rect toolbar_bounds(toolbar_->bounds());
569 if (toolbar_bounds.IsEmpty()) 569 if (toolbar_bounds.IsEmpty())
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2630 return immersive_mode_controller()->IsEnabled(); 2630 return immersive_mode_controller()->IsEnabled();
2631 } 2631 }
2632 2632
2633 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2633 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2634 return GetWidget(); 2634 return GetWidget();
2635 } 2635 }
2636 2636
2637 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2637 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2638 return top_container_->GetBoundsInScreen(); 2638 return top_container_->GetBoundsInScreen();
2639 } 2639 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698