CN114610255A - Picture drawing method, device, storage medium and terminal - Google Patents

Picture drawing method, device, storage medium and terminal Download PDF

Info

Publication number
CN114610255A
CN114610255A CN202210169858.5A CN202210169858A CN114610255A CN 114610255 A CN114610255 A CN 114610255A CN 202210169858 A CN202210169858 A CN 202210169858A CN 114610255 A CN114610255 A CN 114610255A
Authority
CN
China
Prior art keywords
next synchronization
current
time
cycle
synchronization cycle
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210169858.5A
Other languages
Chinese (zh)
Inventor
文小龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Realme Mobile Telecommunications Shenzhen Co Ltd
Original Assignee
Realme Mobile Telecommunications Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Realme Mobile Telecommunications Shenzhen Co Ltd filed Critical Realme Mobile Telecommunications Shenzhen Co Ltd
Priority to CN202210169858.5A priority Critical patent/CN114610255A/en
Publication of CN114610255A publication Critical patent/CN114610255A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/14Digital output to display device ; Cooperation and interconnection of the display device with other functional units
    • G06F3/1407General aspects irrespective of display type, e.g. determination of decimal point position, display with fixed or driving decimal point, suppression of non-significant zeros
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/20Processor architectures; Processor configuration, e.g. pipelining

Abstract

The embodiment of the application discloses a picture drawing method, a picture drawing device, a storage medium and a terminal, wherein the method comprises the following steps: determining the current interface drawing completion time of the current synchronization period, determining the next synchronization signal arrival time of the next synchronization period, starting to execute the animation callback of the next synchronization period in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and executing the interface drawing of the next synchronization period after the animation callback is completed. According to the method and the device, the mode that the next synchronization period of the animation callback is advanced to the idle time in the current synchronization period to start execution is adopted, the next synchronization period of the interface drawing is executed after the next synchronization period of the animation callback is completed, the probability that the overtime of the interface drawing is completed due to too long time consumed by the animation callback can be reduced, the probability of application refresh overtime can be reduced, and the probability of frame dropping can be reduced.

Description

