Loading libs/hwui/SkiaShader.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -411,8 +411,14 @@ void SkiaComposeShader::describe(ProgramDescription& description, const Extensio void SkiaComposeShader::setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot, GLuint* textureUnit) { mFirst->setupProgram(program, modelView, snapshot, textureUnit); mSecond->setupProgram(program, modelView, snapshot, textureUnit); // Apply this compose shader's local transform and pass it down to // the child shaders. They will in turn apply their local transform // to this matrix. mat4 transform; computeScreenSpaceMatrix(transform, modelView); mFirst->setupProgram(program, transform, snapshot, textureUnit); mSecond->setupProgram(program, transform, snapshot, textureUnit); } }; // namespace uirenderer Loading tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java +11 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ public class MoreShadersActivity extends Activity { private Paint mLargePaint; private BitmapShader mScaled2Shader; private ColorFilter mColorFilter; private final Matrix mMtx1; ShadersView(Context c) { super(c); Loading @@ -70,7 +71,7 @@ public class MoreShadersActivity extends Activity { mScaledShader = new BitmapShader(texture, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR); Matrix m2 = new Matrix(); m2.setScale(0.5f, 0.5f); m2.setScale(0.1f, 0.1f); mScaledShader.setLocalMatrix(m2); mScaled2Shader = new BitmapShader(texture, Shader.TileMode.MIRROR, Loading @@ -81,12 +82,20 @@ public class MoreShadersActivity extends Activity { mHorGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth, 0.0f, Color.RED, 0x7f00ff00, Shader.TileMode.CLAMP); Matrix m4 = new Matrix(); m4.setScale(0.5f, 0.5f); mHorGradient.setLocalMatrix(m4); mVertGradient = new LinearGradient(0.0f, 0.0f, 0.0f, mDrawHeight / 2.0f, Color.YELLOW, Color.MAGENTA, Shader.TileMode.MIRROR); mComposeShader = new ComposeShader(mScaledShader, mHorGradient, PorterDuff.Mode.SRC_OVER); mMtx1 = new Matrix(); mMtx1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); mMtx1.postRotate(45, 0, 0); mComposeShader.setLocalMatrix(mMtx1); mCompose2Shader = new ComposeShader(mHorGradient, mScaledShader, PorterDuff.Mode.SRC_OUT); Loading Loading
libs/hwui/SkiaShader.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -411,8 +411,14 @@ void SkiaComposeShader::describe(ProgramDescription& description, const Extensio void SkiaComposeShader::setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot, GLuint* textureUnit) { mFirst->setupProgram(program, modelView, snapshot, textureUnit); mSecond->setupProgram(program, modelView, snapshot, textureUnit); // Apply this compose shader's local transform and pass it down to // the child shaders. They will in turn apply their local transform // to this matrix. mat4 transform; computeScreenSpaceMatrix(transform, modelView); mFirst->setupProgram(program, transform, snapshot, textureUnit); mSecond->setupProgram(program, transform, snapshot, textureUnit); } }; // namespace uirenderer Loading
tests/HwAccelerationTest/src/com/android/test/hwui/MoreShadersActivity.java +11 −2 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ public class MoreShadersActivity extends Activity { private Paint mLargePaint; private BitmapShader mScaled2Shader; private ColorFilter mColorFilter; private final Matrix mMtx1; ShadersView(Context c) { super(c); Loading @@ -70,7 +71,7 @@ public class MoreShadersActivity extends Activity { mScaledShader = new BitmapShader(texture, Shader.TileMode.MIRROR, Shader.TileMode.MIRROR); Matrix m2 = new Matrix(); m2.setScale(0.5f, 0.5f); m2.setScale(0.1f, 0.1f); mScaledShader.setLocalMatrix(m2); mScaled2Shader = new BitmapShader(texture, Shader.TileMode.MIRROR, Loading @@ -81,12 +82,20 @@ public class MoreShadersActivity extends Activity { mHorGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth, 0.0f, Color.RED, 0x7f00ff00, Shader.TileMode.CLAMP); Matrix m4 = new Matrix(); m4.setScale(0.5f, 0.5f); mHorGradient.setLocalMatrix(m4); mVertGradient = new LinearGradient(0.0f, 0.0f, 0.0f, mDrawHeight / 2.0f, Color.YELLOW, Color.MAGENTA, Shader.TileMode.MIRROR); mComposeShader = new ComposeShader(mScaledShader, mHorGradient, PorterDuff.Mode.SRC_OVER); mMtx1 = new Matrix(); mMtx1.setTranslate(mTexWidth / 2.0f, mTexHeight / 2.0f); mMtx1.postRotate(45, 0, 0); mComposeShader.setLocalMatrix(mMtx1); mCompose2Shader = new ComposeShader(mHorGradient, mScaledShader, PorterDuff.Mode.SRC_OUT); Loading