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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.cc

Issue 1055933003: views: Don't need to anti-alias clip a rect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h" 5 #include "chrome/browser/ui/views/omnibox/omnibox_popup_contents_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "chrome/browser/search/search.h" 9 #include "chrome/browser/search/search.h"
10 #include "chrome/browser/themes/theme_properties.h" 10 #include "chrome/browser/themes/theme_properties.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 width(), bottom_shadow_->height()); 415 width(), bottom_shadow_->height());
416 } 416 }
417 417
418 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) { 418 void OmniboxPopupContentsView::PaintChildren(const ui::PaintContext& context) {
419 gfx::Rect contents_bounds = GetContentsBounds(); 419 gfx::Rect contents_bounds = GetContentsBounds();
420 contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0, 420 contents_bounds.Inset(0, views::NonClientFrameView::kClientEdgeThickness, 0,
421 bottom_shadow_->height() - kBorderInterior); 421 bottom_shadow_->height() - kBorderInterior);
422 422
423 gfx::Canvas* canvas = context.canvas(); 423 gfx::Canvas* canvas = context.canvas();
424 canvas->Save(); 424 canvas->Save();
425 canvas->sk_canvas()->clipRect(gfx::RectToSkRect(contents_bounds), 425 canvas->ClipRect(contents_bounds);
426 SkRegion::kIntersect_Op,
427 true /* doAntialias */);
428 canvas->DrawColor(result_view_at(0)->GetColor(OmniboxResultView::NORMAL, 426 canvas->DrawColor(result_view_at(0)->GetColor(OmniboxResultView::NORMAL,
429 OmniboxResultView::BACKGROUND)); 427 OmniboxResultView::BACKGROUND));
430 View::PaintChildren(context); 428 View::PaintChildren(context);
431 canvas->Restore(); 429 canvas->Restore();
432 } 430 }
433 431
434 //////////////////////////////////////////////////////////////////////////////// 432 ////////////////////////////////////////////////////////////////////////////////
435 // OmniboxPopupContentsView, private: 433 // OmniboxPopupContentsView, private:
436 434
437 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root, 435 views::View* OmniboxPopupContentsView::TargetForRect(views::View* root,
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 size_t index = GetIndexForPoint(event.location()); 479 size_t index = GetIndexForPoint(event.location());
482 if (!HasMatchAt(index)) 480 if (!HasMatchAt(index))
483 return; 481 return;
484 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition, 482 omnibox_view_->OpenMatch(model_->result().match_at(index), disposition,
485 GURL(), base::string16(), index); 483 GURL(), base::string16(), index);
486 } 484 }
487 485
488 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) { 486 OmniboxResultView* OmniboxPopupContentsView::result_view_at(size_t i) {
489 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i))); 487 return static_cast<OmniboxResultView*>(child_at(static_cast<int>(i)));
490 } 488 }
OLDNEW
« 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