aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects/GrBitmapTextGeoProc.cpp
diff options
context:
space:
mode:
authorGravatar Jim Van Verth <jvanverth@google.com>2018-05-23 16:44:55 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-05-24 13:44:23 +0000
commitb515ae7fa2119c19bb945d3960b4a11eda99ab02 (patch)
tree16e0e56a3d389cd76b5010b9b28f6024e78ba856 /src/gpu/effects/GrBitmapTextGeoProc.cpp
parent8f45138eef44f8b69cfb88650c6f069b4e5ba059 (diff)
Add GPU perspective support for color emoji
Will also warp orthogonal bitmaps to handle skew and rotate transforms. Bug: skia:7985 Change-Id: Ib0d5476dd68603354be90c8d404f1e5140d63a0c Reviewed-on: https://skia-review.googlesource.com/129480 Commit-Queue: Jim Van Verth <jvanverth@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/effects/GrBitmapTextGeoProc.cpp')
-rw-r--r--src/gpu/effects/GrBitmapTextGeoProc.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index 14126794d7..116e2232c2 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -53,7 +53,7 @@ public:
}
// Setup position
- this->writeOutputPosition(vertBuilder, gpArgs, btgp.inPosition()->fName);
+ gpArgs->fPositionVar = btgp.inPosition()->asShaderVar();
// emit transforms
this->emitTransforms(vertBuilder,
@@ -102,7 +102,7 @@ public:
GrProcessorKeyBuilder* b) {
const GrBitmapTextGeoProc& btgp = proc.cast<GrBitmapTextGeoProc>();
uint32_t key = 0;
- key |= (btgp.usesLocalCoords() && btgp.localMatrix().hasPerspective()) ? 0x1 : 0x0;
+ key |= btgp.usesW() ? 0x1 : 0x0;
key |= btgp.maskFormat() << 1;
b->add32(key);
b->add32(btgp.numTextureSamplers());
@@ -124,16 +124,20 @@ GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color,
const sk_sp<GrTextureProxy>* proxies,
int numActiveProxies,
const GrSamplerState& params, GrMaskFormat format,
- const SkMatrix& localMatrix, bool usesLocalCoords)
+ const SkMatrix& localMatrix, bool usesW)
: INHERITED(kGrBitmapTextGeoProc_ClassID)
, fColor(color)
, fLocalMatrix(localMatrix)
- , fUsesLocalCoords(usesLocalCoords)
+ , fUsesW(usesW)
, fInColor(nullptr)
, fMaskFormat(format) {
SkASSERT(numActiveProxies <= kMaxTextures);
- fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ if (usesW) {
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat3_GrVertexAttribType);
+ } else {
+ fInPosition = &this->addVertexAttrib("inPosition", kFloat2_GrVertexAttribType);
+ }
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat ||
kA565_GrMaskFormat == fMaskFormat;