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

Unified Diff: cc/font_atlas.cc

Issue 11416239: Fix tautological compares in font_atlas.cc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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: cc/font_atlas.cc
diff --git a/cc/font_atlas.cc b/cc/font_atlas.cc
index aa464da7eafb76bda436476eddf6e867ddc8dbbc..6fe22aee79e8d48e5905f537bad6ff48a9ee9827 100644
--- a/cc/font_atlas.cc
+++ b/cc/font_atlas.cc
@@ -42,7 +42,9 @@ void FontAtlas::drawOneLineOfTextInternal(SkCanvas* canvas, const SkPaint& paint
gfx::Point position = destPosition;
for (unsigned i = 0; i < textLine.length(); ++i) {
// If the ASCII code is out of bounds, then index 0 is used, which is just a plain rectangle glyph.
- int asciiIndex = (textLine[i] < 128) ? textLine[i] : 0;
+ unsigned asciiIndex = textLine[i];
+ if (asciiIndex >= 128)
+ asciiIndex = 0;
gfx::Rect glyphBounds = m_asciiToRectTable[asciiIndex];
SkIRect source = SkIRect::MakeXYWH(glyphBounds.x(), glyphBounds.y(), glyphBounds.width(), glyphBounds.height());
canvas->drawBitmapRect(m_atlas, &source, SkRect::MakeXYWH(position.x(), position.y(), glyphBounds.width(), glyphBounds.height()), &paint);
@@ -59,7 +61,9 @@ gfx::Size FontAtlas::textSize(const std::string& text)
for (size_t i = 0; i < lines.size(); ++i) {
int lineWidth = 0;
for (size_t j = 0; j < lines[i].size(); ++j) {
- int asciiIndex = (lines[i][j] < 128) ? lines[i][j] : 0;
+ unsigned asciiIndex = lines[i][j];
+ if (asciiIndex >= 128)
+ asciiIndex = 0;
lineWidth += m_asciiToRectTable[asciiIndex].width();
}
if (lineWidth > maxWidth)
« 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