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

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

Issue 2416603002: Add ability to compute text intercepts to Font (Closed)
Patch Set: Rebased Created 4 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
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 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 SkPaint paint(immutableState()->fillPaint()); 703 SkPaint paint(immutableState()->fillPaint());
704 paint.setColor(strokeColor().rgb()); 704 paint.setColor(strokeColor().rgb());
705 paint.setStyle(SkPaint::kStroke_Style); 705 paint.setStyle(SkPaint::kStroke_Style);
706 paint.setStrokeWidth(1); 706 paint.setStrokeWidth(1);
707 707
708 skRect.inset(0.5f, 0.5f); 708 skRect.inset(0.5f, 0.5f);
709 drawRect(skRect, paint); 709 drawRect(skRect, paint);
710 } 710 }
711 } 711 }
712 712
713 int GraphicsContext::getTextIntercepts(const blink::Font& font,
714 const blink::TextRunPaintInfo& runInfo,
715 const SkScalar* bounds,
716 SkScalar* intervals) {
717 if (contextDisabled())
718 return 0;
719
720 return font.getTextIntercepts(m_canvas, runInfo, m_deviceScaleFactor,
721 immutableState()->fillPaint(), bounds,
722 intervals);
723 }
724
713 void GraphicsContext::drawText(const Font& font, 725 void GraphicsContext::drawText(const Font& font,
714 const TextRunPaintInfo& runInfo, 726 const TextRunPaintInfo& runInfo,
715 const FloatPoint& point, 727 const FloatPoint& point,
716 const SkPaint& paint) { 728 const SkPaint& paint) {
717 if (contextDisabled()) 729 if (contextDisabled())
718 return; 730 return;
719 731
720 if (font.drawText(m_canvas, runInfo, point, m_deviceScaleFactor, paint)) 732 if (font.drawText(m_canvas, runInfo, point, m_deviceScaleFactor, paint))
721 m_paintController.setTextPainted(); 733 m_paintController.setTextPainted();
722 } 734 }
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
1410 static const SkPMColor colors[] = { 1422 static const SkPMColor colors[] = {
1411 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red 1423 SkPreMultiplyARGB(0x60, 0xFF, 0x00, 0x00), // More transparent red
1412 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray 1424 SkPreMultiplyARGB(0x60, 0xC0, 0xC0, 0xC0) // More transparent gray
1413 }; 1425 };
1414 1426
1415 return colors[index]; 1427 return colors[index];
1416 } 1428 }
1417 #endif 1429 #endif
1418 1430
1419 } // namespace blink 1431 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698