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

Unified Diff: chrome/browser/history_view.cc

Issue 13236: History View CRect to gfx Cleanup (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 12 years 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: chrome/browser/history_view.cc
===================================================================
--- chrome/browser/history_view.cc (revision 6493)
+++ chrome/browser/history_view.cc (working copy)
@@ -275,7 +275,7 @@
static const int kMaxSnippetWidth = 500;
// Returns the bounds of the thumbnail.
- void GetThumbnailBounds(CRect* rect);
+ void GetThumbnailBounds(gfx::Rect* rect);
// Convert a GURL into a displayable string.
std::wstring DisplayURL(const GURL& url);
@@ -344,12 +344,12 @@
HistoryItemRenderer::~HistoryItemRenderer() {
}
-void HistoryItemRenderer::GetThumbnailBounds(CRect* rect) {
+void HistoryItemRenderer::GetThumbnailBounds(gfx::Rect* rect) {
DCHECK(rect);
- rect->right = width() - kEntryPadding;
- rect->left = rect->right - kThumbnailWidth;
- rect->top = kEntryPadding;
- rect->bottom = rect->top + kThumbnailHeight;
+ rect->set_x(width() - kEntryPadding - kThumbnailWidth);
+ rect->set_y(kEntryPadding);
+ rect->set_width(kThumbnailWidth);
+ rect->set_height(kThumbnailHeight);
}
std::wstring HistoryItemRenderer::DisplayURL(const GURL& url) {
@@ -366,13 +366,12 @@
// Draw thumbnail or placeholder.
if (show_full_) {
SkBitmap* thumbnail = model_->GetThumbnail(model_index_);
- CRect thumbnail_rect;
+ gfx::Rect thumbnail_rect;
GetThumbnailBounds(&thumbnail_rect); // Includes border
// If the UI layout is right-to-left, we must mirror the bounds so that we
// render the bitmap in the correct position.
- gfx::Rect mirrored_rect(thumbnail_rect);
- thumbnail_rect.MoveToX(MirroredLeftPointForRect(mirrored_rect));
+ thumbnail_rect.set_x(MirroredLeftPointForRect(thumbnail_rect));
if (thumbnail) {
// This will create a MipMap for the bitmap if one doesn't exist already
@@ -383,17 +382,17 @@
canvas->DrawBitmapInt(
*thumbnail,
0, 0, thumbnail->width(), thumbnail->height(),
- thumbnail_rect.left, thumbnail_rect.top,
- thumbnail_rect.Width(), thumbnail_rect.Height(),
+ thumbnail_rect.x(), thumbnail_rect.y(),
+ thumbnail_rect.width(), thumbnail_rect.height(),
true);
} else {
canvas->FillRectInt(SK_ColorWHITE,
- thumbnail_rect.left, thumbnail_rect.top,
- thumbnail_rect.Width(), thumbnail_rect.Height());
+ thumbnail_rect.x(), thumbnail_rect.y(),
+ thumbnail_rect.width(), thumbnail_rect.height());
}
canvas->DrawRectInt(SkColorSetRGB(153, 153, 191),
- thumbnail_rect.left, thumbnail_rect.top,
- thumbnail_rect.Width(), thumbnail_rect.Height());
+ thumbnail_rect.x(), thumbnail_rect.y(),
+ thumbnail_rect.width(), thumbnail_rect.height());
}
// Draw the favicon.
@@ -420,11 +419,11 @@
void HistoryItemRenderer::Layout() {
// Figure out the maximum x-position of any text.
- CRect thumbnail_rect;
+ gfx::Rect thumbnail_rect;
int max_x;
if (show_full_) {
GetThumbnailBounds(&thumbnail_rect);
- max_x = thumbnail_rect.left - kEntryPadding;
+ max_x = thumbnail_rect.x() - kEntryPadding;
} else {
max_x = width() - kEntryPadding;
}
@@ -517,7 +516,7 @@
snippet_label_->SetBounds(title_x,
kEntryPadding + snippet_label_->GetLineHeight(),
std::min(
- static_cast<int>(thumbnail_rect.left -
+ static_cast<int>(thumbnail_rect.x() -
title_x),
kMaxSnippetWidth) -
kEntryPadding * 2,
@@ -620,14 +619,13 @@
// Is it over the thumbnail?
if (show_full_ && model_->GetThumbnail(model_index_)) {
- CRect thumbnail_loc;
+ gfx::Rect thumbnail_loc;
GetThumbnailBounds(&thumbnail_loc);
// If the UI layout is right-to-left, we mirror the thumbnail bounds before
// we check whether or not it contains the point in question.
- gfx::Rect mirrored_loc(thumbnail_loc);
- thumbnail_loc.MoveToX(MirroredLeftPointForRect(mirrored_loc));
- if (gfx::Rect(thumbnail_loc).Contains(x, y))
+ thumbnail_loc.set_x(MirroredLeftPointForRect(thumbnail_loc));
+ if (thumbnail_loc.Contains(x, y))
return THUMBNAIL;
}
« 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