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

Side by Side Diff: chrome/browser/ui/views/frame/browser_view.cc

Issue 1393013007: Add a Canvas::SaveAndUnscale() method for pixel-accurate drawing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 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 canvas->Save(); 553 const float scale = canvas->SaveAndUnscale();
554 SkScalar scale_factor = 1.0f / canvas->image_scale(); 554 gfx::RectF rect(gfx::ScaleRect(gfx::RectF(bounds), scale));
555 canvas->sk_canvas()->scale(scale_factor, scale_factor); 555 rect.Inset(0, rect.height() - 1, 0, 0);
556
557 gfx::RectF line_rect =
558 gfx::ScaleRect(gfx::RectF(bounds), canvas->image_scale());
559 line_rect.Inset(0, line_rect.height() - 1, 0, 0);
560
561 SkPaint paint; 556 SkPaint paint;
562 paint.setColor(color); 557 paint.setColor(color);
563 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(line_rect), paint); 558 canvas->sk_canvas()->drawRect(gfx::RectFToSkRect(rect), paint);
564 canvas->Restore(); 559 canvas->Restore();
565 } 560 }
566 561
567 void BrowserView::InitStatusBubble() { 562 void BrowserView::InitStatusBubble() {
568 status_bubble_.reset(new StatusBubbleViews(contents_web_view_)); 563 status_bubble_.reset(new StatusBubbleViews(contents_web_view_));
569 contents_web_view_->SetStatusBubble(status_bubble_.get()); 564 contents_web_view_->SetStatusBubble(status_bubble_.get());
570 } 565 }
571 566
572 gfx::Rect BrowserView::GetToolbarBounds() const { 567 gfx::Rect BrowserView::GetToolbarBounds() const {
573 gfx::Rect toolbar_bounds(toolbar_->bounds()); 568 gfx::Rect toolbar_bounds(toolbar_->bounds());
(...skipping 2060 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 return immersive_mode_controller()->IsEnabled(); 2629 return immersive_mode_controller()->IsEnabled();
2635 } 2630 }
2636 2631
2637 views::Widget* BrowserView::GetBubbleAssociatedWidget() { 2632 views::Widget* BrowserView::GetBubbleAssociatedWidget() {
2638 return GetWidget(); 2633 return GetWidget();
2639 } 2634 }
2640 2635
2641 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() { 2636 gfx::Rect BrowserView::GetTopContainerBoundsInScreen() {
2642 return top_container_->GetBoundsInScreen(); 2637 return top_container_->GetBoundsInScreen();
2643 } 2638 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698