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

Side by Side Diff: chrome/browser/ui/views/autocomplete/autocomplete_result_view.cc

Issue 8122013: Allow CanvasSkia to bind to an existing SkCanvas. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 1 more fix Created 9 years, 2 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 // For WinDDK ATL compatibility, these ATL headers must come first. 5 // For WinDDK ATL compatibility, these ATL headers must come first.
6 #include "build/build_config.h" 6 #include "build/build_config.h"
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <atlbase.h> // NOLINT 8 #include <atlbase.h> // NOLINT
9 #include <atlwin.h> // NOLINT 9 #include <atlwin.h> // NOLINT
10 #endif 10 #endif
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 LocationBarView::kItemPadding; 515 LocationBarView::kItemPadding;
516 int text_height = GetTextHeight(); 516 int text_height = GetTextHeight();
517 text_bounds_.SetRect(text_x, std::max(0, (height() - text_height) / 2), 517 text_bounds_.SetRect(text_x, std::max(0, (height() - text_height) / 2),
518 std::max(bounds().width() - text_x - LocationBarView::kEdgeItemPadding, 518 std::max(bounds().width() - text_x - LocationBarView::kEdgeItemPadding,
519 0), text_height); 519 0), text_height);
520 } 520 }
521 521
522 void AutocompleteResultView::OnPaint(gfx::Canvas* canvas) { 522 void AutocompleteResultView::OnPaint(gfx::Canvas* canvas) {
523 const ResultViewState state = GetState(); 523 const ResultViewState state = GetState();
524 if (state != NORMAL) 524 if (state != NORMAL)
525 canvas->AsCanvasSkia()->drawColor(GetColor(state, BACKGROUND)); 525 canvas->GetSkCanvas()->drawColor(GetColor(state, BACKGROUND));
526 526
527 // Paint the icon. 527 // Paint the icon.
528 canvas->DrawBitmapInt(*GetIcon(), GetMirroredXForRect(icon_bounds_), 528 canvas->DrawBitmapInt(*GetIcon(), GetMirroredXForRect(icon_bounds_),
529 icon_bounds_.y()); 529 icon_bounds_.y());
530 530
531 // Paint the text. 531 // Paint the text.
532 int x = GetMirroredXForRect(text_bounds_); 532 int x = GetMirroredXForRect(text_bounds_);
533 mirroring_context_->Initialize(x, text_bounds_.width()); 533 mirroring_context_->Initialize(x, text_bounds_.width());
534 PaintMatch(canvas, match_, x); 534 PaintMatch(canvas, match_, x);
535 } 535 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698