summaryrefslogtreecommitdiff
path: root/libs/hwui/ProgramCache.cpp
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-04-26 15:33:10 -0700
committerRomain Guy <romainguy@google.com>2011-04-26 15:33:10 -0700
commit740bf2bb2e900d3db2292b5909b4b4c6e90320e6 (patch)
tree9c6759f83ab467d849ef8072e262fe7ac55b8c71 /libs/hwui/ProgramCache.cpp
parent3a03eeedafb3e3335b56bdb9c0a2f02104d32299 (diff)
Apply shaders/filters to text drop shadows.
Bug #4318323 This change also fixes the fact that shaders were not modulated by the paint's color when drawing paths. Change-Id: Id88804143aea06c895d4cbcdbe106d660230aa5a
Diffstat (limited to 'libs/hwui/ProgramCache.cpp')
-rw-r--r--libs/hwui/ProgramCache.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/hwui/ProgramCache.cpp b/libs/hwui/ProgramCache.cpp
index b873bb820919..80b1917809ca 100644
--- a/libs/hwui/ProgramCache.cpp
+++ b/libs/hwui/ProgramCache.cpp
@@ -179,6 +179,8 @@ const char* gFS_Fast_SingleModulateGradient =
// General case
const char* gFS_Main_FetchColor =
" fragColor = color;\n";
+const char* gFS_Main_ModulateColor =
+ " fragColor *= color.a;\n";
const char* gFS_Main_AccountForWidth =
" if (distance < boundaryWidth) {\n"
" fragColor *= (distance * inverseBoundaryWidth);\n"
@@ -581,6 +583,7 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
shader.append(gFS_Main_FetchBitmapNpot);
}
}
+ bool applyModulate = false;
// Case when we have two shaders set
if (description.hasGradient && description.hasBitmap) {
int op = description.hasAlpha8Texture ? MODULATE_OP_MODULATE_A8 : modulateOp;
@@ -590,15 +593,21 @@ String8 ProgramCache::generateFragmentShader(const ProgramDescription& descripti
shader.append(gFS_Main_BlendShadersGB);
}
shader.append(gFS_Main_BlendShaders_Modulate[op]);
+ applyModulate = true;
} else {
if (description.hasGradient) {
int op = description.hasAlpha8Texture ? MODULATE_OP_MODULATE_A8 : modulateOp;
shader.append(gFS_Main_GradientShader_Modulate[op]);
+ applyModulate = true;
} else if (description.hasBitmap) {
int op = description.hasAlpha8Texture ? MODULATE_OP_MODULATE_A8 : modulateOp;
shader.append(gFS_Main_BitmapShader_Modulate[op]);
+ applyModulate = true;
}
}
+ if (description.modulate && applyModulate) {
+ shader.append(gFS_Main_ModulateColor);
+ }
// Apply the color op if needed
shader.append(gFS_Main_ApplyColorOp[description.colorOp]);
// Output the fragment