Index: src/gpu/GrStencilAndCoverTextContext.cpp |
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp |
index c1d9e9d32d8b8a9eff2ee1ded132f7a74eafa81d..cfcabe923f2b96c6b23149f6783b653c77360fb7 100644 |
--- a/src/gpu/GrStencilAndCoverTextContext.cpp |
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp |
@@ -54,7 +54,7 @@ void GrStencilAndCoverTextContext::drawText(const GrPaint& paint, |
// will turn off the use of device-space glyphs when perspective transforms |
// are in use. |
- this->init(paint, skPaint, byteLength, kMaxAccuracy_RenderMode); |
+ this->init(paint, skPaint, byteLength, kMaxAccuracy_RenderMode, SkPoint::Make(0, 0)); |
// Transform our starting point. |
if (fNeedsDeviceSpaceGlyphs) { |
@@ -123,8 +123,8 @@ void GrStencilAndCoverTextContext::drawPosText(const GrPaint& paint, |
const char text[], |
size_t byteLength, |
const SkScalar pos[], |
- SkScalar constY, |
- int scalarsPerPosition) { |
+ int scalarsPerPosition, |
+ const SkPoint& offset) { |
SkASSERT(byteLength == 0 || text != NULL); |
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); |
@@ -141,8 +141,7 @@ void GrStencilAndCoverTextContext::drawPosText(const GrPaint& paint, |
// transform is not part of SkPaint::measureText API, and thus we use the |
// same glyphs as what were measured. |
- const float textTranslateY = (1 == scalarsPerPosition ? constY : 0); |
- this->init(paint, skPaint, byteLength, kMaxPerformance_RenderMode, textTranslateY); |
+ this->init(paint, skPaint, byteLength, kMaxPerformance_RenderMode, offset); |
SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc(); |
@@ -171,7 +170,7 @@ void GrStencilAndCoverTextContext::drawPosText(const GrPaint& paint, |
} |
} else { |
fTransformType = GrPathRendering::kTranslate_PathTransformType; |
- SkTextMapStateProc tmsProc(SkMatrix::I(), 0, scalarsPerPosition); |
+ SkTextMapStateProc tmsProc(SkMatrix::I(), SkPoint::Make(0, 0), scalarsPerPosition); |
SkTextAlignProcScalar alignProc(fSkPaint.getTextAlign()); |
while (text < stop) { |
const SkGlyph& glyph = glyphCacheProc(fGlyphCache, &text, 0, 0); |
@@ -242,7 +241,7 @@ void GrStencilAndCoverTextContext::init(const GrPaint& paint, |
const SkPaint& skPaint, |
size_t textByteLength, |
RenderMode renderMode, |
- SkScalar textTranslateY) { |
+ const SkPoint& textTranslate) { |
GrTextContext::init(paint, skPaint); |
fContextInitialMatrix = fContext->getMatrix(); |
@@ -258,7 +257,7 @@ void GrStencilAndCoverTextContext::init(const GrPaint& paint, |
if (fNeedsDeviceSpaceGlyphs) { |
// SkDraw::ShouldDrawTextAsPaths takes care of perspective transforms. |
SkASSERT(!fContextInitialMatrix.hasPerspective()); |
- SkASSERT(0 == textTranslateY); // TODO: Handle textTranslateY in device-space usecase. |
+ SkASSERT(textTranslate.isZero()); // TODO: Handle textTranslate in device-space usecase. |
fTextRatio = fTextInverseRatio = 1.0f; |
@@ -340,7 +339,7 @@ void GrStencilAndCoverTextContext::init(const GrPaint& paint, |
} |
SkMatrix textMatrix; |
- textMatrix.setTranslate(0, textTranslateY); |
+ textMatrix.setTranslate(textTranslate.x(), textTranslate.y()); |
// Glyphs loaded by GPU path rendering have an inverted y-direction. |
textMatrix.preScale(fTextRatio, -fTextRatio); |
fPaint.localCoordChange(textMatrix); |