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

Side by Side Diff: ui/views/window/custom_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: reland 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) 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/custom_frame_view.h" 5 #include "ui/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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 frame_background_->set_top_area_height(frame_image->height()); 364 frame_background_->set_top_area_height(frame_image->height());
365 365
366 frame_background_->PaintMaximized(canvas, this); 366 frame_background_->PaintMaximized(canvas, this);
367 367
368 // TODO(jamescook): Migrate this into FrameBackground. 368 // TODO(jamescook): Migrate this into FrameBackground.
369 // The bottom of the titlebar actually comes from the top of the Client Edge 369 // The bottom of the titlebar actually comes from the top of the Client Edge
370 // graphic, with the actual client edge clipped off the bottom. 370 // graphic, with the actual client edge clipped off the bottom.
371 SkBitmap* titlebar_bottom = rb.GetBitmapNamed(IDR_APP_TOP_CENTER); 371 SkBitmap* titlebar_bottom = rb.GetBitmapNamed(IDR_APP_TOP_CENTER);
372 int edge_height = titlebar_bottom->height() - 372 int edge_height = titlebar_bottom->height() -
373 (ShouldShowClientEdge() ? kClientEdgeThickness : 0); 373 (ShouldShowClientEdge() ? kClientEdgeThickness : 0);
374 canvas->TileImageInt(*titlebar_bottom, 0, 374 canvas->TileImage(*titlebar_bottom, gfx::Rect(0,
375 frame_->client_view()->y() - edge_height, width(), edge_height); 375 frame_->client_view()->y() - edge_height, width(), edge_height));
376 } 376 }
377 377
378 void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) { 378 void CustomFrameView::PaintTitleBar(gfx::Canvas* canvas) {
379 WidgetDelegate* d = frame_->widget_delegate(); 379 WidgetDelegate* d = frame_->widget_delegate();
380 380
381 // It seems like in some conditions we can be asked to paint after the window 381 // It seems like in some conditions we can be asked to paint after the window
382 // that contains us is WM_DESTROYed. At this point, our delegate is NULL. The 382 // that contains us is WM_DESTROYed. At this point, our delegate is NULL. The
383 // correct long term fix may be to shut down the RootView in WM_DESTROY. 383 // correct long term fix may be to shut down the RootView in WM_DESTROY.
384 if (!d) 384 if (!d)
385 return; 385 return;
(...skipping 17 matching lines...) Expand all
403 rb.GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER); 403 rb.GetBitmapNamed(IDR_CONTENT_BOTTOM_RIGHT_CORNER);
404 SkBitmap* bottom = rb.GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER); 404 SkBitmap* bottom = rb.GetBitmapNamed(IDR_CONTENT_BOTTOM_CENTER);
405 SkBitmap* bottom_left = 405 SkBitmap* bottom_left =
406 rb.GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER); 406 rb.GetBitmapNamed(IDR_CONTENT_BOTTOM_LEFT_CORNER);
407 SkBitmap* left = rb.GetBitmapNamed(IDR_CONTENT_LEFT_SIDE); 407 SkBitmap* left = rb.GetBitmapNamed(IDR_CONTENT_LEFT_SIDE);
408 408
409 // Top. 409 // Top.
410 int top_edge_y = client_area_top - top->height(); 410 int top_edge_y = client_area_top - top->height();
411 canvas->DrawBitmapInt(*top_left, client_area_bounds.x() - top_left->width(), 411 canvas->DrawBitmapInt(*top_left, client_area_bounds.x() - top_left->width(),
412 top_edge_y); 412 top_edge_y);
413 canvas->TileImageInt(*top, client_area_bounds.x(), top_edge_y, 413 canvas->TileImage(*top, gfx::Rect(client_area_bounds.x(), top_edge_y,
414 client_area_bounds.width(), top->height()); 414 client_area_bounds.width(), top->height()));
415 canvas->DrawBitmapInt(*top_right, client_area_bounds.right(), top_edge_y); 415 canvas->DrawBitmapInt(*top_right, client_area_bounds.right(), top_edge_y);
416 416
417 // Right. 417 // Right.
418 int client_area_bottom = 418 int client_area_bottom =
419 std::max(client_area_top, client_area_bounds.bottom()); 419 std::max(client_area_top, client_area_bounds.bottom());
420 int client_area_height = client_area_bottom - client_area_top; 420 int client_area_height = client_area_bottom - client_area_top;
421 canvas->TileImageInt(*right, client_area_bounds.right(), client_area_top, 421 canvas->TileImage(*right, gfx::Rect(client_area_bounds.right(),
422 right->width(), client_area_height); 422 client_area_top, right->width(), client_area_height));
423 423
424 // Bottom. 424 // Bottom.
425 canvas->DrawBitmapInt(*bottom_right, client_area_bounds.right(), 425 canvas->DrawBitmapInt(*bottom_right, client_area_bounds.right(),
426 client_area_bottom); 426 client_area_bottom);
427 canvas->TileImageInt(*bottom, client_area_bounds.x(), client_area_bottom, 427 canvas->TileImage(*bottom, gfx::Rect(client_area_bounds.x(),
428 client_area_bounds.width(), bottom_right->height()); 428 client_area_bottom, client_area_bounds.width(), bottom_right->height()));
429 canvas->DrawBitmapInt(*bottom_left, 429 canvas->DrawBitmapInt(*bottom_left,
430 client_area_bounds.x() - bottom_left->width(), client_area_bottom); 430 client_area_bounds.x() - bottom_left->width(), client_area_bottom);
431 431
432 // Left. 432 // Left.
433 canvas->TileImageInt(*left, client_area_bounds.x() - left->width(), 433 canvas->TileImage(*left, gfx::Rect(client_area_bounds.x() - left->width(),
434 client_area_top, left->width(), client_area_height); 434 client_area_top, left->width(), client_area_height));
435 435
436 // Draw the toolbar color to fill in the edges. 436 // Draw the toolbar color to fill in the edges.
437 canvas->DrawRect(gfx::Rect(client_area_bounds.x() - 1, client_area_top - 1, 437 canvas->DrawRect(gfx::Rect(client_area_bounds.x() - 1, client_area_top - 1,
438 client_area_bounds.width() + 1, client_area_bottom - client_area_top + 1), 438 client_area_bounds.width() + 1, client_area_bottom - client_area_top + 1),
439 ui::ResourceBundle::toolbar_color); 439 ui::ResourceBundle::toolbar_color);
440 } 440 }
441 441
442 SkColor CustomFrameView::GetFrameColor() const { 442 SkColor CustomFrameView::GetFrameColor() const {
443 return frame_->IsActive() ? kDefaultColorFrame : kDefaultColorFrameInactive; 443 return frame_->IsActive() ? kDefaultColorFrame : kDefaultColorFrameInactive;
444 } 444 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont()); 555 title_font_ = new gfx::Font(NativeWidgetWin::GetWindowTitleFont());
556 #elif defined(OS_LINUX) 556 #elif defined(OS_LINUX)
557 // TODO(ben): need to resolve what font this is. 557 // TODO(ben): need to resolve what font this is.
558 title_font_ = new gfx::Font(); 558 title_font_ = new gfx::Font();
559 #endif 559 #endif
560 initialized = true; 560 initialized = true;
561 } 561 }
562 } 562 }
563 563
564 } // namespace views 564 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698