| OLD | NEW |
| 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 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 864 if (paintingDisabled()) | 864 if (paintingDisabled()) |
| 865 return; | 865 return; |
| 866 | 866 |
| 867 ASSERT(!rect.isEmpty()); | 867 ASSERT(!rect.isEmpty()); |
| 868 if (rect.isEmpty()) | 868 if (rect.isEmpty()) |
| 869 return; | 869 return; |
| 870 | 870 |
| 871 platformContext()->drawRect(rect); | 871 platformContext()->drawRect(rect); |
| 872 } | 872 } |
| 873 | 873 |
| 874 void GraphicsContext::drawText(const Font& font, const TextRun& run, const Float
Point& point, int from, int to) | 874 void GraphicsContext::drawText(const Font& font, const TextRunPaintInfo& runInfo
, const FloatPoint& point) |
| 875 { | 875 { |
| 876 if (paintingDisabled()) | 876 if (paintingDisabled()) |
| 877 return; | 877 return; |
| 878 | 878 |
| 879 font.drawText(this, run, point, from, to); | 879 font.drawText(this, runInfo, point); |
| 880 } | 880 } |
| 881 | 881 |
| 882 void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRun& run, co
nst AtomicString& mark, const FloatPoint& point, int from, int to) | 882 void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRunPaintInfo
& runInfo, const AtomicString& mark, const FloatPoint& point) |
| 883 { | 883 { |
| 884 if (paintingDisabled()) | 884 if (paintingDisabled()) |
| 885 return; | 885 return; |
| 886 | 886 |
| 887 font.drawEmphasisMarks(this, run, mark, point, from, to); | 887 font.drawEmphasisMarks(this, runInfo, mark, point); |
| 888 } | 888 } |
| 889 | 889 |
| 890 void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const F
loatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction) | 890 void GraphicsContext::drawBidiText(const Font& font, const TextRunPaintInfo& run
Info, const FloatPoint& point, Font::CustomFontNotReadyAction customFontNotReady
Action) |
| 891 { | 891 { |
| 892 if (paintingDisabled()) | 892 if (paintingDisabled()) |
| 893 return; | 893 return; |
| 894 | 894 |
| 895 // sub-run painting is not supported for Bidi text. |
| 896 const TextRun& run = runInfo.run; |
| 897 ASSERT((runInfo.from == 0) && (runInfo.to == run.length())); |
| 895 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; | 898 BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver; |
| 896 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()
)); | 899 bidiResolver.setStatus(BidiStatus(run.direction(), run.directionalOverride()
)); |
| 897 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); | 900 bidiResolver.setPositionIgnoringNestedIsolates(TextRunIterator(&run, 0)); |
| 898 | 901 |
| 899 // FIXME: This ownership should be reversed. We should pass BidiRunList | 902 // FIXME: This ownership should be reversed. We should pass BidiRunList |
| 900 // to BidiResolver in createBidiRunsForLine. | 903 // to BidiResolver in createBidiRunsForLine. |
| 901 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); | 904 BidiRunList<BidiCharacterRun>& bidiRuns = bidiResolver.runs(); |
| 902 bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length())); | 905 bidiResolver.createBidiRunsForLine(TextRunIterator(&run, run.length())); |
| 903 if (!bidiRuns.runCount()) | 906 if (!bidiRuns.runCount()) |
| 904 return; | 907 return; |
| 905 | 908 |
| 906 FloatPoint currPoint = point; | 909 FloatPoint currPoint = point; |
| 907 BidiCharacterRun* bidiRun = bidiRuns.firstRun(); | 910 BidiCharacterRun* bidiRun = bidiRuns.firstRun(); |
| 908 while (bidiRun) { | 911 while (bidiRun) { |
| 909 TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun-
>start()); | 912 TextRun subrun = run.subRun(bidiRun->start(), bidiRun->stop() - bidiRun-
>start()); |
| 910 bool isRTL = bidiRun->level() % 2; | 913 bool isRTL = bidiRun->level() % 2; |
| 911 subrun.setDirection(isRTL ? RTL : LTR); | 914 subrun.setDirection(isRTL ? RTL : LTR); |
| 912 subrun.setDirectionalOverride(bidiRun->dirOverride(false)); | 915 subrun.setDirectionalOverride(bidiRun->dirOverride(false)); |
| 913 | 916 |
| 914 font.drawText(this, subrun, currPoint, 0, -1, customFontNotReadyAction); | 917 TextRunPaintInfo subrunInfo(subrun); |
| 918 subrunInfo.bounds = runInfo.bounds; |
| 919 font.drawText(this, subrunInfo, currPoint, customFontNotReadyAction); |
| 915 | 920 |
| 916 bidiRun = bidiRun->next(); | 921 bidiRun = bidiRun->next(); |
| 917 // FIXME: Have Font::drawText return the width of what it drew so that w
e don't have to re-measure here. | 922 // FIXME: Have Font::drawText return the width of what it drew so that w
e don't have to re-measure here. |
| 918 if (bidiRun) | 923 if (bidiRun) |
| 919 currPoint.move(font.width(subrun), 0); | 924 currPoint.move(font.width(subrun), 0); |
| 920 } | 925 } |
| 921 | 926 |
| 922 bidiRuns.deleteRuns(); | 927 bidiRuns.deleteRuns(); |
| 923 } | 928 } |
| 924 | 929 |
| (...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 static const SkPMColor colors[] = { | 1768 static const SkPMColor colors[] = { |
| 1764 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red | 1769 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red |
| 1765 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray | 1770 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray |
| 1766 }; | 1771 }; |
| 1767 | 1772 |
| 1768 return colors[index]; | 1773 return colors[index]; |
| 1769 } | 1774 } |
| 1770 #endif | 1775 #endif |
| 1771 | 1776 |
| 1772 } | 1777 } |
| OLD | NEW |