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

Unified Diff: src/gpu/GrBitmapTextContext.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/GrAARectRenderer.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrBitmapTextContext.cpp
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index 2ff410e5cf278ca6b89c58e382c44af8b22f1720..3b0bddb8e7c5c0bebf3873ee8d95be2287963d9f 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -35,24 +35,11 @@ SK_CONF_DECLARE(bool, c_DumpFontCache, "gpu.dumpFontCache", false,
"Dump the contents of the font cache before every purge.");
namespace {
-// position + texture coord
-extern const GrVertexAttrib gLCDVertexAttribs[] = {
- {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec2f_GrVertexAttribType, sizeof(SkPoint), kGeometryProcessor_GrVertexAttribBinding}
-};
-
static const size_t kLCDTextVASize = 2 * sizeof(SkPoint);
// position + local coord
static const size_t kColorTextVASize = 2 * sizeof(SkPoint);
-// position + color + texture coord
-extern const GrVertexAttrib gGrayVertexAttribs[] = {
- {kVec2f_GrVertexAttribType, 0, kPosition_GrVertexAttribBinding},
- {kVec4ub_GrVertexAttribType, sizeof(SkPoint), kColor_GrVertexAttribBinding},
- {kVec2f_GrVertexAttribType, sizeof(SkPoint) + sizeof(GrColor), kGeometryProcessor_GrVertexAttribBinding}
-};
-
static const size_t kGrayTextVASize = 2 * sizeof(SkPoint) + sizeof(GrColor);
static const int kVerticesPerGlyph = 4;
@@ -354,19 +341,6 @@ static size_t get_vertex_stride(GrMaskFormat maskFormat) {
}
}
-static void set_vertex_attributes(GrDrawState* drawState, GrMaskFormat maskFormat) {
- if (kA8_GrMaskFormat == maskFormat) {
- drawState->setVertexAttribs<gGrayVertexAttribs>(
- SK_ARRAY_COUNT(gGrayVertexAttribs), kGrayTextVASize);
- } else if (kARGB_GrMaskFormat == maskFormat) {
- GrDefaultGeoProcFactory::SetAttribs(drawState,
- GrDefaultGeoProcFactory::kLocalCoord_GPType);
- } else {
- drawState->setVertexAttribs<gLCDVertexAttribs>(
- SK_ARRAY_COUNT(gLCDVertexAttribs), kLCDTextVASize);
- }
-}
-
static void* alloc_vertices(GrDrawTarget* drawTarget,
int numVertices,
GrMaskFormat maskFormat) {
@@ -552,16 +526,15 @@ void GrBitmapTextContext::flush() {
GrDrawState drawState;
drawState.setFromPaint(fPaint, SkMatrix::I(), fContext->getRenderTarget());
- set_vertex_attributes(&drawState, fCurrMaskFormat);
-
// setup our sampler state for our text texture/atlas
SkASSERT(SkIsAlign4(fCurrVertex));
SkASSERT(fCurrTexture);
- GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode);
// This effect could be stored with one of the cache objects (atlas?)
+ GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode);
if (kARGB_GrMaskFormat == fCurrMaskFormat) {
- drawState.setGeometryProcessor(GrDefaultGeoProcFactory::Create(true))->unref();
+ uint32_t flags = GrDefaultGeoProcFactory::kLocalCoord_GPType;
+ drawState.setGeometryProcessor(GrDefaultGeoProcFactory::Create(flags))->unref();
GrFragmentProcessor* fragProcessor = GrSimpleTextureEffect::Create(fCurrTexture,
SkMatrix::I(),
params);
@@ -569,11 +542,12 @@ void GrBitmapTextContext::flush() {
} else {
uint32_t textureUniqueID = fCurrTexture->getUniqueID();
if (textureUniqueID != fEffectTextureUniqueID) {
+ bool hasColor = kA8_GrMaskFormat == fCurrMaskFormat;
fCachedGeometryProcessor.reset(GrCustomCoordsTextureEffect::Create(fCurrTexture,
- params));
+ params,
+ hasColor));
fEffectTextureUniqueID = textureUniqueID;
}
-
drawState.setGeometryProcessor(fCachedGeometryProcessor.get());
}
« no previous file with comments | « src/gpu/GrAARectRenderer.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698