aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2016-11-16 10:15:23 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-16 15:48:48 +0000
commit08576e618883c3f8eb2cdf425e2f2bd7842f3f2e (patch)
tree66c97bfea8e5e7575885ae6c78da02c1ea6f133f /src
parentd47067392848ba132d4e86ffbeebe2dcacda9534 (diff)
Fix error with transforming custom/large glyphs
BUG=661244 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4738 Change-Id: I9f14ca830f9de92000e751a4a99ff1eb9b01db33 Reviewed-on: https://skia-review.googlesource.com/4866 Reviewed-by: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com> Commit-Queue: Jim Van Verth <jvanverth@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/gpu/text/GrAtlasTextBlob.cpp12
-rw-r--r--src/gpu/text/GrAtlasTextBlob.h10
-rw-r--r--src/gpu/text/GrTextUtils.cpp4
3 files changed, 13 insertions, 13 deletions
diff --git a/src/gpu/text/GrAtlasTextBlob.cpp b/src/gpu/text/GrAtlasTextBlob.cpp
index 9c6fdf3581..a160cb593e 100644
--- a/src/gpu/text/GrAtlasTextBlob.cpp
+++ b/src/gpu/text/GrAtlasTextBlob.cpp
@@ -74,11 +74,11 @@ void GrAtlasTextBlob::appendGlyph(int runIndex,
GrBatchTextStrike* strike,
GrGlyph* glyph,
SkGlyphCache* cache, const SkGlyph& skGlyph,
- SkScalar x, SkScalar y, SkScalar scale, bool applyVM) {
+ SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP) {
// If the glyph is too large we fall back to paths
if (glyph->fTooLargeForAtlas) {
- this->appendLargeGlyph(glyph, cache, skGlyph, x, y, scale, applyVM);
+ this->appendLargeGlyph(glyph, cache, skGlyph, x, y, scale, treatAsBMP);
return;
}
@@ -157,7 +157,7 @@ void GrAtlasTextBlob::appendGlyph(int runIndex,
}
void GrAtlasTextBlob::appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph,
- SkScalar x, SkScalar y, SkScalar scale, bool applyVM) {
+ SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP) {
if (nullptr == glyph->fPath) {
const SkPath* glyphPath = cache->findPath(skGlyph);
if (!glyphPath) {
@@ -166,7 +166,7 @@ void GrAtlasTextBlob::appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, cons
glyph->fPath = new SkPath(*glyphPath);
}
- fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, applyVM));
+ fBigGlyphs.push_back(GrAtlasTextBlob::BigGlyph(*glyph->fPath, x, y, scale, treatAsBMP));
}
bool GrAtlasTextBlob::mustRegenerate(const SkPaint& paint,
@@ -359,12 +359,12 @@ void GrAtlasTextBlob::flushBigGlyphs(GrContext* context, GrRenderTargetContext*
SkScalar transX, transY;
for (int i = 0; i < fBigGlyphs.count(); i++) {
GrAtlasTextBlob::BigGlyph& bigGlyph = fBigGlyphs[i];
- calculate_translation(bigGlyph.fApplyVM, viewMatrix, x, y,
+ calculate_translation(bigGlyph.fTreatAsBMP, viewMatrix, x, y,
fInitialViewMatrix, fInitialX, fInitialY, &transX, &transY);
SkMatrix ctm;
ctm.setScale(bigGlyph.fScale, bigGlyph.fScale);
ctm.postTranslate(bigGlyph.fX + transX, bigGlyph.fY + transY);
- if (bigGlyph.fApplyVM) {
+ if (!bigGlyph.fTreatAsBMP) {
ctm.postConcat(viewMatrix);
}
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index f24147f8fd..1bbe38ece8 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -164,7 +164,7 @@ public:
GrBatchTextStrike* strike,
GrGlyph* glyph,
SkGlyphCache*, const SkGlyph& skGlyph,
- SkScalar x, SkScalar y, SkScalar scale, bool applyVM);
+ SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP);
static size_t GetVertexStride(GrMaskFormat maskFormat) {
switch (maskFormat) {
@@ -292,7 +292,7 @@ private:
, fTextType(0) {}
void appendLargeGlyph(GrGlyph* glyph, SkGlyphCache* cache, const SkGlyph& skGlyph,
- SkScalar x, SkScalar y, SkScalar scale, bool applyVM);
+ SkScalar x, SkScalar y, SkScalar scale, bool treatAsBMP);
inline void flushRun(GrRenderTargetContext* rtc, const GrPaint&, const GrClip&,
int run, const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
@@ -515,17 +515,17 @@ private:
GrBatchFontCache* cache);
struct BigGlyph {
- BigGlyph(const SkPath& path, SkScalar vx, SkScalar vy, SkScalar scale, bool applyVM)
+ BigGlyph(const SkPath& path, SkScalar vx, SkScalar vy, SkScalar scale, bool treatAsBMP)
: fPath(path)
, fScale(scale)
, fX(vx)
, fY(vy)
- , fApplyVM(applyVM) {}
+ , fTreatAsBMP(treatAsBMP) {}
SkPath fPath;
SkScalar fScale;
SkScalar fX;
SkScalar fY;
- bool fApplyVM;
+ bool fTreatAsBMP;
};
struct StrokeInfo {
diff --git a/src/gpu/text/GrTextUtils.cpp b/src/gpu/text/GrTextUtils.cpp
index 14c4e8d3ac..7f7dc68350 100644
--- a/src/gpu/text/GrTextUtils.cpp
+++ b/src/gpu/text/GrTextUtils.cpp
@@ -145,7 +145,7 @@ void GrTextUtils::BmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
r.fBottom = r.fTop + SkIntToScalar(height);
blob->appendGlyph(runIndex, r, color, *strike, glyph, cache, skGlyph,
- SkIntToScalar(vx), SkIntToScalar(vy), 1.0f, false);
+ SkIntToScalar(vx), SkIntToScalar(vy), 1.0f, true);
}
bool GrTextUtils::CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix,
@@ -464,7 +464,7 @@ bool GrTextUtils::DfAppendGlyph(GrAtlasTextBlob* blob, int runIndex, GrBatchFont
SkRect glyphRect = SkRect::MakeXYWH(sx, sy, width, height);
blob->appendGlyph(runIndex, glyphRect, color, *strike, glyph, glyphCache, skGlyph,
- sx - dx, sy - dy, scale, true);
+ sx - dx, sy - dy, scale, false);
return true;
}