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

Unified Diff: src/gpu/GrDistanceFieldTextContext.cpp

Issue 239333002: Fix artifacts in distance field rendering due to bilerp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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/core/SkDistanceFieldGen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDistanceFieldTextContext.cpp
diff --git a/src/gpu/GrDistanceFieldTextContext.cpp b/src/gpu/GrDistanceFieldTextContext.cpp
index 448e70980547c23220fd21cd6f2c44add0f89b44..238bcca46b4be737e884672d49edc8724cbce5cf 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -14,6 +14,7 @@
#include "GrIndexBuffer.h"
#include "GrTextStrike.h"
#include "GrTextStrike_impl.h"
+#include "SkDistanceFieldGen.h"
#include "SkDraw.h"
#include "SkGpuDevice.h"
#include "SkPath.h"
@@ -295,10 +296,10 @@ HAS_ATLAS:
SkASSERT(2*sizeof(SkPoint) == fDrawTarget->getDrawState().getVertexSize());
}
- SkScalar dx = SkIntToScalar(glyph->fBounds.fLeft);
- SkScalar dy = SkIntToScalar(glyph->fBounds.fTop);
- SkScalar width = SkIntToScalar(glyph->fBounds.width());
- SkScalar height = SkIntToScalar(glyph->fBounds.height());
+ SkScalar dx = SkIntToScalar(glyph->fBounds.fLeft + SK_DistanceFieldInset);
+ SkScalar dy = SkIntToScalar(glyph->fBounds.fTop + SK_DistanceFieldInset);
+ SkScalar width = SkIntToScalar(glyph->fBounds.width() - 2*SK_DistanceFieldInset);
+ SkScalar height = SkIntToScalar(glyph->fBounds.height() - 2*SK_DistanceFieldInset);
SkScalar scale = fTextRatio;
dx *= scale;
@@ -308,10 +309,10 @@ HAS_ATLAS:
width *= scale;
height *= scale;
- SkFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
- SkFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
- SkFixed tw = SkIntToFixed(glyph->fBounds.width());
- SkFixed th = SkIntToFixed(glyph->fBounds.height());
+ SkFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX + SK_DistanceFieldInset);
+ SkFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY + SK_DistanceFieldInset);
+ SkFixed tw = SkIntToFixed(glyph->fBounds.width() - 2*SK_DistanceFieldInset);
+ SkFixed th = SkIntToFixed(glyph->fBounds.height() - 2*SK_DistanceFieldInset);
static const size_t kVertexSize = 2 * sizeof(SkPoint);
fVertices[2*fCurrVertex].setRectFan(sx,
« no previous file with comments | « src/core/SkDistanceFieldGen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698