aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/core/SkDraw.h4
-rw-r--r--samplecode/SampleTextOnPath.cpp4
-rw-r--r--src/core/SkDraw.cpp4
-rw-r--r--src/core/SkPaint.cpp17
4 files changed, 15 insertions, 14 deletions
diff --git a/include/core/SkDraw.h b/include/core/SkDraw.h
index 8c659c2389..0ec37b3092 100644
--- a/include/core/SkDraw.h
+++ b/include/core/SkDraw.h
@@ -128,8 +128,8 @@ class SkGlyphCache;
class SkTextToPathIter {
public:
- SkTextToPathIter(const char text[], size_t length, const SkPaint&,
- bool applyStrokeAndPathEffects, bool forceLinearTextOn);
+ SkTextToPathIter(const char text[], size_t length, const SkPaint& paint,
+ bool applyStrokeAndPathEffects);
~SkTextToPathIter();
const SkPaint& getPaint() const { return fPaint; }
diff --git a/samplecode/SampleTextOnPath.cpp b/samplecode/SampleTextOnPath.cpp
index 2899e7c8e9..91100a64ee 100644
--- a/samplecode/SampleTextOnPath.cpp
+++ b/samplecode/SampleTextOnPath.cpp
@@ -28,8 +28,8 @@ static void textStrokePath(SkCanvas* canvas) {
paint.setAntiAlias(true);
paint.setStyle(SkPaint::kStroke_Style);
paint.setColor(0xFFFF0000);
- paint.setTextSize(SkFloatToScalar(0.065f));
- paint.setStrokeWidth(SkFloatToScalar(.01f));
+ paint.setTextSize(SkFloatToScalar(0.085f));
+ paint.setStrokeWidth(SkFloatToScalar(.005f));
canvas->drawPath(path, paint);
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp
index 23a6d59944..7c3b060e03 100644
--- a/src/core/SkDraw.cpp
+++ b/src/core/SkDraw.cpp
@@ -1308,7 +1308,7 @@ void SkDraw::drawText_asPaths(const char text[], size_t byteLength,
const SkPaint& paint) const {
SkDEBUGCODE(this->validate();)
- SkTextToPathIter iter(text, byteLength, paint, true, true);
+ SkTextToPathIter iter(text, byteLength, paint, true);
SkMatrix matrix;
matrix.setScale(iter.getPathScale(), iter.getPathScale());
@@ -1955,7 +1955,7 @@ void SkDraw::drawTextOnPath(const char text[], size_t byteLength,
return;
}
- SkTextToPathIter iter(text, byteLength, paint, true, true);
+ SkTextToPathIter iter(text, byteLength, paint, true);
SkPathMeasure meas(follow, false);
SkScalar hOffset = 0;
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index 68d7561ab5..6a16e24ba2 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1337,7 +1337,7 @@ void SkPaint::getTextPath(const void* textData, size_t length,
return;
}
- SkTextToPathIter iter(text, length, *this, false, true);
+ SkTextToPathIter iter(text, length, *this, false);
SkMatrix matrix;
SkScalar prevXPos = 0;
@@ -2087,24 +2087,25 @@ static bool has_thick_frame(const SkPaint& paint) {
SkTextToPathIter::SkTextToPathIter( const char text[], size_t length,
const SkPaint& paint,
- bool applyStrokeAndPathEffects,
- bool forceLinearTextOn) : fPaint(paint) {
+ bool applyStrokeAndPathEffects)
+ : fPaint(paint) {
fGlyphCacheProc = paint.getMeasureCacheProc(SkPaint::kForward_TextBufferDirection,
true);
- if (forceLinearTextOn) {
- fPaint.setLinearText(true);
- }
+ fPaint.setLinearText(true);
fPaint.setMaskFilter(NULL); // don't want this affecting our path-cache lookup
if (fPaint.getPathEffect() == NULL && !has_thick_frame(fPaint)) {
applyStrokeAndPathEffects = false;
}
- // can't use our canonical size if we need to apply patheffects/strokes
- if (fPaint.isLinearText() && !applyStrokeAndPathEffects) {
+ // can't use our canonical size if we need to apply patheffects
+ if (fPaint.getPathEffect() == NULL) {
fPaint.setTextSize(SkIntToScalar(SkPaint::kCanonicalTextSizeForPaths));
fScale = paint.getTextSize() / SkPaint::kCanonicalTextSizeForPaths;
+ if (has_thick_frame(fPaint)) {
+ fPaint.setStrokeWidth(SkScalarDiv(fPaint.getStrokeWidth(), fScale));
+ }
} else {
fScale = SK_Scalar1;
}