A graphical user interface redrawing method for terminal devices is disclosed, which comprises uploading corresponding invalidate data to a HashMap when a view in the graphical user interface has content updates, and determining whether the View Group to which the view belongs has invalidate data in the HashMap. When invalidate data is saved, the uploaded invalidate data and the saved invalidate data are merged and saved to the HashMap; a message delaying the execution of invalidate instructions is sent to the UI thread; and all invalidate data is read from the HashMap when the delay interval of the message is reached The HashMap is emptied and invalidate instructions are executed according to the invalidate data read. The embodiment of the invention also discloses a terminal device and a computer readable storage medium. Thus, the rendering efficiency of the whole graphical user interface can be improved.
【技术实现步骤摘要】
图形用户界面重绘方法、终端设备及计算机可读存储介质
本专利技术涉及图形用户界面(GraphicalUserInterface,GUI)
,尤其涉及一种图形用户界面重绘方法、终端设备及计算机可读存储介质。
技术介绍
目前,作为市面上主流的移动操作系统,Android使用GUI技术为用户呈现了内容丰富多彩的交互界面。GUI一般都采用Viewhierarchy形式来对各种UI元素进行组织。其中,每一个基本的UI元素以View的形式存在,多个View可以包含在同一个ViewGroup中,而由此组合而成的ViewGroup将会继续与其他View甚至是ViewGroup进行组合,最终生成ViewTree。每个ViewTree只有一个根节点ViewRoot。当UI界面上某个元素的内容发生了更新,该元素所属View将通过invalidate指令的形式通知上层ViewGroup当前是哪个View的内容发生了更新以及更新内容在界面上所在的区域(即脏区域,Dirtyregion)。该ViewGroup结合本身的显示区域及变换矩阵对该脏区域进行相应处理后,会继续向上一层的ViewGroup传递该invalidate指令,直至最终传递到ViewRoot。ViewRoot在收到invalidate指令后,将在下一个VSYNC(VerticalSynchronization垂直同步)信号到来时对ViewTree进行重绘。然而,这种ViewTree的invalidate指令传导技术存在一个问题:当属于同一个ViewGroup的多个View在下一个VSYNC信号到来之前都存在内容更新 ...
【技术保护点】
1.一种图形用户界面重绘方法,其特征在于,所述方法包括步骤:当所述图形用户界面中一个View有内容更新时,将对应的invalidate数据上传至一个HashMap;判断所述View所属View Group在所述HashMap中是否已保存有invalidate数据;当已保存有invalidate数据时,合并所述上传的invalidate数据和已保存的invalidate数据,并保存至所述HashMap;向UI线程发送一个延迟执行invalidate指令的消息;当达到所述消息的延时时间间隔后,从所述HashMap中读取所有invalidate数据并清空所述HashMap;及根据所读取的invalidate数据执行invalidate指令。
【技术特征摘要】
1.一种图形用户界面重绘方法,其特征在于,所述方法包括步骤:当所述图形用户界面中一个View有内容更新时,将对应的invalidate数据上传至一个HashMap;判断所述View所属ViewGroup在所述HashMap中是否已保存有invalidate数据;当已保存有invalidate数据时,合并所述上传的invalidate数据和已保存的invalidate数据,并保存至所述HashMap;向UI线程发送一个延迟执行invalidate指令的消息;当达到所述消息的延时时间间隔后,从所述HashMap中读取所有invalidate数据并清空所述HashMap;及根据所读取的invalidate数据执行invalidate指令。2.根据权利要求1所述的图形用户界面重绘方法,其特征在于,所述方法还包括步骤:当所述View所属ViewGroup在所述HashMap中还未保存invalidate数据时,将所述上传的invalidate数据直接保存至所述HashMap中。3.根据权利要求1或2所述的图形用户界面重绘方法,其特征在于,所述invalidate数据包括所述View所属ViewGroup的引用和脏区域信息。4.根据权利要求1或2所述的图形用户界面重绘方法,其特征在于,所述HashMap以ViewGroup的引用作为主键。5.根据权利要求1或2所述的图形用户界面重绘方法,其特征在于,所述延时时间间隔小于VSYNC信号的时间间隔。6.一种终端设备,其特征在于,所述终端设备包括:存储器、处理器及存储在所述存储器上并可在所述处理器上...
【专利技术属性】
技术研发人员:叶垒,
申请(专利权)人:惠州TCL移动通信有限公司,
类型:发明
国别省市:广东,44
还没有人留言评论。发表了对其他浏览者有用的留言会获得科技券。