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

Unified Diff: src/gpu/GrDistanceFieldTextContext.cpp

Issue 149853002: Improved distance field sampling (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove unnecessary offset attribute. Created 6 years, 10 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/GrAtlas.cpp ('k') | src/gpu/GrTextStrike.h » ('j') | 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 bd3927c648839232f655aaead473cee7a7892b21..27323c4e60ae8250e496faa74d61014cd6269618 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -8,6 +8,7 @@
#include "GrDistanceFieldTextContext.h"
#include "GrAtlas.h"
#include "GrDrawTarget.h"
+#include "GrDrawTargetCaps.h"
#include "GrFontScaler.h"
#include "SkGlyphCache.h"
#include "GrIndexBuffer.h"
@@ -46,6 +47,7 @@ GrDistanceFieldTextContext::~GrDistanceFieldTextContext() {
bool GrDistanceFieldTextContext::canDraw(const SkPaint& paint) {
return !paint.getRasterizer() && !paint.getMaskFilter() &&
paint.getStyle() == SkPaint::kFill_Style &&
+ fContext->getTextTarget()->caps()->shaderDerivativeSupport() &&
!SkDraw::ShouldDrawTextAsPaths(paint, fContext->getMatrix());
}
@@ -72,8 +74,9 @@ void GrDistanceFieldTextContext::flushGlyphs() {
GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBilerp_FilterMode);
// This effect could be stored with one of the cache objects (atlas?)
+ SkISize size = fStrike->getAtlasSize();
drawState->addCoverageEffect(
- GrDistanceFieldTextureEffect::Create(fCurrTexture, params),
+ GrDistanceFieldTextureEffect::Create(fCurrTexture, params, size),
kGlyphCoordsAttributeIndex)->unref();
if (!GrPixelConfigIsAlphaOnly(fCurrTexture->config())) {
@@ -263,22 +266,23 @@ HAS_ATLAS:
sy += dy;
width *= scale;
height *= scale;
-
+
GrFixed tx = SkIntToFixed(glyph->fAtlasLocation.fX);
GrFixed ty = SkIntToFixed(glyph->fAtlasLocation.fY);
GrFixed tw = SkIntToFixed(glyph->fBounds.width());
GrFixed th = SkIntToFixed(glyph->fBounds.height());
+ static const size_t kVertexSize = 2 * sizeof(SkPoint);
fVertices[2*fCurrVertex].setRectFan(sx,
sy,
sx + width,
sy + height,
- 2 * sizeof(SkPoint));
+ kVertexSize);
fVertices[2*fCurrVertex+1].setRectFan(SkFixedToFloat(texture->normalizeFixedX(tx)),
SkFixedToFloat(texture->normalizeFixedY(ty)),
SkFixedToFloat(texture->normalizeFixedX(tx + tw)),
SkFixedToFloat(texture->normalizeFixedY(ty + th)),
- 2 * sizeof(SkPoint));
+ kVertexSize);
fCurrVertex += 4;
}
« no previous file with comments | « src/gpu/GrAtlas.cpp ('k') | src/gpu/GrTextStrike.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698