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

Unified Diff: src/gpu/GrStencilAndCoverTextContext.cpp

Issue 609223003: Revert of Fix SkTextBlob offset semantics. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrStencilAndCoverTextContext.cpp
diff --git a/src/gpu/GrStencilAndCoverTextContext.cpp b/src/gpu/GrStencilAndCoverTextContext.cpp
index cfcabe923f2b96c6b23149f6783b653c77360fb7..c1d9e9d32d8b8a9eff2ee1ded132f7a74eafa81d 100644
--- a/src/gpu/GrStencilAndCoverTextContext.cpp
+++ b/src/gpu/GrStencilAndCoverTextContext.cpp
@@ -54,7 +54,7 @@
// will turn off the use of device-space glyphs when perspective transforms
// are in use.
- this->init(paint, skPaint, byteLength, kMaxAccuracy_RenderMode, SkPoint::Make(0, 0));
+ this->init(paint, skPaint, byteLength, kMaxAccuracy_RenderMode);
// Transform our starting point.
if (fNeedsDeviceSpaceGlyphs) {
@@ -123,8 +123,8 @@
const char text[],
size_t byteLength,
const SkScalar pos[],
- int scalarsPerPosition,
- const SkPoint& offset) {
+ SkScalar constY,
+ int scalarsPerPosition) {
SkASSERT(byteLength == 0 || text != NULL);
SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition);
@@ -141,7 +141,8 @@
// transform is not part of SkPaint::measureText API, and thus we use the
// same glyphs as what were measured.
- this->init(paint, skPaint, byteLength, kMaxPerformance_RenderMode, offset);
+ const float textTranslateY = (1 == scalarsPerPosition ? constY : 0);
+ this->init(paint, skPaint, byteLength, kMaxPerformance_RenderMode, textTranslateY);
SkDrawCacheProc glyphCacheProc = fSkPaint.getDrawCacheProc();
@@ -170,7 +171,7 @@
}
} else {
fTransformType = GrPathRendering::kTranslate_PathTransformType;
- SkTextMapStateProc tmsProc(SkMatrix::I(), SkPoint::Make(0, 0), scalarsPerPosition);
+ SkTextMapStateProc tmsProc(SkMatrix::I(), 0, scalarsPerPosition);
SkTextAlignProcScalar alignProc(fSkPaint.getTextAlign());
while (text < stop) {
const SkGlyph& glyph = glyphCacheProc(fGlyphCache, &text, 0, 0);
@@ -241,7 +242,7 @@
const SkPaint& skPaint,
size_t textByteLength,
RenderMode renderMode,
- const SkPoint& textTranslate) {
+ SkScalar textTranslateY) {
GrTextContext::init(paint, skPaint);
fContextInitialMatrix = fContext->getMatrix();
@@ -257,7 +258,7 @@
if (fNeedsDeviceSpaceGlyphs) {
// SkDraw::ShouldDrawTextAsPaths takes care of perspective transforms.
SkASSERT(!fContextInitialMatrix.hasPerspective());
- SkASSERT(textTranslate.isZero()); // TODO: Handle textTranslate in device-space usecase.
+ SkASSERT(0 == textTranslateY); // TODO: Handle textTranslateY in device-space usecase.
fTextRatio = fTextInverseRatio = 1.0f;
@@ -339,7 +340,7 @@
}
SkMatrix textMatrix;
- textMatrix.setTranslate(textTranslate.x(), textTranslate.y());
+ textMatrix.setTranslate(0, textTranslateY);
// Glyphs loaded by GPU path rendering have an inverted y-direction.
textMatrix.preScale(fTextRatio, -fTextRatio);
fPaint.localCoordChange(textMatrix);
« no previous file with comments | « src/gpu/GrStencilAndCoverTextContext.h ('k') | src/gpu/GrTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698