Canvas.drawVertices中的错误? (带有repro代码和logcat)

| 只需将此代码粘贴到一个简单的Android骨架项目中即可。
public final class DrawableView extends View
{
    private float[] mVertices = {0, 0, 255, 0, 255, 255, 0, 255};
    private float[] mTexCoords = {0, 0, 255, 0, 255, 255, 0, 255};
    private short[] mIndices = {0, 2, 3, 0, 1, 2};
    private int[] mColors = {Color.RED, Color.GREEN, Color.BLUE, Color.MAGENTA};

    Context mContext;
    BitmapShader mShader;

    public DrawableView(Context context)
    {
        super(context);
        mContext = context;
        mShader = new BitmapShader(BitmapFactory.decodeResource(getResources(), R.drawable.icon), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP);
    }

    @Override
    protected void onDraw(Canvas canvas) {
        Paint paint = new Paint();
        paint.setColor(Color.RED);
        paint.setShader(mShader);

        canvas.drawVertices(Canvas.VertexMode.TRIANGLES, 8, mVertices, 0, mTexCoords, 0, mColors, 0, mIndices, 0, 6, paint);

        invalidate();
    }
}
然后将其设置为主活动的onCreate中的主视图。
@Override
public void onCreate(Bundle savedInstanceState)
{
    super.onCreate(savedInstanceState);
    setContentView(new DrawableView(this));
}
这将使应用程序退出,没有错误,甚至没有“强制关闭”对话框。 Logcat也没有给我任何有用的信息(http://pastebin.com/c67NJnBz)! 但是,以下两个drawVertices调用均会产生所需的效果。
canvas.drawVertices(Canvas.VertexMode.TRIANGLES, 8, mVertices, 0, mTexCoords, 0, null, 0, mIndices, 0, 6, paint); // Works!
paint.setColor(Color.RED);
// paint.setShader(mShader);

canvas.drawVertices(Canvas.VertexMode.TRIANGLES, 8, mVertices, 0, mTexCoords, 0, mColors, 0, mIndices, 0, 6, paint); // Renders wireframe
难道我做错了什么?请帮助我确定这是否是Android API错误。     
已邀请:
        即使drawVertices的文档没有明确说明这一点,但是verts,texs和colors数组的数组大小必须都与vertexCount匹配。这个问题的第三个答案似乎也证实了这一点。 请记住,仅前一种(vertexCount / 2)颜色用于绘制三角形,其他值将被忽略。     

要回复问题请先登录注册