summaryrefslogtreecommitdiffstats
path: root/libs/hwui/OpenGLRenderer.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-06-01 14:52:00 -0700
committerRomain Guy <romainguy@google.com>2011-06-01 14:55:42 -0700
commit726aeba80ffc6778a9bc3e0ee957b8d644183505 (patch)
tree2a270831f12cfa6dd69a07e9068c76c3b737754e /libs/hwui/OpenGLRenderer.cpp
parentf09ef51889f75289b041f9e9f949b7b82ed5b686 (diff)
downloadframeworks_base-726aeba80ffc6778a9bc3e0ee957b8d644183505.zip
frameworks_base-726aeba80ffc6778a9bc3e0ee957b8d644183505.tar.gz
frameworks_base-726aeba80ffc6778a9bc3e0ee957b8d644183505.tar.bz2
Add support to OpenGLRendere to draw BiDi text.
Bug #4350336 Change-Id: I1cf31693f7ca9653fa3a41b5b91c27ef288d680f
Diffstat (limited to 'libs/hwui/OpenGLRenderer.cpp')
-rw-r--r--libs/hwui/OpenGLRenderer.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index 6243b01..45f4a42 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -2073,11 +2073,6 @@ void OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
drawTextDecorations(text, bytesCount, length, oldX, oldY, paint);
}
-void OpenGLRenderer::drawGlyphs(const char* glyphs, int index, int count, float x, float y,
- SkPaint* paint) {
- // TODO
-}
-
void OpenGLRenderer::drawPath(SkPath* path, SkPaint* paint) {
if (mSnapshot->isIgnored()) return;
@@ -2230,14 +2225,19 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float
// Handle underline and strike-through
uint32_t flags = paint->getFlags();
if (flags & (SkPaint::kUnderlineText_Flag | SkPaint::kStrikeThruText_Flag)) {
+ SkPaint paintCopy(*paint);
+#if RENDER_TEXT_AS_GLYPHS
+ paintCopy.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
+#endif
+
float underlineWidth = length;
// If length is > 0.0f, we already measured the text for the text alignment
if (length <= 0.0f) {
- underlineWidth = paint->measureText(text, bytesCount);
+ underlineWidth = paintCopy.measureText(text, bytesCount);
}
float offsetX = 0;
- switch (paint->getTextAlign()) {
+ switch (paintCopy.getTextAlign()) {
case SkPaint::kCenter_Align:
offsetX = underlineWidth * 0.5f;
break;
@@ -2249,8 +2249,7 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float
}
if (underlineWidth > 0.0f) {
- const float textSize = paint->getTextSize();
- // TODO: Support stroke width < 1.0f when we have AA lines
+ const float textSize = paintCopy.getTextSize();
const float strokeWidth = fmax(textSize * kStdUnderline_Thickness, 1.0f);
const float left = x - offsetX;
@@ -2280,10 +2279,9 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float
points[currentPoint++] = top;
}
- SkPaint linesPaint(*paint);
- linesPaint.setStrokeWidth(strokeWidth);
+ paintCopy.setStrokeWidth(strokeWidth);
- drawLines(&points[0], pointsCount, &linesPaint);
+ drawLines(&points[0], pointsCount, &paintCopy);
}
}
}