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

Unified Diff: src/gpu/effects/GrBitmapTextGeoProc.cpp

Issue 854013002: Refactor position computation to enable device space "nudge" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 5 years, 11 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
Index: src/gpu/effects/GrBitmapTextGeoProc.cpp
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 146fb0672f799af8fafd19c35de052555a11fc93..924f7cd9525dd80bd3de3dc5a0d150845c5d93fd 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -25,7 +25,7 @@ public:
GrGLBitmapTextGeoProc(const GrGeometryProcessor&, const GrBatchTracker&)
: fColor(GrColor_ILLEGAL) {}
- void onEmitCode(EmitArgs& args) SK_OVERRIDE {
+ void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) SK_OVERRIDE{
const GrBitmapTextGeoProc& cte = args.fGP.cast<GrBitmapTextGeoProc>();
const BitmapTextBatchTracker& local = args.fBT.cast<BitmapTextBatchTracker>();
@@ -47,11 +47,11 @@ public:
this->addUniformViewMatrix(pb);
// Setup position
- vsBuilder->codeAppendf("%s = %s * vec3(%s, 1);", this->position(), this->uViewM(),
- cte.inPosition()->fName);
+ SetupPosition(vsBuilder, gpArgs, cte.inPosition()->fName,
+ cte.viewMatrix(), this->uViewM());
// emit transforms
- this->emitTransforms(args.fPB, this->position(), cte.inPosition()->fName,
+ this->emitTransforms(args.fPB, gpArgs->fPositionVar, cte.inPosition()->fName,
cte.localMatrix(), args.fTransformsIn, args.fTransformsOut);
GrGLGPFragmentBuilder* fsBuilder = pb->getFragmentShaderBuilder();
@@ -86,6 +86,7 @@ public:
uint32_t key = 0;
key |= SkToBool(gp.inColor()) ? 0x1 : 0x0;
key |= local.fUsesLocalCoords && proc.localMatrix().hasPerspective() ? 0x2 : 0x0;
+ key |= ComputePosKey(gp.viewMatrix()) << 2;
b->add32(local.fInputColorType << 16 | key);
}

Powered by Google App Engine
This is Rietveld 408576698