Picture drawing method, device, storage medium and terminal
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for drawing a picture, a storage medium, and a terminal.
Background
In the android system, the screen refreshing process can be mainly summarized into three parts: the method comprises the steps of calculating screen data by a Central Processing Unit (CPU), further processing and caching by a Graphics Processing Unit (GPU), and finally displaying the data in the cache by a display. Generally, when the refresh rate of the screen is 60Hz, the terminal refreshes the screen once every 16ms, that is, the bottom layer sends a vsync signal every 16ms or so, and every time the vsync signal arrives, the display displays the data in the buffer, and at the same time, the processor starts to calculate the data of the next frame of picture, and then stores the data of the next frame of picture in the buffer, and when another vsync signal arrives, the display displays the data of the frame of picture from the buffer.
Disclosure of Invention
The embodiment of the application provides a picture drawing method, a picture drawing device, a computer storage medium and a terminal, which can reduce the probability of finishing overtime drawing of an interface caused by too long time spent on animation callback, further reduce the probability of overtime application refresh and further reduce the probability of frame dropping. The technical scheme is as follows:
in a first aspect, an embodiment of the present application provides a picture drawing method, where the method includes:
determining the drawing completion time of the current interface of the current synchronization period and determining the arrival time of the next synchronization signal of the next synchronization period;
and starting to execute the animation callback of the next synchronization cycle in the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal, and executing the interface drawing of the next synchronization cycle after the animation callback is completed.
In a second aspect, an embodiment of the present application provides a picture drawing apparatus, including:
the time determining module is used for determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period;
and the picture drawing module is used for starting to execute the animation callback of the next synchronization cycle in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and executing the interface drawing of the next synchronization cycle after the animation callback is completed.
In a third aspect, embodiments of the present application provide a computer storage medium having a plurality of instructions adapted to be loaded by a processor and to perform the above-mentioned method steps.
In a fourth aspect, an embodiment of the present application provides a terminal, which may include: a memory and a processor; wherein the memory stores a computer program adapted to be loaded by the memory and to perform the above-mentioned method steps.
The beneficial effects brought by the technical scheme provided by the embodiment of the application at least comprise:
when the scheme of the embodiment of the application is executed, the current interface drawing completion time of the current synchronization period and the next synchronization signal arrival time of the next synchronization period are determined, the animation callback of the next synchronization period is started to be executed in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and the interface drawing of the next synchronization period is executed after the animation callback is completed. According to the method and the device, the mode that the next synchronization period of the animation callback is advanced to the idle time in the current synchronization period to start execution is adopted, the next synchronization period of the interface drawing is executed after the next synchronization period of the animation callback is completed, the probability that the overtime of the interface drawing is completed due to too long time consumed by the animation callback can be reduced, the probability of application refresh overtime can be reduced, and the probability of frame dropping can be reduced.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the embodiments or the prior art descriptions will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is also possible for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a picture drawing method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a drawing principle provided in an embodiment of the present application;
FIG. 3 is a schematic flow chart of another picture drawing method provided in the embodiment of the present application;
FIG. 4 is a schematic diagram of another drawing scheme provided in the embodiments of the present application;
FIG. 5 is a schematic diagram of another drawing method provided in the embodiments of the present application;
FIG. 6 is a schematic diagram of another drawing method provided in the embodiments of the present application;
FIG. 7 is a schematic diagram of still another drawing method provided in the embodiments of the present application;
fig. 8 is a schematic structural diagram of a picture drawing apparatus according to an embodiment of the present application;
fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application.
Detailed Description
In order to make the objects, features and advantages of the embodiments of the present application more obvious and understandable, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the description of the present application, it is to be understood that the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance. In the description of the present application, it is noted that, unless explicitly stated or limited otherwise, "including" and "having" and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements listed, but may alternatively include other steps or elements not listed, or inherent to such process, method, article, or apparatus. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art. Further, in the description of the present application, "a plurality" means two or more unless otherwise specified. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship.
In the android system, the conventional User Interface (UI) refresh scheme is mainly a manner of refreshing at intervals. If the refresh rate is 60Hz, a vsync signal is sent to the bottom layer every 16ms or so, and the display will fetch data from the buffer and then display a frame of picture. When the vsync signal arrives, the processor executes the work of the next frame of picture, which mainly comprises executing application animation (animation) callback and executing UI drawing, and the work needs to be finished in corresponding time (when the refresh rate is 60Hz, the time is about 16 ms). If animation and UI drawing are not completed in the current 16ms time period, that is, the work is overtime, and when the next vsync signal arrives, the display cannot acquire the data of the frame of picture from the buffer, and cannot display the frame of picture, the problem of frame dropping occurs. The problem of working timeout occurs mainly because animation callback takes a lot of time, and in many cases, because animation callback takes too long time, and then when the next vsync signal arrives, UI drawing is not completed, which causes application refresh timeout, thereby causing a problem of frame dropping.
The present application will be described in detail with reference to specific examples.
In the following method embodiments, for convenience of description, only the execution subject of each step is taken as a terminal for description.
Fig. 1 is a schematic flow chart of a picture drawing method according to an embodiment of the present disclosure. As shown in fig. 1, the method of the embodiment of the present application may include the steps of:
s101, determining the drawing completion time of the current interface of the current synchronization period, and determining the arrival time of the next synchronization signal of the next synchronization period.
It is to be understood that a synchronization period refers to a time period corresponding to the time period between two vsync signals. The current synchronization period may be a synchronization period that is currently being experienced at the current time. The next synchronization period may be the next synchronization period after the current synchronization period. In the process of refreshing the UI, for example, the screen refresh rate is 60Hz, a vsync synchronization signal arrives every 16ms or so, when each vsync synchronization signal arrives, the display needs to acquire data of a current frame of picture from a buffer and then display the current frame of picture, and meanwhile, the processor needs to do refresh preparation work of the next frame of picture, which mainly comprises animation echo and UI drawing. Therefore, the current interface drawing can be the UI drawing which needs to be executed by the terminal in the current synchronization period, and the current interface drawing completion time can be the corresponding time point when the current UI drawing is completed. The next synchronization signal may be a next vsync signal, and the arrival time of the next synchronization signal may be a time point corresponding to the arrival time of the next vsync signal.
For example, referring to the schematic diagram of the drawing of the picture shown in fig. 2, the synchronization signal indicates a vsync signal, when each synchronization signal arrives, the display needs to obtain data of a "current frame picture" from the buffer, and then display the "current frame picture", and at the same time, the processor needs to start to perform preparation work of a "next frame picture", which mainly includes animation blending and interface drawing, and when a next synchronization signal arrives, the display can obtain data of the "next frame picture", and then display the "next frame picture", and the processor simultaneously performs corresponding work, and the screen refresh can be realized by repeatedly performing the operations. In fig. 2, the time period between the synchronization signal 1 and the synchronization signal 2 can be referred to as a current synchronization period, and then the time period between the synchronization signal 2 and the synchronization signal 3 is referred to as a next synchronization period, and the arrival time of the synchronization signal 2 is the arrival time of the next synchronization signal.
In some embodiments, in a screen refreshing process of the terminal, the terminal may directly obtain a time point when the current interface drawing execution is completed in the current synchronization period, that is, a current interface drawing completion time. The terminal may also calculate a time point when the next synchronization signal of the next synchronization period arrives, that is, the arrival time of the next synchronization signal. Generally, the duration corresponding to one synchronization period may be the reciprocal of the screen refresh rate, and the next arrival time of the synchronization signal may be obtained by adding the duration corresponding to one synchronization period to the current arrival time of the synchronization signal.
And S102, starting to execute the animation callback of the next synchronization cycle in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and executing the interface drawing of the next synchronization cycle after the animation callback is completed.
In some embodiments, in the current synchronization cycle, the processor generally executes an animation callback, and after the animation callback is executed, the current interface drawing is started to be executed, and after the current interface drawing is executed, the current synchronization cycle is not finished yet, that is, a time point corresponding to the time point when the current interface drawing is completed is still within the time of the current synchronization cycle, so that a time period between the time point when the current interface drawing is completed and the time point when the next synchronization signal arrives is called an idle time, and the time point when the next synchronization signal arrives is a start point of the next synchronization cycle. In the related art, in the current synchronization cycle, if there is idle time, the processor waits until the next synchronization signal arrives to start execution of an animation callback of the next synchronization cycle, and executes interface drawing of the next synchronization cycle after the execution of the animation callback of the next synchronization cycle is completed. In the solution of the embodiment of the present application, in the current synchronization cycle, if there is idle time, the animation callback of the next synchronization cycle may be executed in the idle time, and the interface drawing of the next synchronization cycle is executed after the animation callback is completed.
When the scheme of the embodiment of the application is executed, the current interface drawing completion time of the current synchronization period and the next synchronization signal arrival time of the next synchronization period are determined, the animation callback of the next synchronization period is started to be executed in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and the interface drawing of the next synchronization period is executed after the animation callback is completed. According to the method and the device, the mode that the next synchronization period of the animation callback is advanced to the idle time in the current synchronization period to start execution is adopted, the next synchronization period of the interface drawing is executed after the next synchronization period of the animation callback is completed, the probability that the overtime of the interface drawing is completed due to too long time consumed by the animation callback can be reduced, the probability of application refresh overtime can be reduced, and the probability of frame dropping can be reduced.
Please refer to fig. 3, which is a flowchart illustrating a picture drawing method according to an embodiment of the present disclosure. As shown in fig. 3, the method of the embodiment of the present application may include the steps of:
s301, receiving sliding operation aiming at the display interface, and acquiring the execution times of the animation callback in the current synchronization period.
It is to be understood that the display interface may be a UI interface displayed on the terminal. The sliding operation may be a touch operation performed on the UI interface, for example, the sliding operation may be a touch operation performed in a vertical direction, a touch operation performed in a horizontal direction, or a touch operation performed in an arbitrary direction and at an arbitrary angle.
The number of executions may be expressed as how many animation callbacks are executed in the current synchronization cycle.
The synchronization period may be a time period corresponding to a time period between two vsync signals.
In some embodiments, the applicable application scenario may be that the user performs a sliding operation on the display interface. Generally, a user executes a sliding operation on a display interface, a terminal needs to load a large amount of content and display the content in response to the sliding operation, and if the design optimization of an application program is not good, an animation callback is too long when a screen is refreshed in the scene, so that the problems of application refresh timeout and frame drop occur. In order to reduce the probability of frame drop in this scenario, the number of times of execution of the animation callback in the current synchronization period may be obtained when the sliding operation of the user on the display interface is received. In a specific scene, the steps of the scheme are executed, so that the resources of the terminal can be saved, and the resource consumption caused by the execution of the scheme in some scenes without optimizing dropped frames is avoided.
And S302, if the execution times are less than the preset times, determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period.
It can be understood that the preset number of times can be set to 2, and then the number of times of execution can only be 1 or 0, so that it is ensured that only the animation callback of the current synchronization cycle can be executed in the current synchronization cycle before the steps of the scheme are executed.
The current synchronization period may be one synchronization period that is being experienced at the current time.
The next synchronization period may be the next synchronization period after the current synchronization period. The next synchronization signal is the starting point of the next synchronization cycle, which is also the vsync signal.
In some embodiments, when it is determined that the execution times satisfy the preset condition, that is, when the execution times are less than the preset times, the terminal may directly obtain a time point corresponding to the completion of the current drawing interface, that is, a current interface drawing completion time.
It should be noted that, when the execution number is greater than or equal to the preset number, the steps of determining the current interface drawing completion time of the current synchronization cycle and determining the next synchronization signal arrival time of the next synchronization cycle do not need to be executed, and when the next synchronization cycle arrives after the current synchronization cycle elapses, the next synchronization cycle may be regarded as the current synchronization cycle, and the step of receiving the sliding operation for the display interface and acquiring the execution number of the animation callback in the current synchronization cycle is executed.
S303, in the current synchronization period, acquiring a first working duration corresponding to the animation callback of the current synchronization period, and acquiring a second working duration corresponding to the current interface drawing of the current synchronization period.
S304, calculating the sum of the first working time length and the second working time length, and determining the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal based on the total time length of the current synchronization period and the sum.
S303 and S304 are explained below.
It is understood that the first operation duration may be a duration for which the terminal completes the animation callback of the current synchronization period. The second working duration may be a duration for completing the current interface drawing of the current synchronization period.
The total duration of the current synchronization period may be an intra-period duration corresponding to the current synchronization period. For example, when the screen refresh rate is 60Hz, the duration of one synchronization period is about 16 ms.
The idle time may be a time period within the current synchronization period during which no task (animation loop and UI drawing) is required to be performed.
In some embodiments, the terminal should perform an animation callback of the current synchronization period during the current synchronization period, and should perform the current interface drawing of the current synchronization period after the animation callback of the current synchronization period is completed. Furthermore, a first working time length corresponding to an animation callback for executing the current synchronization cycle and a second working time length corresponding to the current interface drawing of the current synchronization cycle can be obtained, because the animation callback is executed only once in the current synchronization cycle, the animation callback of the current synchronization cycle usually starts to be executed when the current synchronization signal of the current synchronization cycle arrives, the sum of the first working time length and the second working time length can be calculated, and naturally, the time period corresponding to the total time length of the current synchronization cycle can be subtracted from the time period corresponding to the total time length of the current synchronization cycle, the time period starting from the starting point in the current synchronization cycle corresponding to the sum, so that the idle time period in the current synchronization cycle, namely the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal, can be obtained.
S305, starting to execute the animation callback of the next synchronization cycle in the idle time, and starting to execute the interface drawing of the next synchronization cycle after the animation callback is completed.
In some embodiments, in the idle time of the current synchronization cycle, the execution of the animation callback of the next synchronization cycle may be started, that is, the animation callback of the next synchronization cycle is advanced to the idle time of the current synchronization cycle and is started, and further, after the animation callback of the next synchronization cycle is completed and is still in the idle time of the current synchronization cycle, the execution of the interface drawing of the next synchronization cycle may be started, that is, the interface drawing of the next synchronization cycle may be advanced to the idle time of the current synchronization cycle and is executed. For example, the schematic diagram of the picture drawing shown in fig. 4 can be referred to. In fig. 4, a solid line box between sync signal 1 and sync signal 3 represents animation callback and interface rendering for the current sync period, a dotted line box represents animation callback and interface rendering for the next sync period, animation callback and interface rendering for the current sync period are performed, animation callback for the next sync period starts to be performed during idle time after animation callback for the current sync period is completed, and interface rendering for the next sync period starts to be performed after animation callback for the next sync period is completed.
And S306, determining the interface drawing completion time of the next synchronization period and determining the remaining idle time between the interface drawing completion time and the arrival time of the next synchronization signal in the idle time.
S307, if the duration of the remaining idle time is longer than the preset duration, starting to execute the animation callback of the adjacent synchronization cycle after the next synchronization cycle in the remaining idle time, and executing the interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
S308, if the duration of the remaining idle time is less than or equal to a preset duration, in the next synchronization cycle, starting to execute an animation callback of an adjacent synchronization cycle after the next synchronization cycle, and executing interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
S306 to S308 are explained below.
In some embodiments, the interface drawing of the next synchronization cycle is started within the idle time of the current synchronization cycle, and after the interface drawing of the next synchronization cycle is completed, if the interface drawing is still within the idle time of the current synchronization cycle, the remaining idle time between the interface drawing completion time of the next synchronization cycle and the arrival time of the next synchronization signal may be determined according to the interface drawing completion time of the next synchronization cycle and the arrival time of the next synchronization signal. Further, on one hand, if it is determined that the duration of the remaining idle time is greater than the preset time (indicating that the remaining idle time is sufficient and the animation callback of the subsequent synchronization cycle can be executed in advance), the animation callback of the next synchronization cycle (i.e. the adjacent synchronization cycle) after the next synchronization cycle can be started to be executed in the remaining idle time, and after the animation callback of the adjacent synchronization cycle is executed, the interface drawing of the adjacent synchronization cycle can be started to be executed in the adjacent synchronization cycle regardless of the current synchronization cycle or the next synchronization cycle. For example, the schematic diagram of the picture drawing shown in fig. 5 can be referred to. In fig. 5, the solid line boxes between the sync signal 1 and the sync signal 3 represent the animation callbacks and interface renderings in the current sync period, the dotted line boxes represent the animation callbacks and interface renderings in the next sync period, the gray boxes represent the animation callbacks and interface renderings in the adjacent sync period, both the animation callbacks and interface renderings in the next sync period are completed in the idle time, and there is sufficient remaining idle time in the idle time in which the execution of the animation callbacks in the adjacent sync period can be started. By adopting the method, on the basis of sufficient time, the animation callback of two synchronization periods after the current synchronization period is selected to be executed in advance, so that the probability of finishing the timeout of the animation callback in the subsequent synchronization period can be further reduced, and the probability of frame dropping caused by the timeout of the animation callback can be further reduced.
On the other hand, if it is determined that the duration of the remaining idle time is less than or equal to the preset duration (indicating that the remaining idle time is insufficient and it is not necessary to perform an animation callback of a subsequent synchronization cycle in advance), the animation callback of another synchronization cycle (i.e., an adjacent synchronization cycle) after the next synchronization cycle may be performed in the next synchronization cycle in advance, and the interface drawing of the adjacent synchronization cycle is performed after the animation callback of the adjacent synchronization cycle is performed. In this case, the animation callback of the adjacent synchronization cycle is executed in the next synchronization cycle, and when the time can enter the next synchronization cycle, the scheme is executed with reference to the steps S301 to S307, where the next synchronization cycle is the current synchronization cycle in the above steps, and the adjacent synchronization cycle is the adjacent synchronization cycle in the above steps. For example, the schematic diagram of the drawing of the picture shown in fig. 6 can be referred to. In fig. 6, a solid line frame between the sync signal 1 and the sync signal 3 represents animation callbacks and interface renderings in the current sync period, a dotted line frame represents animation callbacks and interface renderings in the next sync period, a gray frame represents animation callbacks and interface renderings in the adjacent sync period, both the animation callbacks and the interface renderings in the next sync period are completed within the idle time of the current sync period, and at this time, the remaining idle time is insufficient, and the animation callbacks in the adjacent sync period can not be executed in advance any more, and the animation callbacks in the adjacent sync period can be executed in the next sync period. By adopting the method, the animation callback of the next synchronization period is ensured to be executed in advance on the basis of insufficient time, the probability of finishing the overtime drawing of the interface caused by too long time spent on the animation callback can be reduced, the probability of the overtime refreshing of the application can be further reduced, the probability of frame dropping can be further reduced, and the probability of the pause caused by the frame dropping can be further reduced.
And S309, starting to execute the animation callback of the next synchronization cycle in the idle time, finishing the animation callback of the next synchronization cycle in the idle time, and starting to execute the interface drawing of the next synchronization cycle in the next synchronization cycle and when the next synchronization signal of the next synchronization cycle arrives.
In some embodiments, in the idle time of the current synchronization cycle, the animation callback of the next synchronization cycle may be started to be executed, that is, the animation callback of the next synchronization cycle is advanced to the idle time of the current synchronization cycle to be executed, and further, after the animation callback of the next synchronization cycle is completed, the next synchronization cycle is still in the idle time of the current synchronization cycle, the terminal may not execute any animation callback or interface drawing of any synchronization cycle until the next synchronization cycle is entered, and when a next synchronization signal of the next synchronization cycle arrives, the interface drawing of the next synchronization cycle is started to be executed again.
Optionally, in another embodiment, during the idle time of the current synchronization cycle, the execution of the animation callback of the next synchronization cycle may be started, that is, the animation callback of the next synchronization cycle is advanced to the idle time of the current synchronization cycle and is started. Further, after the animation callback of the next synchronization cycle is completed, the terminal is still in the idle time of the current synchronization cycle, and the terminal can start to execute the animation callback of the next synchronization cycle after the next synchronization cycle, that is, the animation callback of the next synchronization cycle after the next synchronization cycle is advanced to the idle time of the current synchronization cycle to start to execute until the next synchronization cycle is entered, and when the next synchronization signal of the next synchronization cycle arrives, the terminal starts to execute the interface drawing of the next synchronization cycle. By adopting the method, the animation callback of two synchronization periods after the current synchronization period is selected to be executed in advance, the probability of finishing the overtime of the interface drawing caused by too long time consumption of the animation callback can be further reduced, and the problem of frame drop caused by the overtime of the interface drawing can be further reduced.
And S310, starting to execute the animation callback of the next synchronization cycle in the idle time, and starting to execute the interface drawing of the next synchronization cycle in the next synchronization cycle and after the animation callback of the next synchronization cycle is finished.
In some embodiments, during the idle time of the current sync cycle, the execution of the animation callback of the next sync cycle may begin, i.e., the animation callback of the next sync cycle is advanced to begin execution within the idle time of the current sync cycle. Furthermore, after the animation callback of the next synchronization cycle is completed, the next synchronization cycle is already in the next synchronization cycle, and the interface drawing of the next synchronization cycle can be executed. For example, the schematic diagram of the picture drawing shown in fig. 7 can be referred to. In fig. 7, the solid line box between sync signal 1 and sync signal 3 represents the animation callback and interface drawing of the current sync cycle, the dashed line box represents the animation callback and interface drawing of the next sync cycle, the animation callback of the next sync cycle starts to be executed in the idle time of the current sync cycle, and the animation callback of the next sync cycle can be executed after the animation callback of the next sync cycle is completed and is in the next sync cycle. By adopting the method, the animation callback of the next synchronization period is executed in advance in the current synchronization period, so that the probability of finishing the overtime drawing of the interface due to too long time consumption of the animation callback can be reduced, the probability of frame dropping caused by the overtime drawing of the interface can be further reduced, and the probability of pause caused by the frame dropping can be further reduced.
According to the embodiment of the application, when the sliding operation aiming at the display interface is received, the execution times of the animation callback in the current synchronization period are obtained, the scheme can be executed under the condition that terminal resources are saved, then under the condition that the execution times are determined to be smaller than the preset times, the animation callback of the next synchronization period is executed in advance to the idle time of the current synchronization period, then the interface drawing of the next synchronization period is executed after the animation callback of the next synchronization period is completed, on the basis that the terminal memory is not influenced, the probability that the interface drawing is overtime due to too long time consumed by the animation callback can be reduced, the probability of application refresh overtime can be reduced, the probability of frame dropping can be reduced, and the probability of blocking caused by the frame dropping can be reduced. In addition, the execution time of the animation callback is advanced, the adjustment of the frequency of the processor is not involved, the problem of unsmooth jam is solved by improving the frequency of the processor in the related technology, the power consumption of the terminal is increased by improving the frequency of the processor, and the power consumption of the terminal is not influenced. In addition, the execution time of the animation callback is advanced, the animation callback of the next synchronization period can be executed in advance in the current synchronization period, the animation callback of the next synchronization period and the interface drawing can be executed in advance in the current synchronization period, even the animation callback of the next synchronization period and the animation callback of the next synchronization period can be executed in the current synchronization period, the probability of finishing the overtime of the interface drawing due to too long time of the animation callback can be further reduced, and the problem of frame drop caused by the overtime of the interface drawing can be further reduced.
Fig. 8 is a schematic structural diagram of a picture drawing apparatus according to an embodiment of the present disclosure. The screen drawing apparatus 800 may be implemented as all or a part of the terminal by software, hardware, or a combination of both. The apparatus 800 comprises:
a time determining module 810, configured to determine a current interface drawing completion time of a current synchronization cycle, and determine a next synchronization signal arrival time of a next synchronization cycle;
and the picture drawing module 820 is configured to start to execute the animation callback of the next synchronization cycle within the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and execute the interface drawing of the next synchronization cycle after the animation callback is completed.
Optionally, the time determining module 810 includes:
and the time determining unit is used for receiving the sliding operation aiming at the display interface, determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period.
Optionally, the apparatus 800 further includes:
the number judgment module is used for acquiring the execution number of the animation callback in the current synchronization period; and if the execution times are less than the preset times, executing the steps of determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period.
Optionally, the screen drawing module 820 includes:
the time length calculation unit is used for acquiring a first working time length corresponding to the animation callback of the current synchronization period and acquiring a second working time length corresponding to the current interface drawing of the current synchronization period in the current synchronization period;
an idle time determining unit, configured to calculate a sum of the first operating time length and the second operating time length, and determine an idle time between the current interface drawing completion time and the next synchronization signal arrival time based on the total time length of the current synchronization period and the sum;
and the picture drawing unit is used for starting to execute the animation callback of the next synchronization cycle in the idle time and executing the interface drawing of the next synchronization cycle after the animation callback is finished.
Optionally, the picture drawing module 820 includes:
the first drawing unit is used for starting to execute the interface drawing of the next synchronization cycle in the idle time and after the animation callback of the next synchronization cycle is completed;
or the like, or a combination thereof,
the second drawing unit is used for finishing the animation callback of the next synchronization cycle in the idle time and starting to draw an interface of the next synchronization cycle when a next synchronization signal of the next synchronization cycle arrives in the next synchronization cycle;
or the like, or a combination thereof,
and the third drawing unit is used for starting to execute the interface drawing of the next synchronization cycle in the next synchronization cycle and after the animation callback of the next synchronization cycle is completed.
Optionally, the first drawing unit further includes:
the first drawing subunit is used for determining the interface drawing completion time of the next synchronization period in the idle time;
the second drawing subunit is used for determining the remaining idle time between the interface drawing completion time and the next synchronization signal arrival time;
and the third drawing subunit is configured to, if the duration of the remaining idle time is greater than a preset time, start to execute an animation callback of an adjacent synchronization cycle after the next synchronization cycle within the remaining idle time, and execute interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is completed.
Optionally, the first drawing unit further includes:
and the fourth drawing subunit is configured to, if the duration of the remaining idle time is less than or equal to a preset duration, start to execute an animation callback of an adjacent synchronization cycle after the next synchronization cycle in the next synchronization cycle, and execute interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
Referring to fig. 9, fig. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application. As shown in fig. 9, terminal 1300 may include: at least one processor 1301, at least one network interface 1304, a user interface 1303, memory 1305, a display screen assembly 1306, at least one communication bus 1302.
Wherein a communication bus 1302 is used to enable connective communication between these components.
The user interface 1303 may include a Display screen (Display) and a Camera (Camera), and the optional user interface 1303 may also include a standard wired interface and a wireless interface.
The network interface 1304 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface).
Processor 1301 may include one or more processing cores, among other things. The processor 1301 connects various parts throughout the terminal 1300 using various interfaces and lines to perform various functions of the terminal 1300 and process data by executing or executing instructions, programs, code sets or instruction sets stored in the memory 1305 and invoking data stored in the memory 1305. Optionally, the processor 1301 may be implemented in at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), and Programmable Logic Array (PLA). The processor 1301 may integrate one or a combination of a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), a modem, and the like. The CPU mainly processes an operating system, a user interface, an application program and the like; the GPU is used for rendering and drawing the content required to be displayed by the display screen; the modem is used to handle wireless communications. It is understood that the modem may not be integrated into the processor 1301, but may be implemented by one chip.
The Memory 1305 may include a Random Access Memory (RAM) or a Read-Only Memory (Read-Only Memory). Optionally, the memory 1305 includes a non-transitory computer-readable medium. The memory 1305 may be used to store an instruction, a program, code, a set of codes, or a set of instructions. The memory 1305 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as a touch function, a sound playing function, an image playing function, etc.), instructions for implementing the various method embodiments described above, and the like; the storage data area may store data and the like referred to in the above respective method embodiments. The memory 1305 may optionally be at least one memory device located remotely from the processor 1301. As shown in fig. 9, a memory 1305 as a kind of computer storage medium may include therein programs of an operating system, a network communication module, a user interface module, and a screen drawing method.
In the terminal 1300 shown in fig. 9, the user interface 1303 is mainly used for providing an input interface for a user to obtain data input by the user; the processor 1301 may be configured to call a program of the picture drawing method stored in the memory 1305, and specifically perform the following operations:
determining the drawing completion time of the current interface of the current synchronization period and determining the arrival time of the next synchronization signal of the next synchronization period;
and starting to execute the animation callback of the next synchronization cycle in the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal, and executing the interface drawing of the next synchronization cycle after the animation callback is completed.
In an embodiment, when determining the current interface drawing completion time of the current synchronization cycle and determining the next synchronization signal arrival time of the next synchronization cycle, the processor 1301 specifically performs the following operations:
the method comprises the steps of receiving sliding operation aiming at a display interface, determining the current interface drawing completion time of the current synchronization period, and determining the next synchronization signal arrival time of the next synchronization period.
In one embodiment, before performing the above operations of determining the current interface drawing completion time of the current synchronization cycle and determining the next synchronization signal arrival time of the next synchronization cycle, the processor 1301 further performs the following operations:
acquiring the execution times of animation callback in the current synchronization period;
and if the execution times are less than the preset times, executing the steps of determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period.
In one embodiment, the processor 1301 starts to execute the animation callback of the next synchronization cycle during the idle time between the time when the current interface drawing is completed and the time when the next synchronization signal arrives, and specifically executes the following operation when the step of executing the interface drawing of the next synchronization cycle is executed after the animation callback is completed:
in a current synchronization period, acquiring a first working duration corresponding to animation callback of the current synchronization period, and acquiring a second working duration corresponding to current interface drawing of the current synchronization period;
calculating the sum of the first working time length and the second working time length, and determining the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal based on the total time length of the current synchronization period and the sum;
and starting to execute the animation callback of the next synchronization cycle in the idle time, and executing the interface drawing of the next synchronization cycle after the animation callback is finished.
In an embodiment, when the processor 1301 executes the step of executing the interface drawing of the next synchronization cycle after the animation callback is completed, the following operations are specifically executed:
starting to execute the interface drawing of the next synchronization cycle within the idle time and after the animation callback of the next synchronization cycle is completed;
or the like, or, alternatively,
the animation callback of the next synchronization cycle is completed in the idle time, and in the next synchronization cycle, when a next synchronization signal of the next synchronization cycle arrives, the interface drawing of the next synchronization cycle is executed;
or the like, or, alternatively,
and starting to execute the interface drawing of the next synchronization cycle in the next synchronization cycle and after the animation callback of the next synchronization cycle is completed.
In one embodiment, processor 1301, after executing the interface drawing of the next synchronization cycle after the animation callback of the next synchronization cycle is completed and the execution of the idle time, further performs the following operations:
determining the interface drawing completion time of the next synchronization period in the idle time;
determining the remaining idle time between the interface drawing completion time and the next synchronization signal arrival time;
and if the duration of the remaining idle time is longer than the preset duration, starting to execute the animation callback of the adjacent synchronization cycle after the next synchronization cycle in the remaining idle time, and executing the interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
In one embodiment, processor 1301 also performs the following:
and if the duration of the remaining idle time is less than or equal to a preset duration, starting to execute an animation callback of an adjacent synchronization cycle after the next synchronization cycle in the next synchronization cycle, and executing interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
In addition, those skilled in the art will appreciate that the configuration of terminal 1300 illustrated in the above-described figures does not constitute a limitation of terminal 1300, as user terminals may include more or less components than those illustrated, or some components may be combined, or a different arrangement of components. For example, the terminal 1300 further includes a radio frequency circuit, an audio circuit, a WiFi component, a power supply, a bluetooth component, and other components, which are not described herein again.
The embodiment of the present application further provides a computer-readable storage medium, which stores at least one instruction, where the at least one instruction is used to be executed by a processor to implement the picture drawing method according to the above embodiments.
The embodiment of the present application further provides a computer program product, where at least one instruction is stored, and the at least one instruction is loaded and executed by the processor to implement the picture drawing method according to the above embodiments.
Those skilled in the art will recognize that, in one or more of the examples described above, the functions described in the embodiments of the present application may be implemented in hardware, software, firmware, or any combination thereof. When implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one place to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer.
The above description is intended only to illustrate the alternative embodiments of the present application, and should not be construed as limiting the present application, and any modifications, equivalents, improvements and the like made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. A picture drawing method, comprising:
determining the drawing completion time of the current interface of the current synchronization period and determining the arrival time of the next synchronization signal of the next synchronization period;
and starting to execute the animation callback of the next synchronization cycle in the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal, and executing the interface drawing of the next synchronization cycle after the animation callback is completed.
2. The method of claim 1, wherein determining a current interface drawing completion time for a current synchronization cycle and determining a next synchronization signal arrival time for a next synchronization cycle comprises:
the method comprises the steps of receiving sliding operation aiming at a display interface, determining the current interface drawing completion time of the current synchronization period, and determining the next synchronization signal arrival time of the next synchronization period.
3. The method of claim 1, wherein determining the current interface drawing completion time of the current synchronization cycle and determining the next synchronization signal arrival time of the next synchronization cycle are preceded by:
acquiring the execution times of animation callback in the current synchronization period;
and if the execution times are less than the preset times, executing the steps of determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period.
4. The method according to any one of claims 1-3, wherein the starting of the animation callback of the next synchronization cycle in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and the executing of the interface drawing of the next synchronization cycle after the animation callback is completed, comprises:
in a current synchronization period, acquiring a first working duration corresponding to animation callback of the current synchronization period, and acquiring a second working duration corresponding to current interface drawing of the current synchronization period;
calculating the sum of the first working time length and the second working time length, and determining the idle time between the drawing completion time of the current interface and the arrival time of the next synchronization signal based on the total time length of the current synchronization period and the sum;
and starting to execute the animation callback of the next synchronization cycle in the idle time, and executing the interface drawing of the next synchronization cycle after the animation callback is finished.
5. The method of any of claims 1-3, wherein performing the interface rendering for the next synchronization cycle after the animation callback is complete comprises:
starting to execute the interface drawing of the next synchronization cycle within the idle time and after the animation callback of the next synchronization cycle is completed;
or the like, or a combination thereof,
the animation callback of the next synchronization cycle is completed in the idle time, and in the next synchronization cycle, when a next synchronization signal of the next synchronization cycle arrives, the interface drawing of the next synchronization cycle is executed;
or the like, or, alternatively,
and starting to execute the interface drawing of the next synchronization cycle in the next synchronization cycle and after the animation callback of the next synchronization cycle is completed.
6. The method of claim 5, further comprising, during the idle time and after the animation callback of the next synchronization cycle is completed, starting to perform the interface drawing of the next synchronization cycle:
determining the interface drawing completion time of the next synchronization period in the idle time;
determining the remaining idle time between the interface drawing completion time and the next synchronization signal arrival time;
and if the duration of the remaining idle time is longer than the preset duration, starting to execute the animation callback of the adjacent synchronization cycle after the next synchronization cycle in the remaining idle time, and executing the interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
7. The method of claim 6, further comprising:
and if the duration of the remaining idle time is less than or equal to a preset duration, starting to execute an animation callback of an adjacent synchronization cycle after the next synchronization cycle in the next synchronization cycle, and executing interface drawing of the adjacent synchronization cycle after the animation callback of the adjacent synchronization cycle is executed.
8. A picture drawing apparatus, characterized in that the apparatus comprises:
the time determining module is used for determining the current interface drawing completion time of the current synchronization period and determining the next synchronization signal arrival time of the next synchronization period;
and the picture drawing module is used for starting to execute the animation callback of the next synchronization cycle in the idle time between the current interface drawing completion time and the next synchronization signal arrival time, and executing the interface drawing of the next synchronization cycle after the animation callback is completed.
9. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to carry out the method steps according to any one of claims 1 to 7.
10. A terminal, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method steps of any of claims 1 to 7.
CN202210169858.5A 2022-02-23 2022-02-23 Picture drawing method, device, storage medium and terminal Pending CN114610255A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210169858.5A CN114610255A (en) 2022-02-23 2022-02-23 Picture drawing method, device, storage medium and terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210169858.5A CN114610255A (en) 2022-02-23 2022-02-23 Picture drawing method, device, storage medium and terminal

