@@ -2508,13 +2508,14 @@ status_t OpenGLRenderer::drawText(const char* text, int bytesCount, int count,
25082508#endif
25092509
25102510 bool status;
2511- if (positions != NULL ) {
2512- status = fontRenderer.renderPosText (paint, clip, text, 0 , bytesCount, count, x, y,
2511+ if (paint->getTextAlign () != SkPaint::kLeft_Align ) {
2512+ SkPaint paintCopy (*paint);
2513+ paintCopy.setTextAlign (SkPaint::kLeft_Align );
2514+ status = fontRenderer.renderPosText (&paintCopy, clip, text, 0 , bytesCount, count, x, y,
25132515 positions, hasActiveLayer ? &bounds : NULL );
25142516 } else {
2515- // TODO: would it be okay to call renderPosText with null positions?
2516- status = fontRenderer.renderText (paint, clip, text, 0 , bytesCount, count, x, y,
2517- hasActiveLayer ? &bounds : NULL );
2517+ status = fontRenderer.renderPosText (paint, clip, text, 0 , bytesCount, count, x, y,
2518+ positions, hasActiveLayer ? &bounds : NULL );
25182519 }
25192520 if (status) {
25202521#if RENDER_LAYERS_AS_REGIONS
@@ -2801,23 +2802,11 @@ void OpenGLRenderer::drawTextDecorations(const char* text, int bytesCount, float
28012802 underlineWidth = paintCopy.measureText (text, bytesCount);
28022803 }
28032804
2804- float offsetX = 0 ;
2805- switch (paintCopy.getTextAlign ()) {
2806- case SkPaint::kCenter_Align :
2807- offsetX = underlineWidth * 0 .5f ;
2808- break ;
2809- case SkPaint::kRight_Align :
2810- offsetX = underlineWidth;
2811- break ;
2812- default :
2813- break ;
2814- }
2815-
28162805 if (CC_LIKELY (underlineWidth > 0 .0f )) {
28172806 const float textSize = paintCopy.getTextSize ();
28182807 const float strokeWidth = fmax (textSize * kStdUnderline_Thickness , 1 .0f );
28192808
2820- const float left = x - offsetX ;
2809+ const float left = x;
28212810 float top = 0 .0f ;
28222811
28232812 int linesCount = 0 ;
0 commit comments