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

Side by Side Diff: ui/views/window/frame_background.cc

Issue 1439423002: Make browser frame square when running on windows 10 with a theme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@but
Patch Set: rebased Created 4 years, 8 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
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/window/frame_background.h" 5 #include "ui/views/window/frame_background.h"
6 6
7 #include "third_party/skia/include/core/SkCanvas.h" 7 #include "third_party/skia/include/core/SkCanvas.h"
8 #include "third_party/skia/include/core/SkColor.h" 8 #include "third_party/skia/include/core/SkColor.h"
9 #include "ui/base/theme_provider.h" 9 #include "ui/base/theme_provider.h"
10 #include "ui/gfx/canvas.h" 10 #include "ui/gfx/canvas.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 PaintFrameColor(canvas, view); 55 PaintFrameColor(canvas, view);
56 56
57 // Draw the theme frame and overlay, if available. 57 // Draw the theme frame and overlay, if available.
58 if (!theme_image_.isNull()) { 58 if (!theme_image_.isNull()) {
59 canvas->TileImageInt(theme_image_, 0, 0, view->width(), 59 canvas->TileImageInt(theme_image_, 0, 0, view->width(),
60 theme_image_.height()); 60 theme_image_.height());
61 } 61 }
62 if (!theme_overlay_image_.isNull()) 62 if (!theme_overlay_image_.isNull())
63 canvas->DrawImageInt(theme_overlay_image_, 0, 0); 63 canvas->DrawImageInt(theme_overlay_image_, 0, 0);
64 64
65 if (!left_edge_ || !right_edge_ ||!bottom_edge_ || !top_edge_ ||
66 !top_left_corner_ || !top_right_corner_ || !bottom_right_corner_ ||
67 !bottom_left_corner_) {
68 return;
69 }
70
65 // Draw the top corners and edge, scaling the corner images down if they 71 // Draw the top corners and edge, scaling the corner images down if they
66 // are too big and relative to the vertical space available. 72 // are too big and relative to the vertical space available.
67 int top_left_height = 73 int top_left_height =
68 std::min(top_left_corner_->height(), 74 std::min(top_left_corner_->height(),
69 view->height() - bottom_left_corner_->height()); 75 view->height() - bottom_left_corner_->height());
70 canvas->DrawImageInt(*top_left_corner_, 76 canvas->DrawImageInt(*top_left_corner_,
71 0, 0, top_left_corner_->width(), top_left_height, 77 0, 0, top_left_corner_->width(), top_left_height,
72 0, 0, top_left_corner_->width(), top_left_height, 78 0, 0, top_left_corner_->width(), top_left_height,
73 false); 79 false);
74 canvas->TileImageInt(*top_edge_, 80 canvas->TileImageInt(*top_edge_,
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 const View* view) const { 150 const View* view) const {
145 // Fill the top area. 151 // Fill the top area.
146 canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_), 152 canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
147 frame_color_); 153 frame_color_);
148 154
149 // If the window is very short, we're done. 155 // If the window is very short, we're done.
150 int remaining_height = view->height() - top_area_height_; 156 int remaining_height = view->height() - top_area_height_;
151 if (remaining_height <= 0) 157 if (remaining_height <= 0)
152 return; 158 return;
153 159
160 if (!left_edge_ || !right_edge_ ||!bottom_edge_)
161 return;
162
154 // Fill down the sides. 163 // Fill down the sides.
155 canvas->FillRect(gfx::Rect(0, top_area_height_, left_edge_->width(), 164 canvas->FillRect(gfx::Rect(0, top_area_height_, left_edge_->width(),
156 remaining_height), frame_color_); 165 remaining_height), frame_color_);
157 canvas->FillRect(gfx::Rect(view->width() - right_edge_->width(), 166 canvas->FillRect(gfx::Rect(view->width() - right_edge_->width(),
158 top_area_height_, right_edge_->width(), 167 top_area_height_, right_edge_->width(),
159 remaining_height), frame_color_); 168 remaining_height), frame_color_);
160 169
161 // If the window is very narrow, we're done. 170 // If the window is very narrow, we're done.
162 int center_width = 171 int center_width =
163 view->width() - left_edge_->width() - right_edge_->width(); 172 view->width() - left_edge_->width() - right_edge_->width();
164 if (center_width <= 0) 173 if (center_width <= 0)
165 return; 174 return;
166 175
167 // Fill the bottom area. 176 // Fill the bottom area.
168 canvas->FillRect(gfx::Rect(left_edge_->width(), 177 canvas->FillRect(gfx::Rect(left_edge_->width(),
169 view->height() - bottom_edge_->height(), 178 view->height() - bottom_edge_->height(),
170 center_width, bottom_edge_->height()), 179 center_width, bottom_edge_->height()),
171 frame_color_); 180 frame_color_);
172 } 181 }
173 182
174 } // namespace views 183 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/opaque_browser_frame_view_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698