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

Side by Side Diff: chrome/browser/ui/views/tabs/tab.cc

Issue 2085673004: Fix tab strip rendering at non-integral scale factors in MD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add comment Created 4 years, 6 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 | « chrome/browser/ui/views/frame/browser_view.cc ('k') | 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/tabs/tab.h" 5 #include "chrome/browser/ui/views/tabs/tab.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <limits> 8 #include <limits>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1638 matching lines...) Expand 10 before | Expand all | Expand 10 after
1649 1649
1650 // Extends the area to the bottom when the crash animation is in progress. 1650 // Extends the area to the bottom when the crash animation is in progress.
1651 if (crash_icon_animation_->is_animating()) 1651 if (crash_icon_animation_->is_animating())
1652 bounds.set_height(height() - bounds.y()); 1652 bounds.set_height(height() - bounds.y());
1653 bounds.set_x(GetMirroredXForRect(bounds)); 1653 bounds.set_x(GetMirroredXForRect(bounds));
1654 SchedulePaintInRect(bounds); 1654 SchedulePaintInRect(bounds);
1655 } 1655 }
1656 1656
1657 void Tab::GetFillPath(float scale, SkPath* fill) const { 1657 void Tab::GetFillPath(float scale, SkPath* fill) const {
1658 const float right = width() * scale; 1658 const float right = width() * scale;
1659 const float bottom = height() * scale; 1659 // The bottom of the tab needs to be pixel-aligned or else when we call
1660 // ClipPath with anti-aliasing enabled it can cause artifacts.
1661 const float bottom = std::ceil(height() * scale);
1660 const float unscaled_endcap_width = GetUnscaledEndcapWidth(); 1662 const float unscaled_endcap_width = GetUnscaledEndcapWidth();
1661 1663
1662 fill->moveTo(right - 1, bottom); 1664 fill->moveTo(right - 1, bottom);
1663 fill->rCubicTo(-0.75 * scale, 0, -1.625 * scale, -0.5 * scale, -2 * scale, 1665 fill->rCubicTo(-0.75 * scale, 0, -1.625 * scale, -0.5 * scale, -2 * scale,
1664 -1.5 * scale); 1666 -1.5 * scale);
1665 fill->lineTo(right - 1 - (unscaled_endcap_width - 2) * scale, 2.5 * scale); 1667 fill->lineTo(right - 1 - (unscaled_endcap_width - 2) * scale, 2.5 * scale);
1666 // Prevent overdraw in the center near minimum width (only happens if 1668 // Prevent overdraw in the center near minimum width (only happens if
1667 // scale < 2). We could instead avoid this by increasing the tab inset 1669 // scale < 2). We could instead avoid this by increasing the tab inset
1668 // values, but that would shift all the content inward as well, unless we 1670 // values, but that would shift all the content inward as well, unless we
1669 // then overlapped the content on the endcaps, by which point we'd have a 1671 // then overlapped the content on the endcaps, by which point we'd have a
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1760 inactive_images_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER); 1762 inactive_images_.image_c = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_CENTER);
1761 inactive_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT); 1763 inactive_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_INACTIVE_RIGHT);
1762 inactive_images_.l_width = inactive_images_.image_l->width(); 1764 inactive_images_.l_width = inactive_images_.image_l->width();
1763 inactive_images_.r_width = inactive_images_.image_r->width(); 1765 inactive_images_.r_width = inactive_images_.image_r->width();
1764 1766
1765 mask_images_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT); 1767 mask_images_.image_l = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_LEFT);
1766 mask_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT); 1768 mask_images_.image_r = rb.GetImageSkiaNamed(IDR_TAB_ALPHA_RIGHT);
1767 mask_images_.l_width = mask_images_.image_l->width(); 1769 mask_images_.l_width = mask_images_.image_l->width();
1768 mask_images_.r_width = mask_images_.image_r->width(); 1770 mask_images_.r_width = mask_images_.image_r->width();
1769 } 1771 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698