diff options
author | Chris Craik <ccraik@google.com> | 2015-02-17 16:42:02 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-02-17 17:46:39 -0800 |
commit | 2bb8f5606d4a28549d95005304305b3aff1ce090 (patch) | |
tree | 787f9a8f1956e597f8234fd47453bdfd095752b0 /libs/hwui/GlopBuilder.cpp | |
parent | 922d3a7f6f8c1c05a996ee3e91e8cbadfff560c9 (diff) | |
download | frameworks_base-2bb8f5606d4a28549d95005304305b3aff1ce090.zip frameworks_base-2bb8f5606d4a28549d95005304305b3aff1ce090.tar.gz frameworks_base-2bb8f5606d4a28549d95005304305b3aff1ce090.tar.bz2 |
Glop text shadows, clearLayerRegions, and rectangleList
Change-Id: I83b36d1ee5d8f05f41acf244639019f9b8da79cd
Diffstat (limited to 'libs/hwui/GlopBuilder.cpp')
-rw-r--r-- | libs/hwui/GlopBuilder.cpp | 64 |
1 files changed, 54 insertions, 10 deletions
diff --git a/libs/hwui/GlopBuilder.cpp b/libs/hwui/GlopBuilder.cpp index bdc5c5c..f133d42 100644 --- a/libs/hwui/GlopBuilder.cpp +++ b/libs/hwui/GlopBuilder.cpp @@ -271,10 +271,7 @@ GlopBuilder& GlopBuilder::setFillTexturePaint(Texture& texture, bool isAlphaMask } if (isAlphaMaskTexture) { - mDescription.modulate = mOutGlop->fill.color.a < 1.0f - || mOutGlop->fill.color.r > 0.0f - || mOutGlop->fill.color.g > 0.0f - || mOutGlop->fill.color.b > 0.0f; + mDescription.modulate = mOutGlop->fill.color.isNotBlack(); } else { mDescription.modulate = mOutGlop->fill.color.a < 1.0f; } @@ -295,27 +292,74 @@ GlopBuilder& GlopBuilder::setFillPaint(const SkPaint& paint, float alphaScale) { return *this; } -GlopBuilder& GlopBuilder::setFillPathTexturePaint(Texture& texture, +GlopBuilder& GlopBuilder::setFillPathTexturePaint(PathTexture& texture, const SkPaint& paint, float alphaScale) { TRIGGER_STAGE(kFillStage); REQUIRE_STAGES(kMeshStage); mOutGlop->fill.texture = &texture; - //specify invalid, since these are always static for path textures + //specify invalid, since these are always static for PathTextures mOutGlop->fill.textureFilter = GL_INVALID_ENUM; mOutGlop->fill.textureClamp = GL_INVALID_ENUM; setFill(paint.getColor(), alphaScale, PaintUtils::getXfermode(paint.getXfermode()), paint.getShader(), paint.getColorFilter()); - mDescription.modulate = mOutGlop->fill.color.a < 1.0f - || mOutGlop->fill.color.r > 0.0f - || mOutGlop->fill.color.g > 0.0f - || mOutGlop->fill.color.b > 0.0f; + mDescription.modulate = mOutGlop->fill.color.isNotBlack(); return *this; } +GlopBuilder& GlopBuilder::setFillShadowTexturePaint(ShadowTexture& texture, int shadowColor, + const SkPaint& paint, float alphaScale) { + TRIGGER_STAGE(kFillStage); + REQUIRE_STAGES(kMeshStage); + + mOutGlop->fill.texture = &texture; + + //specify invalid, since these are always static for ShadowTextures + mOutGlop->fill.textureFilter = GL_INVALID_ENUM; + mOutGlop->fill.textureClamp = GL_INVALID_ENUM; + + const int ALPHA_BITMASK = SK_ColorBLACK; + const int COLOR_BITMASK = ~ALPHA_BITMASK; + if ((shadowColor & ALPHA_BITMASK) == ALPHA_BITMASK) { + // shadow color is fully opaque: override its alpha with that of paint + shadowColor &= paint.getColor() | COLOR_BITMASK; + } + + setFill(shadowColor, alphaScale, PaintUtils::getXfermode(paint.getXfermode()), + paint.getShader(), paint.getColorFilter()); + + mDescription.modulate = mOutGlop->fill.color.isNotBlack(); + return *this; +} + +GlopBuilder& GlopBuilder::setFillBlack() { + TRIGGER_STAGE(kFillStage); + REQUIRE_STAGES(kMeshStage); + + mOutGlop->fill.texture = nullptr; + mOutGlop->fill.textureFilter = GL_INVALID_ENUM; + mOutGlop->fill.textureClamp = GL_INVALID_ENUM; + + setFill(SK_ColorBLACK, 1.0f, SkXfermode::kSrcOver_Mode, nullptr, nullptr); + + return *this; +} + +GlopBuilder& GlopBuilder::setFillClear() { + TRIGGER_STAGE(kFillStage); + REQUIRE_STAGES(kMeshStage); + + mOutGlop->fill.texture = nullptr; + mOutGlop->fill.textureFilter = GL_INVALID_ENUM; + mOutGlop->fill.textureClamp = GL_INVALID_ENUM; + + setFill(SK_ColorBLACK, 1.0f, SkXfermode::kClear_Mode, nullptr, nullptr); + + return *this; +} //////////////////////////////////////////////////////////////////////////////// // Transform //////////////////////////////////////////////////////////////////////////////// |