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

Side by Side Diff: chrome/common/extensions/extension_action.cc

Issue 7067031: roll skia 1402:1410 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: post revert Created 9 years, 7 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/common/extensions/extension_action.h" 5 #include "chrome/common/extensions/extension_action.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/common/badge_util.h" 10 #include "chrome/common/badge_util.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 badge_width = std::max(kBadgeHeight, badge_width); 140 badge_width = std::max(kBadgeHeight, badge_width);
141 141
142 // Paint the badge background color in the right location. It is usually 142 // Paint the badge background color in the right location. It is usually
143 // right-aligned, but it can also be center-aligned if it is large. 143 // right-aligned, but it can also be center-aligned if it is large.
144 SkRect rect; 144 SkRect rect;
145 rect.fBottom = SkIntToScalar(bounds.bottom() - kBottomMargin); 145 rect.fBottom = SkIntToScalar(bounds.bottom() - kBottomMargin);
146 rect.fTop = rect.fBottom - SkIntToScalar(kBadgeHeight); 146 rect.fTop = rect.fBottom - SkIntToScalar(kBadgeHeight);
147 if (badge_width >= kCenterAlignThreshold) { 147 if (badge_width >= kCenterAlignThreshold) {
148 rect.fLeft = SkIntToScalar( 148 rect.fLeft = SkIntToScalar(
149 SkScalarFloor(SkIntToScalar(bounds.x()) + 149 SkScalarFloor(SkIntToScalar(bounds.x()) +
150 SkIntToScalar(bounds.width() / 2.0) - 150 SkIntToScalar(bounds.width()) / 2 -
151 SkIntToScalar(badge_width / 2.0))); 151 SkIntToScalar(badge_width) / 2));
152 rect.fRight = rect.fLeft + SkIntToScalar(badge_width); 152 rect.fRight = rect.fLeft + SkIntToScalar(badge_width);
153 } else { 153 } else {
154 rect.fRight = SkIntToScalar(bounds.right()); 154 rect.fRight = SkIntToScalar(bounds.right());
155 rect.fLeft = rect.fRight - badge_width; 155 rect.fLeft = rect.fRight - badge_width;
156 } 156 }
157 157
158 SkPaint rect_paint; 158 SkPaint rect_paint;
159 rect_paint.setStyle(SkPaint::kFill_Style); 159 rect_paint.setStyle(SkPaint::kFill_Style);
160 rect_paint.setAntiAlias(true); 160 rect_paint.setAntiAlias(true);
161 rect_paint.setColor(background_color); 161 rect_paint.setColor(background_color);
(...skipping 23 matching lines...) Expand all
185 // text was too large. 185 // text was too large.
186 rect.fLeft += kPadding; 186 rect.fLeft += kPadding;
187 rect.fRight -= kPadding; 187 rect.fRight -= kPadding;
188 canvas->AsCanvasSkia()->clipRect(rect); 188 canvas->AsCanvasSkia()->clipRect(rect);
189 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(), 189 canvas->AsCanvasSkia()->drawText(text.c_str(), text.size(),
190 rect.fLeft + (rect.width() - text_width) / 2, 190 rect.fLeft + (rect.width() - text_width) / 2,
191 rect.fTop + kTextSize + kTopTextPadding, 191 rect.fTop + kTextSize + kTopTextPadding,
192 *text_paint); 192 *text_paint);
193 canvas->Restore(); 193 canvas->Restore();
194 } 194 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/create_application_shortcut_view.cc ('k') | skia/ext/canvas_paint_mac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698