Embodiments of the disclosure are directed to HTML5 Canvas element rendering methods implemented on an Android system based on GPU hardware. The methods may include after a rendering operation instruction for a Canvas element in an HTML5 web page is detected and an initialization operation is completed, converting an invoking instruction for a 2D Canvas drawing API into an invoking instruction for an OpenGL ES API through a Skia GPU function library; setting EGL Context created during the initialization operation as a current context of a thread where a rendering operation is located; rendering the Canvas element in an off-screen local window created during the initialization operation by using the GPU; and copying the rendered Canvas element to a current active window of a device from the off-screen local window by using a mapping operation function of the GPU. The methods, by making use of a local window rendering mechanism provided by an Android operating system and the OpenGL ES API, allow the Canvas element to be drawn and mixed by using the GPU, thereby improving the performance of Canvas rendering by using GPU hardware acceleration.
展开▼
机译:本公开的实施例针对在基于GPU硬件的Android系统上实现的HTML5 Canvas元素渲染方法。该方法可以包括以下步骤:在检测到HTML5网页中Canvas元素的渲染操作指令并完成初始化操作之后,通过Skia GPU将2D Canvas绘图API的调用指令转换为OpenGL ES API的调用指令。功能库;将初始化操作期间创建的EGL Context设置为渲染操作所在线程的当前上下文;使用GPU在初始化操作期间创建的屏幕外本地窗口中渲染Canvas元素;通过使用GPU的映射操作功能,将渲染的Canvas元素从屏幕外的本地窗口复制到设备的当前活动窗口。这些方法通过利用Android操作系统和OpenGL ES API提供的本地窗口渲染机制,允许使用GPU绘制和混合Canvas元素,从而通过使用GPU硬件加速来提高Canvas渲染的性能。 。
展开▼