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

Side by Side Diff: views/window/custom_frame_view.cc

Issue 8405002: ui/gfx: Convert Canvas::FillRectInt() to use gfx::Rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: save some vertical space, interactive_ui_tests are fixed by Peter's fix Created 9 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 | Annotate | Revision Log
« no previous file with comments | « views/touchui/touch_selection_controller_impl.cc ('k') | views/window/dialog_client_view.cc » ('j') | 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 "views/window/custom_frame_view.h" 5 #include "views/window/custom_frame_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "grit/ui_resources.h" 10 #include "grit/ui_resources.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 SkBitmap* right_edge = rb.GetBitmapNamed(IDR_WINDOW_RIGHT_SIDE); 338 SkBitmap* right_edge = rb.GetBitmapNamed(IDR_WINDOW_RIGHT_SIDE);
339 SkBitmap* left_edge = rb.GetBitmapNamed(IDR_WINDOW_LEFT_SIDE); 339 SkBitmap* left_edge = rb.GetBitmapNamed(IDR_WINDOW_LEFT_SIDE);
340 SkBitmap* bottom_left_corner = 340 SkBitmap* bottom_left_corner =
341 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER); 341 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_LEFT_CORNER);
342 SkBitmap* bottom_right_corner = 342 SkBitmap* bottom_right_corner =
343 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER); 343 rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_RIGHT_CORNER);
344 SkBitmap* bottom_edge = rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER); 344 SkBitmap* bottom_edge = rb.GetBitmapNamed(IDR_WINDOW_BOTTOM_CENTER);
345 345
346 // Fill with the frame color first so we have a constant background for 346 // Fill with the frame color first so we have a constant background for
347 // areas not covered by the theme image. 347 // areas not covered by the theme image.
348 canvas->FillRectInt(frame_color, 0, 0, width(), frame_image->height()); 348 canvas->FillRect(frame_color,
349 // Now fill down the sides. 349 gfx::Rect(0, 0, width(), frame_image->height()));
350 canvas->FillRectInt(frame_color, 0, frame_image->height(), left_edge->width(), 350
351 height() - frame_image->height()); 351 int remaining_height = height() - frame_image->height();
352 canvas->FillRectInt(frame_color, width() - right_edge->width(), 352 if (remaining_height > 0) {
353 frame_image->height(), right_edge->width(), 353 // Now fill down the sides.
354 height() - frame_image->height()); 354 canvas->FillRect(frame_color,
355 // Now fill the bottom area. 355 gfx::Rect(0, frame_image->height(), left_edge->width(),
356 canvas->FillRectInt(frame_color, 356 remaining_height));
357 left_edge->width(), height() - bottom_edge->height(), 357 canvas->FillRect(frame_color,
358 width() - left_edge->width() - right_edge->width(), 358 gfx::Rect(width() - right_edge->width(),
359 bottom_edge->height()); 359 frame_image->height(), right_edge->width(),
360 remaining_height));
361 int center_width = width() - left_edge->width() - right_edge->width();
362 if (center_width > 0) {
363 // Now fill the bottom area.
364 canvas->FillRect(frame_color,
365 gfx::Rect(left_edge->width(),
366 height() - bottom_edge->height(),
367 center_width, bottom_edge->height()));
368 }
369 }
360 370
361 // Draw the theme frame. 371 // Draw the theme frame.
362 canvas->TileImageInt(*frame_image, 0, 0, width(), frame_image->height()); 372 canvas->TileImageInt(*frame_image, 0, 0, width(), frame_image->height());
363 373
364 // Top. 374 // Top.
365 canvas->DrawBitmapInt(*top_left_corner, 0, 0); 375 canvas->DrawBitmapInt(*top_left_corner, 0, 0);
366 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0, 376 canvas->TileImageInt(*top_edge, top_left_corner->width(), 0,
367 width() - top_right_corner->width(), top_edge->height()); 377 width() - top_right_corner->width(), top_edge->height());
368 canvas->DrawBitmapInt(*top_right_corner, 378 canvas->DrawBitmapInt(*top_right_corner,
369 width() - top_right_corner->width(), 0); 379 width() - top_right_corner->width(), 0);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont()); 588 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont());
579 #elif defined(OS_LINUX) 589 #elif defined(OS_LINUX)
580 // TODO(ben): need to resolve what font this is. 590 // TODO(ben): need to resolve what font this is.
581 title_font_ = new gfx::Font(); 591 title_font_ = new gfx::Font();
582 #endif 592 #endif
583 initialized = true; 593 initialized = true;
584 } 594 }
585 } 595 }
586 596
587 } // namespace views 597 } // namespace views
OLDNEW
« no previous file with comments | « views/touchui/touch_selection_controller_impl.cc ('k') | views/window/dialog_client_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698