Publications (1)

Publication Number Publication Date
CN114610255A true CN114610255A (en) 2022-06-10

Family

ID=81859470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210169858.5A Pending CN114610255A (en) 2022-02-23 2022-02-23 Picture drawing method, device, storage medium and terminal

Country Status (1)

Country Link
CN (1) CN114610255A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115690269A (en) * 2022-10-31 2023-02-03 荣耀终端有限公司 View object processing method and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115690269A (en) * 2022-10-31 2023-02-03 荣耀终端有限公司 View object processing method and electronic equipment
CN115690269B (en) * 2022-10-31 2023-11-07 荣耀终端有限公司 View object processing method and electronic equipment

Similar Documents

Publication Publication Date Title
CN109408223B (en) Resource allocation method, device, terminal and storage medium
CN110209501B (en) Frequency adjusting method and device of graphic processor, terminal and storage medium
CN109992232B (en) Image updating method, device, terminal and storage medium
CN107102936B (en) Fluency evaluation method, mobile terminal and storage medium
CN110018874B (en) Vertical synchronization method, device, terminal and storage medium
CN112422873B (en) Frame insertion method and device, electronic equipment and storage medium
CN109542614B (en) Resource allocation method, device, terminal and storage medium
CN107770618B (en) Image processing method, device and storage medium
WO2018000372A1 (en) Picture display method and terminal
JPWO2008105092A1 (en) Graphics drawing apparatus and graphics drawing method
CN111432262B (en) Page video rendering method and device
CN110018759B (en) Interface display method, device, terminal and storage medium
CN111064863B (en) Image data processing method and related device
US9875517B2 (en) Data processing method, data processing apparatus, and storage medium
CN113781949B (en) Image display method, display driving chip, display screen module and terminal
CN111813490A (en) Method and device for processing interpolation frame
CN106407003A (en) Screen interface display method and system
CN114610255A (en) Picture drawing method, device, storage medium and terminal
CN113672184A (en) Screen expansion method and device, terminal equipment and computer readable storage medium
CN108769815A (en) Method for processing video frequency and its device
CN109509139B (en) Vertex data processing method, device and equipment
CN115079977A (en) Interface drawing method and device, electronic equipment and storage medium
CN113038050B (en) Split screen display control method and device, terminal equipment and storage medium
US7999814B2 (en) Information processing apparatus, graphics processor, control processor and information processing methods
WO2023005042A1 (en) Image rendering method, apparatus, device, and computer-readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination