diff options
author | Alex Sakhartchouk <alexst@google.com> | 2010-12-21 14:42:26 -0800 |
---|---|---|
committer | Alex Sakhartchouk <alexst@google.com> | 2010-12-21 14:57:04 -0800 |
commit | b4d7bb6872f523b4318144202e119766ed9054ed (patch) | |
tree | 2e7e18e9864c7c9398bbce8f0bc227f147b648f4 /graphics/java/android/renderscript/ProgramStore.java | |
parent | 1528d8f47cc6f0e0d5c9f905f82d15a35ce1bafb (diff) | |
download | frameworks_base-b4d7bb6872f523b4318144202e119766ed9054ed.zip frameworks_base-b4d7bb6872f523b4318144202e119766ed9054ed.tar.gz frameworks_base-b4d7bb6872f523b4318144202e119766ed9054ed.tar.bz2 |
API cleanup for renderscript. This will be a multiproject commit.
Change-Id: Ida62d3a155285a20725be9daa62217faef1c3734
Diffstat (limited to 'graphics/java/android/renderscript/ProgramStore.java')
-rw-r--r-- | graphics/java/android/renderscript/ProgramStore.java | 143 |
1 files changed, 17 insertions, 126 deletions
diff --git a/graphics/java/android/renderscript/ProgramStore.java b/graphics/java/android/renderscript/ProgramStore.java index d191b06..2d2b162 100644 --- a/graphics/java/android/renderscript/ProgramStore.java +++ b/graphics/java/android/renderscript/ProgramStore.java @@ -26,14 +26,14 @@ import android.util.Log; * **/ public class ProgramStore extends BaseObj { - public enum DepthFunc { + public enum DepthFunc { ALWAYS (0), LESS (1), - LEQUAL (2), + LESS_OR_EQUAL (2), GREATER (3), - GEQUAL (4), + GREATER_OR_EQUAL (4), EQUAL (5), - NOTEQUAL (6); + NOT_EQUAL (6); int mID; DepthFunc(int id) { @@ -84,140 +84,49 @@ public class ProgramStore extends BaseObj { ProgramStore.Builder builder = new ProgramStore.Builder(rs); builder.setDepthFunc(ProgramStore.DepthFunc.LESS); builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO); - builder.setDitherEnable(false); - builder.setDepthMask(true); + builder.setDitherEnabled(false); + builder.setDepthMaskEnabled(true); rs.mProgramStore_BLEND_NONE_DEPTH_TEST = builder.create(); } return rs.mProgramStore_BLEND_NONE_DEPTH_TEST; } - public static ProgramStore BLEND_NONE_DEPTH_NO_DEPTH(RenderScript rs) { + public static ProgramStore BLEND_NONE_DEPTH_NONE(RenderScript rs) { if(rs.mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH == null) { ProgramStore.Builder builder = new ProgramStore.Builder(rs); builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO); - builder.setDitherEnable(false); - builder.setDepthMask(false); + builder.setDitherEnabled(false); + builder.setDepthMaskEnabled(false); rs.mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH = builder.create(); } return rs.mProgramStore_BLEND_NONE_DEPTH_NO_DEPTH; } - public static ProgramStore BLEND_NONE_DEPTH_NO_TEST(RenderScript rs) { - if(rs.mProgramStore_BLEND_NONE_DEPTH_NO_TEST == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); - builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO); - builder.setDitherEnable(false); - builder.setDepthMask(true); - rs.mProgramStore_BLEND_NONE_DEPTH_NO_TEST = builder.create(); - } - return rs.mProgramStore_BLEND_NONE_DEPTH_NO_TEST; - } - public static ProgramStore BLEND_NONE_DEPTH_NO_WRITE(RenderScript rs) { - if(rs.mProgramStore_BLEND_NONE_DEPTH_NO_WRITE == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.LESS); - builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ZERO); - builder.setDitherEnable(false); - builder.setDepthMask(false); - rs.mProgramStore_BLEND_NONE_DEPTH_NO_WRITE = builder.create(); - } - return rs.mProgramStore_BLEND_NONE_DEPTH_NO_WRITE; - } public static ProgramStore BLEND_ALPHA_DEPTH_TEST(RenderScript rs) { if(rs.mProgramStore_BLEND_ALPHA_DEPTH_TEST == null) { ProgramStore.Builder builder = new ProgramStore.Builder(rs); builder.setDepthFunc(ProgramStore.DepthFunc.LESS); builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA); - builder.setDitherEnable(false); - builder.setDepthMask(true); + builder.setDitherEnabled(false); + builder.setDepthMaskEnabled(true); rs.mProgramStore_BLEND_ALPHA_DEPTH_TEST = builder.create(); } return rs.mProgramStore_BLEND_ALPHA_DEPTH_TEST; } - public static ProgramStore BLEND_ALPHA_DEPTH_NO_DEPTH(RenderScript rs) { + public static ProgramStore BLEND_ALPHA_DEPTH_NONE(RenderScript rs) { if(rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH == null) { ProgramStore.Builder builder = new ProgramStore.Builder(rs); builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA); - builder.setDitherEnable(false); - builder.setDepthMask(false); + builder.setDitherEnabled(false); + builder.setDepthMaskEnabled(false); rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH = builder.create(); } return rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_DEPTH; } - public static ProgramStore BLEND_ALPHA_DEPTH_NO_TEST(RenderScript rs) { - if(rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_TEST == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); - builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA); - builder.setDitherEnable(false); - builder.setDepthMask(true); - rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_TEST = builder.create(); - } - return rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_TEST; - } - public static ProgramStore BLEND_ALPHA_DEPTH_NO_WRITE(RenderScript rs) { - if(rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_WRITE == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.LESS); - builder.setBlendFunc(BlendSrcFunc.SRC_ALPHA, BlendDstFunc.ONE_MINUS_SRC_ALPHA); - builder.setDitherEnable(false); - builder.setDepthMask(false); - rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_WRITE = builder.create(); - } - return rs.mProgramStore_BLEND_ALPHA_DEPTH_NO_WRITE; - } - - public static ProgramStore BLEND_ADD_DEPTH_TEST(RenderScript rs) { - if(rs.mProgramStore_BLEND_ADD_DEPTH_TEST == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.LESS); - builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE); - builder.setDitherEnable(false); - builder.setDepthMask(true); - rs.mProgramStore_BLEND_ADD_DEPTH_TEST = builder.create(); - } - return rs.mProgramStore_BLEND_ADD_DEPTH_TEST; - } - public static ProgramStore BLEND_ADD_DEPTH_NO_DEPTH(RenderScript rs) { - if(rs.mProgramStore_BLEND_ADD_DEPTH_NO_DEPTH == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); - builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE); - builder.setDitherEnable(false); - builder.setDepthMask(false); - rs.mProgramStore_BLEND_ADD_DEPTH_NO_DEPTH = builder.create(); - } - return rs.mProgramStore_BLEND_ADD_DEPTH_NO_DEPTH; - } - public static ProgramStore BLEND_ADD_DEPTH_NO_TEST(RenderScript rs) { - if(rs.mProgramStore_BLEND_ADD_DEPTH_NO_TEST == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); - builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE); - builder.setDitherEnable(false); - builder.setDepthMask(true); - rs.mProgramStore_BLEND_ADD_DEPTH_NO_DEPTH = builder.create(); - } - return rs.mProgramStore_BLEND_ADD_DEPTH_NO_TEST; - } - public static ProgramStore BLEND_ADD_DEPTH_NO_WRITE(RenderScript rs) { - if(rs.mProgramStore_BLEND_ADD_DEPTH_NO_WRITE == null) { - ProgramStore.Builder builder = new ProgramStore.Builder(rs); - builder.setDepthFunc(ProgramStore.DepthFunc.ALWAYS); - builder.setBlendFunc(BlendSrcFunc.ONE, BlendDstFunc.ONE); - builder.setDitherEnable(false); - builder.setDepthMask(false); - rs.mProgramStore_BLEND_ADD_DEPTH_NO_WRITE = builder.create(); - } - return rs.mProgramStore_BLEND_ADD_DEPTH_NO_WRITE; - } public static class Builder { RenderScript mRS; - Element mIn; - Element mOut; DepthFunc mDepthFunc; boolean mDepthMask; boolean mColorMaskR; @@ -228,26 +137,8 @@ public class ProgramStore extends BaseObj { BlendDstFunc mBlendDst; boolean mDither; - - - public Builder(RenderScript rs, Element in, Element out) { - mRS = rs; - mIn = in; - mOut = out; - mDepthFunc = DepthFunc.ALWAYS; - mDepthMask = false; - mColorMaskR = true; - mColorMaskG = true; - mColorMaskB = true; - mColorMaskA = true; - mBlendSrc = BlendSrcFunc.ONE; - mBlendDst = BlendDstFunc.ZERO; - } - public Builder(RenderScript rs) { mRS = rs; - mIn = null; - mOut = null; mDepthFunc = DepthFunc.ALWAYS; mDepthMask = false; mColorMaskR = true; @@ -263,12 +154,12 @@ public class ProgramStore extends BaseObj { return this; } - public Builder setDepthMask(boolean enable) { + public Builder setDepthMaskEnabled(boolean enable) { mDepthMask = enable; return this; } - public Builder setColorMask(boolean r, boolean g, boolean b, boolean a) { + public Builder setColorMaskEnabled(boolean r, boolean g, boolean b, boolean a) { mColorMaskR = r; mColorMaskG = g; mColorMaskB = b; @@ -282,7 +173,7 @@ public class ProgramStore extends BaseObj { return this; } - public Builder setDitherEnable(boolean enable) { + public Builder setDitherEnabled(boolean enable) { mDither = enable; return this; } |