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

Side by Side Diff: Source/platform/graphics/GraphicsContext.cpp

Issue 645363003: Consolidate most simple vs. complex Font methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: minor cleanup Created 6 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
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | Source/platform/text/TextRun.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved. 2 * Copyright (C) 2003, 2004, 2005, 2006, 2009 Apple Inc. All rights reserved.
3 * Copyright (C) 2013 Google Inc. All rights reserved. 3 * Copyright (C) 2013 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after
1031 1031
1032 // FIXME: This ownership should be reversed. We should pass BidiRunList 1032 // FIXME: This ownership should be reversed. We should pass BidiRunList
1033 // to BidiResolver in createBidiRunsForLine. 1033 // to BidiResolver in createBidiRunsForLine.
1034 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); 1034 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs();
1035 bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length())); 1035 bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length()));
1036 if (!bidiRuns.runCount()) 1036 if (!bidiRuns.runCount())
1037 return; 1037 return;
1038 1038
1039 FloatPoint currPoint = point; 1039 FloatPoint currPoint = point;
1040 BidiCharacterRun* bidiRun = bidiRuns.firstRun(); 1040 BidiCharacterRun* bidiRun = bidiRuns.firstRun();
1041 float width = 0;
1042 while (bidiRun) { 1041 while (bidiRun) {
1043 TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun- >start()); 1042 TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun- >start());
1044 bool isRTL = bidiRun->level() % 2; 1043 bool isRTL = bidiRun->level() % 2;
1045 subrun.setDirection(isRTL ? RTL : LTR); 1044 subrun.setDirection(isRTL ? RTL : LTR);
1046 subrun.setDirectionalOverride(bidiRun->dirOverride(false)); 1045 subrun.setDirectionalOverride(bidiRun->dirOverride(false));
1047 1046
1048 TextRunPaintInfo subrunInfo(subrun); 1047 TextRunPaintInfo subrunInfo(subrun);
1049 subrunInfo.bounds = runInfo.bounds; 1048 subrunInfo.bounds = runInfo.bounds;
1050 width = font.drawText(this, subrunInfo, currPoint, customFontNotReadyAct ion); 1049 float runWidth = font.drawUncachedText(this, subrunInfo, currPoint, cust omFontNotReadyAction);
1051
1052 1050
1053 bidiRun = bidiRun->next(); 1051 bidiRun = bidiRun->next();
1054 if (bidiRun) 1052 currPoint.move(runWidth, 0);
1055 currPoint.move(width, 0);
1056 } 1053 }
1057 1054
1058 bidiRuns.deleteRuns(); 1055 bidiRuns.deleteRuns();
1059 } 1056 }
1060 1057
1061 void GraphicsContext::drawHighlightForText(const Font& font, const TextRun& run, const FloatPoint& point, int h, const Color& backgroundColor, int from, int to) 1058 void GraphicsContext::drawHighlightForText(const Font& font, const TextRun& run, const FloatPoint& point, int h, const Color& backgroundColor, int from, int to)
1062 { 1059 {
1063 if (contextDisabled()) 1060 if (contextDisabled())
1064 return; 1061 return;
1065 1062
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after
2016 // FIXME: This is to not break tests (it results in the filter bitmap fl ag 2013 // FIXME: This is to not break tests (it results in the filter bitmap fl ag
2017 // being set to true). We need to decide if we respect InterpolationNone 2014 // being set to true). We need to decide if we respect InterpolationNone
2018 // being returned from computeInterpolationQuality. 2015 // being returned from computeInterpolationQuality.
2019 resampling = InterpolationLow; 2016 resampling = InterpolationLow;
2020 } 2017 }
2021 resampling = limitInterpolationQuality(this, resampling); 2018 resampling = limitInterpolationQuality(this, resampling);
2022 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling)); 2019 paint->setFilterLevel(static_cast<SkPaint::FilterLevel>(resampling));
2023 } 2020 }
2024 2021
2025 } // namespace blink 2022 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/shaping/HarfBuzzShaper.cpp ('k') | Source/platform/text/TextRun.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698