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

Unified Diff: ui/views/window/custom_frame_view.cc

Issue 97633002: views: Cleanup PaintRestoredClientEdge() function. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: revert some changes Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/window/custom_frame_view.cc
diff --git a/ui/views/window/custom_frame_view.cc b/ui/views/window/custom_frame_view.cc
index 838a79c83f8a3d57ebd09490fe14afda7c722818..313e88ca835578681904e91487b34a32e0edfd73 100644
--- a/ui/views/window/custom_frame_view.cc
+++ b/ui/views/window/custom_frame_view.cc
@@ -388,54 +388,68 @@ void CustomFrameView::PaintRestoredClientEdge(gfx::Canvas* canvas) {
int client_area_top = client_area_bounds.y();
ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance();
- const gfx::ImageSkia* top_left = rb.GetImageNamed(
- IDR_APP_TOP_LEFT).ToImageSkia();
- const gfx::ImageSkia* top = rb.GetImageNamed(
- IDR_APP_TOP_CENTER).ToImageSkia();
- const gfx::ImageSkia* top_right = rb.GetImageNamed(
- IDR_APP_TOP_RIGHT).ToImageSkia();
- const gfx::ImageSkia* right = rb.GetImageNamed(
- IDR_CONTENT_RIGHT_SIDE).ToImageSkia();
- const gfx::ImageSkia* bottom_right = rb.GetImageNamed(
- IDR_CONTENT_BOTTOM_RIGHT_CORNER).ToImageSkia();
- const gfx::ImageSkia* bottom = rb.GetImageNamed(
- IDR_CONTENT_BOTTOM_CENTER).ToImageSkia();
- const gfx::ImageSkia* bottom_left = rb.GetImageNamed(
- IDR_CONTENT_BOTTOM_LEFT_CORNER).ToImageSkia();
- const gfx::ImageSkia* left = rb.GetImageNamed(
- IDR_CONTENT_LEFT_SIDE).ToImageSkia();
-
- // Top.
- int top_edge_y = client_area_top - top->height();
- canvas->DrawImageInt(*top_left, client_area_bounds.x() - top_left->width(),
+
+ // Top: left, center, right sides.
+ const gfx::ImageSkia* top_left = rb.GetImageSkiaNamed(IDR_APP_TOP_LEFT);
+ const gfx::ImageSkia* top_center = rb.GetImageSkiaNamed(IDR_APP_TOP_CENTER);
+ const gfx::ImageSkia* top_right = rb.GetImageSkiaNamed(IDR_APP_TOP_RIGHT);
+ int top_edge_y = client_area_top - top_center->height();
+ canvas->DrawImageInt(*top_left,
+ client_area_bounds.x() - top_left->width(),
top_edge_y);
- canvas->TileImageInt(*top, client_area_bounds.x(), top_edge_y,
- client_area_bounds.width(), top->height());
+ canvas->TileImageInt(*top_center,
+ client_area_bounds.x(),
+ top_edge_y,
+ client_area_bounds.width(),
+ top_center->height());
canvas->DrawImageInt(*top_right, client_area_bounds.right(), top_edge_y);
- // Right.
+ // Right side.
+ const gfx::ImageSkia* right = rb.GetImageSkiaNamed(IDR_CONTENT_RIGHT_SIDE);
int client_area_bottom =
std::max(client_area_top, client_area_bounds.bottom());
int client_area_height = client_area_bottom - client_area_top;
- canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top,
- right->width(), client_area_height);
+ canvas->TileImageInt(*right,
+ client_area_bounds.right(),
+ client_area_top,
+ right->width(),
+ client_area_height);
+
+ // Bottom: left, center, right sides.
+ const gfx::ImageSkia* bottom_left =
+ rb.GetImageSkiaNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER);
+ const gfx::ImageSkia* bottom_center =
+ rb.GetImageSkiaNamed(IDR_CONTENT_BOTTOM_CENTER);
+ const gfx::ImageSkia* bottom_right =
+ rb.GetImageSkiaNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER);
- // Bottom.
- canvas->DrawImageInt(*bottom_right, client_area_bounds.right(),
- client_area_bottom);
- canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom,
- client_area_bounds.width(), bottom_right->height());
canvas->DrawImageInt(*bottom_left,
- client_area_bounds.x() - bottom_left->width(), client_area_bottom);
+ client_area_bounds.x() - bottom_left->width(),
+ client_area_bottom);
+
+ canvas->TileImageInt(*bottom_center,
+ client_area_bounds.x(),
+ client_area_bottom,
+ client_area_bounds.width(),
+ bottom_right->height());
- // Left.
- canvas->TileImageInt(*left, client_area_bounds.x() - left->width(),
- client_area_top, left->width(), client_area_height);
+ canvas->DrawImageInt(*bottom_right,
+ client_area_bounds.right(),
+ client_area_bottom);
+ // Left side.
+ const gfx::ImageSkia* left = rb.GetImageSkiaNamed(IDR_CONTENT_LEFT_SIDE);
+ canvas->TileImageInt(*left,
+ client_area_bounds.x() - left->width(),
+ client_area_top,
+ left->width(),
+ client_area_height);
// Draw the color to fill in the edges.
- canvas->FillRect(gfx::Rect(client_area_bounds.x() - 1, client_area_top - 1,
- client_area_bounds.width() + 1, client_area_bottom - client_area_top + 1),
- kClientEdgeColor);
+ canvas->FillRect(gfx::Rect(client_area_bounds.x() - 1,
+ client_area_top - 1,
+ client_area_bounds.width() + 1,
+ client_area_bottom - client_area_top + 1),
+ kClientEdgeColor);
}
SkColor CustomFrameView::GetFrameColor() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698