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

Unified Diff: src/gpu/GrDistanceFieldTextContext.cpp

Issue 761563002: First step to moving vertex attributes to the geometryProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: adding test to ignore Created 6 years 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/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.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 a012bc28b7f9e2929b8349ee4ed5e43d6ae74e05..99aed573b609e78462349eb86f24764eba38cb95 100755
--- a/src/gpu/GrDistanceFieldTextContext.cpp
+++ b/src/gpu/GrDistanceFieldTextContext.cpp
@@ -38,27 +38,11 @@ static const int kMediumDFFontSize = 78;
static const int kMediumDFFontLimit = 78;
static const int kLargeDFFontSize = 192;
-namespace {
-// position + texture coord
-extern const GrVertexAttrib gTextVertexAttribs[] = {
- {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec2f_GrVertexAttribType, sizeof(SkPoint) , kGeometryProcessor_GrVertexAttribBinding}
-};
-
static const size_t kTextVASize = 2 * sizeof(SkPoint);
-
-// position + color + texture coord
-extern const GrVertexAttrib gTextVertexWithColorAttribs[] = {
- {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
- {kVec2f_GrVertexAttribType, sizeof(SkPoint) + sizeof(GrColor), kGeometryProcessor_GrVertexAttribBinding}
-};
-
static const size_t kTextVAColorSize = 2 * sizeof(SkPoint) + sizeof(GrColor);
static const int kVerticesPerGlyph = 4;
static const int kIndicesPerGlyph = 6;
-};
GrDistanceFieldTextContext::GrDistanceFieldTextContext(GrContext* context,
const SkDeviceProperties& properties,
@@ -432,6 +416,7 @@ void GrDistanceFieldTextContext::setupCoverageEffect(const SkColor& filteredColo
colorNoPreMul,
flags));
} else {
+ flags |= kColorAttr_DistanceFieldEffectFlag;
#ifdef SK_GAMMA_APPLY_TO_A8
U8CPU lum = SkColorSpaceLuminance::computeLuminance(fDeviceProperties.gamma(),
filteredColor);
@@ -618,18 +603,6 @@ HAS_ATLAS:
return true;
}
-// We use color vertices if we aren't drawing LCD text
-static void set_vertex_attributes(GrDrawState* drawState, bool useColorVerts) {
- // set up attributes
- if (useColorVerts) {
- drawState->setVertexAttribs<gTextVertexWithColorAttribs>(
- SK_ARRAY_COUNT(gTextVertexWithColorAttribs), kTextVAColorSize);
- } else {
- drawState->setVertexAttribs<gTextVertexAttribs>(
- SK_ARRAY_COUNT(gTextVertexAttribs), kTextVASize);
- }
-}
-
void GrDistanceFieldTextContext::flush() {
if (NULL == fDrawTarget) {
return;
@@ -638,8 +611,6 @@ void GrDistanceFieldTextContext::flush() {
if (fCurrVertex > 0) {
GrDrawState drawState;
drawState.setFromPaint(fPaint, fContext->getMatrix(), fContext->getRenderTarget());
- bool useColorVerts = !fUseLCDText;
- set_vertex_attributes(&drawState, useColorVerts);
// setup our sampler state for our text texture/atlas
SkASSERT(SkIsAlign4(fCurrVertex));
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698