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

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

Issue 9332006: ui/gfx: Make the first version of Canvas::TileImageInt take a gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: put back the Peter's nits Created 8 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/opaque_browser_frame_view.h" 5 #include "chrome/browser/ui/views/frame/opaque_browser_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 frame_background_->PaintMaximized(canvas, this); 647 frame_background_->PaintMaximized(canvas, this);
648 648
649 // TODO(jamescook): Migrate this into FrameBackground. 649 // TODO(jamescook): Migrate this into FrameBackground.
650 if (!browser_view()->IsToolbarVisible()) { 650 if (!browser_view()->IsToolbarVisible()) {
651 // There's no toolbar to edge the frame border, so we need to draw a bottom 651 // There's no toolbar to edge the frame border, so we need to draw a bottom
652 // edge. The graphic we use for this has a built in client edge, so we clip 652 // edge. The graphic we use for this has a built in client edge, so we clip
653 // it off the bottom. 653 // it off the bottom.
654 SkBitmap* top_center = 654 SkBitmap* top_center =
655 GetThemeProvider()->GetBitmapNamed(IDR_APP_TOP_CENTER); 655 GetThemeProvider()->GetBitmapNamed(IDR_APP_TOP_CENTER);
656 int edge_height = top_center->height() - kClientEdgeThickness; 656 int edge_height = top_center->height() - kClientEdgeThickness;
657 canvas->TileImageInt(*top_center, 0, 657 canvas->TileImage(*top_center, gfx::Rect(0,
658 frame()->client_view()->y() - edge_height, width(), edge_height); 658 frame()->client_view()->y() - edge_height, width(), edge_height));
659 } 659 }
660 } 660 }
661 661
662 void OpaqueBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) { 662 void OpaqueBrowserFrameView::PaintTitleBar(gfx::Canvas* canvas) {
663 // The window icon is painted by the TabIconView. 663 // The window icon is painted by the TabIconView.
664 views::WidgetDelegate* delegate = frame()->widget_delegate(); 664 views::WidgetDelegate* delegate = frame()->widget_delegate();
665 if (!delegate) { 665 if (!delegate) {
666 LOG(WARNING) << "delegate is NULL"; 666 LOG(WARNING) << "delegate is NULL";
667 return; 667 return;
668 } 668 }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 kClientEdgeThickness), toolbar_color); 825 kClientEdgeThickness), toolbar_color);
826 } 826 }
827 827
828 int client_area_bottom = 828 int client_area_bottom =
829 std::max(client_area_top, height() - NonClientBorderThickness()); 829 std::max(client_area_top, height() - NonClientBorderThickness());
830 int image_height = client_area_bottom - image_top; 830 int image_height = client_area_bottom - image_top;
831 831
832 // Draw the client edge images. 832 // Draw the client edge images.
833 // Draw the client edge images. 833 // Draw the client edge images.
834 SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE); 834 SkBitmap* right = tp->GetBitmapNamed(IDR_CONTENT_RIGHT_SIDE);
835 canvas->TileImageInt(*right, client_area_bounds.right(), image_top, 835 canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(), image_top,
836 right->width(), image_height); 836 right->width(), image_height));
837 canvas->DrawBitmapInt( 837 canvas->DrawBitmapInt(
838 *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER), 838 *tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER),
839 client_area_bounds.right(), client_area_bottom); 839 client_area_bounds.right(), client_area_bottom);
840 SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); 840 SkBitmap* bottom = tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER);
841 canvas->TileImageInt(*bottom, client_area_bounds.x(), 841 canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(),
842 client_area_bottom, client_area_bounds.width(), 842 client_area_bottom, client_area_bounds.width(),
843 bottom->height()); 843 bottom->height()));
844 SkBitmap* bottom_left = 844 SkBitmap* bottom_left =
845 tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); 845 tp->GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER);
846 canvas->DrawBitmapInt(*bottom_left, 846 canvas->DrawBitmapInt(*bottom_left,
847 client_area_bounds.x() - bottom_left->width(), client_area_bottom); 847 client_area_bounds.x() - bottom_left->width(), client_area_bottom);
848 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); 848 SkBitmap* left = tp->GetBitmapNamed(IDR_CONTENT_LEFT_SIDE);
849 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), 849 canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(),
850 image_top, left->width(), image_height); 850 image_top, left->width(), image_height));
851 851
852 // Draw the toolbar color so that the client edges show the right color even 852 // Draw the toolbar color so that the client edges show the right color even
853 // where not covered by the toolbar image. NOTE: We do this after drawing the 853 // where not covered by the toolbar image. NOTE: We do this after drawing the
854 // images because the images are meant to alpha-blend atop the frame whereas 854 // images because the images are meant to alpha-blend atop the frame whereas
855 // these rects are meant to be fully opaque, without anything overlaid. 855 // these rects are meant to be fully opaque, without anything overlaid.
856 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness, 856 canvas->FillRect(gfx::Rect(client_area_bounds.x() - kClientEdgeThickness,
857 client_area_top, kClientEdgeThickness, 857 client_area_top, kClientEdgeThickness,
858 client_area_bottom + kClientEdgeThickness - client_area_top), 858 client_area_bottom + kClientEdgeThickness - client_area_top),
859 toolbar_color); 859 toolbar_color);
860 canvas->FillRect(gfx::Rect(client_area_bounds.x(), client_area_bottom, 860 canvas->FillRect(gfx::Rect(client_area_bounds.x(), client_area_bottom,
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1063 1063
1064 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width, 1064 gfx::Rect OpaqueBrowserFrameView::CalculateClientAreaBounds(int width,
1065 int height) const { 1065 int height) const {
1066 int top_height = NonClientTopBorderHeight(false); 1066 int top_height = NonClientTopBorderHeight(false);
1067 int border_thickness = NonClientBorderThickness(); 1067 int border_thickness = NonClientBorderThickness();
1068 return gfx::Rect(border_thickness, top_height, 1068 return gfx::Rect(border_thickness, top_height,
1069 std::max(0, width - (2 * border_thickness)), 1069 std::max(0, width - (2 * border_thickness)),
1070 std::max(0, height - GetReservedHeight() - 1070 std::max(0, height - GetReservedHeight() -
1071 top_height - border_thickness)); 1071 top_height - border_thickness));
1072 } 1072 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/app_panel_browser_frame_view.cc ('k') | chrome/browser/ui/views/tabs/tab.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698