如https://stackoverflow.com/a/16257100/3286489中所述,为了使drawVertices在Android Canvas中绘制内容,它需要使用禁用硬件加速
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
我检查了基础代码,它有此检查
public void drawVertices(@NonNull VertexMode mode, int vertexCount, @NonNull float[] verts,
int vertOffset, @Nullable float[] texs, int texOffset, @Nullable int[] colors,
int colorOffset, @Nullable short[] indices, int indexOffset, int indexCount,
@NonNull Paint paint) {
checkRange(verts.length, vertOffset, vertexCount);
if (isHardwareAccelerated()) {
return;
}
// ... codes that perform the drawing
}
为什么我们不能在上面使用硬件加速?
中未提及