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

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

Issue 9021046: Pass const gfx::Rect& as the first parameter to FillRect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more fix 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
« no previous file with comments | « ui/views/window/dialog_client_view.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "grit/ui_resources.h" 7 #include "grit/ui_resources.h"
8 #include "third_party/skia/include/core/SkCanvas.h" 8 #include "third_party/skia/include/core/SkCanvas.h"
9 #include "third_party/skia/include/core/SkColor.h" 9 #include "third_party/skia/include/core/SkColor.h"
10 #include "ui/base/theme_provider.h" 10 #include "ui/base/theme_provider.h"
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 void FrameBackground::PaintMaximized(gfx::Canvas* canvas, View* view) const { 134 void FrameBackground::PaintMaximized(gfx::Canvas* canvas, View* view) const {
135 // We will be painting from top_offset to top_offset + theme_frame_height. If 135 // We will be painting from top_offset to top_offset + theme_frame_height. If
136 // this is less than top_area_height_, we need to paint the frame color 136 // this is less than top_area_height_, we need to paint the frame color
137 // to fill in the area beneath the image. 137 // to fill in the area beneath the image.
138 // TODO(jamescook): I'm not sure this is correct, as it doesn't seem to fully 138 // TODO(jamescook): I'm not sure this is correct, as it doesn't seem to fully
139 // account for the top_offset, but this is how it worked before. 139 // account for the top_offset, but this is how it worked before.
140 int theme_frame_bottom = maximized_top_offset_ + theme_bitmap_->height(); 140 int theme_frame_bottom = maximized_top_offset_ + theme_bitmap_->height();
141 if (top_area_height_ > theme_frame_bottom) { 141 if (top_area_height_ > theme_frame_bottom) {
142 canvas->FillRect(frame_color_, 142 canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
143 gfx::Rect(0, 0, view->width(), top_area_height_)); 143 frame_color_);
144 } 144 }
145 145
146 int left_offset = 0; 146 int left_offset = 0;
147 int right_offset = 0; 147 int right_offset = 0;
148 148
149 // Draw top-left and top-right corners to give maximized ChromeOS windows 149 // Draw top-left and top-right corners to give maximized ChromeOS windows
150 // a rounded appearance. 150 // a rounded appearance.
151 if (maximized_top_left_ || maximized_top_right_) { 151 if (maximized_top_left_ || maximized_top_right_) {
152 // If we have either a left or right we should have both. 152 // If we have either a left or right we should have both.
153 DCHECK(maximized_top_left_ && maximized_top_right_); 153 DCHECK(maximized_top_left_ && maximized_top_right_);
(...skipping 10 matching lines...) Expand all
164 maximized_top_offset_, 164 maximized_top_offset_,
165 view->width() - (left_offset + right_offset), 165 view->width() - (left_offset + right_offset),
166 theme_bitmap_->height()); 166 theme_bitmap_->height());
167 // Draw the theme frame overlay, if available. 167 // Draw the theme frame overlay, if available.
168 if (theme_overlay_bitmap_) 168 if (theme_overlay_bitmap_)
169 canvas->DrawBitmapInt(*theme_overlay_bitmap_, 0, theme_background_y_); 169 canvas->DrawBitmapInt(*theme_overlay_bitmap_, 0, theme_background_y_);
170 } 170 }
171 171
172 void FrameBackground::PaintFrameColor(gfx::Canvas* canvas, View* view) const { 172 void FrameBackground::PaintFrameColor(gfx::Canvas* canvas, View* view) const {
173 // Fill the top area. 173 // Fill the top area.
174 canvas->FillRect(frame_color_, 174 canvas->FillRect(gfx::Rect(0, 0, view->width(), top_area_height_),
175 gfx::Rect(0, 0, view->width(), top_area_height_)); 175 frame_color_);
176 176
177 // If the window is very short, we're done. 177 // If the window is very short, we're done.
178 int remaining_height = view->height() - top_area_height_; 178 int remaining_height = view->height() - top_area_height_;
179 if (remaining_height <= 0) 179 if (remaining_height <= 0)
180 return; 180 return;
181 181
182 // Fill down the sides. 182 // Fill down the sides.
183 canvas->FillRect(frame_color_, 183 canvas->FillRect(gfx::Rect(0, top_area_height_, left_edge_->width(),
184 gfx::Rect(0, top_area_height_, 184 remaining_height), frame_color_);
185 left_edge_->width(), remaining_height)); 185 canvas->FillRect(gfx::Rect(view->width() - right_edge_->width(),
186 canvas->FillRect(frame_color_, 186 top_area_height_, right_edge_->width(),
187 gfx::Rect(view->width() - right_edge_->width(), 187 remaining_height), frame_color_);
188 top_area_height_,
189 right_edge_->width(),
190 remaining_height));
191 188
192 // If the window is very narrow, we're done. 189 // If the window is very narrow, we're done.
193 int center_width = 190 int center_width =
194 view->width() - left_edge_->width() - right_edge_->width(); 191 view->width() - left_edge_->width() - right_edge_->width();
195 if (center_width <= 0) 192 if (center_width <= 0)
196 return; 193 return;
197 194
198 // Fill the bottom area. 195 // Fill the bottom area.
199 canvas->FillRect(frame_color_, 196 canvas->FillRect(gfx::Rect(left_edge_->width(),
200 gfx::Rect(left_edge_->width(),
201 view->height() - bottom_edge_->height(), 197 view->height() - bottom_edge_->height(),
202 center_width, 198 center_width, bottom_edge_->height()),
203 bottom_edge_->height())); 199 frame_color_);
204 } 200 }
205 201
206 } // namespace views 202 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/window/dialog_client_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698