Image processing method and electronic device
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HONOR DEVICE CO LTD
- Filing Date
- 2024-10-23
- Publication Date
- 2026-06-23
AI Technical Summary
Electronic devices suffer from wasted rendering resources and increased power consumption when drawing and rendering images. In particular, when the application display interface changes, the existing technology calculates an excessively large dirty area for window rendering, causing the entire display window to be redrawn.
By obtaining the property information of the control, the corresponding dirty drawing area of the control is determined, and these dirty areas are merged to form an accurate window rendering dirty area for rendering, thereby reducing unnecessary waste of drawing resources.
It effectively reduces the waste of rendering resources and power consumption of electronic devices, and improves the efficiency and energy saving of rendering.
Smart Images

Figure CN122270748A_ABST
Abstract
Description
Image processing methods and electronic devices Technical Field
[0001] This application relates to the field of electronic technology, specifically to an image processing method and an electronic device. Background Technology
[0002] Currently, various applications (APPs) can be installed on electronic devices. Each application can display different image interfaces. At the same time, the image interfaces displayed by the applications are constantly changing, which requires electronic devices to draw and render different images.
[0003] In related technologies, when applications draw and render images, it can cause problems such as wasted drawing resources and increased power consumption in electronic devices.
[0004] Summary of the Invention
[0005] This application provides an image processing method and an electronic device that can reduce the waste of rendering resources in electronic devices and reduce power consumption.
[0006] In a first aspect, this application provides an image processing method executed by an electronic device, comprising: acquiring a first drawing rendering instruction corresponding to an i-th frame image, wherein the i-th frame image includes N controls, and the first drawing rendering instruction carries drawing parameters corresponding to the N controls, i≥1, N≥1; when the acquired control attribute information is first information, determining drawing dirty regions corresponding to the N controls according to the drawing parameters corresponding to the N controls respectively, wherein the size of the drawing dirty region corresponding to any one of the N controls is smaller than the size of the display window of the electronic device; merging the drawing dirty regions corresponding to the N controls to obtain a window rendering dirty region; and drawing and rendering the i-th frame image based on the window rendering dirty region.
[0007] In this implementation, the i-th frame image can be any frame image that the electronic device wants to display, such as a frame image from a video. This i-th frame image can include N controls. Therefore, when the electronic device renders the i-th frame image, it needs to render these N controls accordingly. Typically, when rendering controls, the electronic device can obtain control attribute information (also called the first attribute) and render the controls based on this attribute information. In this application, when the control attribute information is the first information (or the first value), the electronic device can determine the corresponding dirty rendering area based on the drawing parameters corresponding to the N controls, instead of directly using the entire display window as the window rendering dirty area. That is, the electronic device will determine the accurate window rendering dirty area for rendering, thereby reducing the waste of rendering resources and lowering power consumption compared to rendering the entire display window.
[0008] For example, the control attribute information can be CLIP_TO_BOUNDS. When this attribute information is the first information, the electronic device will retain and display content that exceeds the preset control layout boundary. That is, if the control is too large, the final displayed content may exceed the control layout boundary. Related technologies will directly render the entire display window as a dirty area for this scenario, which obviously wastes the drawing resources of the electronic device. However, in this application, the corresponding dirty area is accurately determined according to the drawing parameters of the control, reducing the waste of drawing resources. For example, the first information can be False.
[0009] In one implementation, the CLIP_TO_BOUNDS attribute information can be information carried in the first drawing / rendering instruction, or it can be preset information. That is, it can be information carried in the drawing / rendering execution issued by the electronic device, or it can be default information set in the drawing / rendering framework.
[0010] In conjunction with the first aspect, in some implementations of the first aspect, the above-mentioned determination of the drawing dirty regions corresponding to the N controls based on the drawing parameters corresponding to the N controls includes: determining the drawing dirty region corresponding to the first control based on the drawing parameters corresponding to the first control, wherein the first control is any one of the N controls;
[0011] The above-mentioned determination of the drawing dirty area corresponding to the first control based on the drawing parameters of the first control includes: determining the drawing dirty area corresponding to the first control based on the pen type and drawing method of the first control.
[0012] In other words, when the i-th frame of the image includes N controls, the electronic device can calculate the dirty drawing area for each control separately, that is, determine the dirty drawing area of the first control based on the drawing parameters corresponding to any first control. When determining the dirty drawing area of the first control, the electronic device can determine it based on the pen type and drawing method corresponding to the first control, giving full consideration to the various drawing parameters of the first control, so as to more accurately determine the corresponding dirty drawing area.
[0013] In conjunction with the first aspect, in some implementations of the first aspect, the above-mentioned determination of the drawing dirty region corresponding to the first control based on the pen type and drawing method includes:
[0014] If the brush type corresponding to the first control is the first type, and the drawing method corresponding to the first control includes the first preset effect, then the drawing dirty area corresponding to the first control is determined according to the first preset effect. The first type represents the brush type that only fills the inside of the control. The first preset effect includes at least one of the following effects: blur effect, path effect, image effect, and border effect.
[0015] If the pen type corresponding to the first control is the first type, and the drawing method corresponding to the first control does not include the first preset effect, then the control layout boundary corresponding to the preset first control will be used as the drawing dirty area corresponding to the first control.
[0016] If the pen type corresponding to the first control is not the first type, then the drawing dirty area corresponding to the first control is determined according to the first preset effect included in the drawing method corresponding to the first control.
[0017] In this implementation, the electronic device can consider different pen types and drawing methods, determining the drawing dirty area corresponding to the first control in different ways under different circumstances. When the pen type is the first type (e.g., kFill_Style), since its representation only fills the inside of the control, the electronic device needs to determine whether the drawing method of the first control includes the first preset effect. If it includes the first preset effect, the drawing dirty area corresponding to the first control can be determined based on the first preset effect. If it does not include the first preset effect, it is highly likely that the drawing will not exceed the control layout boundary, so the control layout boundary corresponding to the first control can be used as the drawing dirty area corresponding to the first control. When the pen type is not the first type (e.g., it could be Stroke_Style or kFill_and_Stroke_Style), the representation requires stroking the first control. Since stroking is involved, it is equivalent to including the border effect in the first preset effect, so the electronic device can determine the drawing dirty area corresponding to the first control based on the first preset effect. Therefore, the electronic device can determine the drawing dirty area in different scenarios to accurately identify the corresponding drawing dirty area and reduce the waste of drawing resources.
[0018] In conjunction with the first aspect, in some implementations of the first aspect, where the drawing method corresponding to the first control also includes a second preset effect, the above method further includes: determining the drawing area corresponding to the second preset effect, wherein the second preset effect includes a shadow effect; merging the drawing area corresponding to the second preset effect into the drawing dirty area corresponding to the first control.
[0019] Since the shadow effect is an extra (or added) area relative to the original image or control, if the drawing method corresponding to the first control includes the shadow effect, the electronic device can calculate the drawing area corresponding to the shadow effect separately, and finally merge the drawing area corresponding to the shadow effect into the above-calculated dirty drawing area to determine the final dirty drawing area of the first control, thereby further improving the accuracy of the calculated dirty drawing area.
[0020] In conjunction with the first aspect, in some implementations of the first aspect, determining the drawing dirty region corresponding to the first control based on the drawing parameters of the first control includes: if the drawing method corresponding to the first control includes a preset drawing method, and there is a function interface for calculating the drawing area based on the preset drawing method, then the drawing dirty region corresponding to the first control is determined based on the drawing parameters of the first control.
[0021] In some implementations, the preset drawing methods include image effects and / or path effects. Since the corresponding function calls for drawing image effects and / or path effects can provide a function interface for the drawing area, allowing for rapid calculation of the drawing area, the electronic device can execute the subsequent process of determining the drawing dirty area if such a function interface is available. When calculating the drawing dirty area corresponding to the image effect and / or path effect, the function interface can be called for rapid calculation. This improves the efficiency of drawing and rendering.
[0022] In conjunction with the first aspect, in some implementations of the first aspect, the above method also includes: when the control property information is not the first information, the drawing dirty areas corresponding to the N controls are respectively the control layout boundaries corresponding to the N controls.
[0023] When the control property information is set to the first information (or the first value), it means that the electronic device will clip content that exceeds the preset control layout boundary. Even if the control is too large, it will be clipped to the set control layout boundary, so the final displayed content will not exceed the control layout boundary. In this case, the electronic device can directly use the control layout boundary corresponding to the control as the corresponding drawing dirty area to reduce the recalculation process and improve the efficiency of drawing and rendering.
[0024] In conjunction with the first aspect, in some implementations of the first aspect, the above method further includes: synthesizing the i-th frame image and performing display processing.
[0025] In the case of the electronic device compositing and displaying the i-th frame image, since the actual drawing dirty area corresponding to each control has been calculated above, only the part of the drawing dirty area can be composited, which also reduces the waste of other processing resources and reduces power consumption.
[0026] Secondly, this application provides an apparatus included in an electronic device, which has the function of implementing the behaviors of the electronic device in the first aspect and possible implementations thereof. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above-described functions. For example, a receiving module or unit, a processing module or unit, etc.
[0027] Thirdly, this application provides an electronic device, which includes: one or more processors, and a memory;
[0028] The memory is coupled to the one or more processors, and the memory is used to store computer program code, the computer program code including computer instructions, which the one or more processors call to cause the electronic device to perform any one of the methods of the first aspect of the technical solution.
[0029] Fourthly, this application provides a chip system applied to an electronic device, the chip system including one or more processors, the one or more processors being configured to invoke computer instructions to cause the electronic device to perform the methods in the first aspect and any possible implementation thereof.
[0030] Optionally, the chip system also includes a memory, which is connected to the processor via circuitry or wires.
[0031] Alternatively, the chip system may also include a communication interface.
[0032] Fifthly, this application provides a computer-readable storage medium including instructions that, when executed on an electronic device, cause the electronic device to perform any one of the methods in the first aspect of the technical solution.
[0033] Sixthly, this application provides a computer program product, which includes computer program code that, when executed on an electronic device, causes the electronic device to perform any one of the methods in the first aspect of the technical solution. Attached Figure Description
[0034] Figure 1 is a schematic diagram of how a control is drawn when its property is set to True, as provided by related technologies.
[0035] Figure 2 is a schematic diagram of how a control is drawn when its property is set to False, provided by related technologies.
[0036] Figure 3 is a schematic diagram of a specific window rendering dirty area provided by related technologies;
[0037] Figure 4 is a schematic diagram of an example of refreshing a display window provided by related technologies;
[0038] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0039] Figure 6 is a schematic diagram of the system architecture of an electronic device provided in an embodiment of this application;
[0040] Figure 7 is a schematic diagram of a drawing scenario where the drawing of a control may exceed the control layout boundary, as provided in an embodiment of this application.
[0041] Figure 8 is a flowchart illustrating an example of an image processing method provided in an embodiment of this application;
[0042] Figure 9 is a schematic diagram of a defined dirty region in window rendering provided in an embodiment of this application;
[0043] Figure 10 is a flowchart illustrating another example of an image processing method provided in an embodiment of this application;
[0044] Figure 11 is a schematic flowchart of another example of an image processing method provided in an embodiment of this application;
[0045] Figure 12 is a schematic diagram of an example of refreshing a display window provided in an embodiment of this application. Detailed Implementation
[0046] The technical solutions of the embodiments of this application will be described below with reference to the accompanying drawings. In the description of the embodiments of this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B; "and / or" in this text is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Furthermore, in the description of the embodiments of this application, "multiple" refers to two or more than two.
[0047] Hereinafter, the terms "first," "second," and "third" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include one or more of that feature.
[0048] Currently, various applications can be installed on electronic devices, such as video applications, game applications, and social applications, each displaying different graphical interfaces. Furthermore, the graphical interfaces displayed by these applications are constantly changing. For example, the video images displayed by video applications change as the video playback progresses, requiring the electronic device to render and draw these different images.
[0049] Taking an electronic device running the Android system as an example, the device can use the hardware accelerated rendering engine for UI (HWUI) of the Android system to process image drawing and rendering instructions. The main function of HWUI is to use the graphics processing unit (GPU) to accelerate the rendering process of the user interface (UI), thereby improving rendering efficiency and smoothness. When the application issues drawing and rendering instructions (or tasks), HWUI can calculate the dirty area of window rendering according to the instructions, and the GPU will then draw and render the dirty area of window rendering.
[0050] Here, "dirty window rendering" refers to the process where, during image rendering, only the areas of the image that have changed need to be redrawn in each frame, instead of a full screen refresh. This technique saves rendering resources by only drawing the changed parts, thereby improving rendering performance.
[0051] However, in some scenarios, the dirty area of window rendering calculated by HWUI can be too large, that is, larger than the actual area that needs to be redrawn due to changes. More seriously, when the image interface displayed by the application undergoes local changes, the electronic device usually needs to redraw the image of the entire display window. In other words, the dirty area of window rendering calculated by HWUI is the entire display window, which leads to a waste of the electronic device's rendering resources and an increase in power consumption.
[0052] For example, the graphical interface displayed by an application may include multiple controls, each with a set control layout boundary. Changes in the state of the controls trigger a redraw of the graphical interface. Generally, controls are drawn within their layout boundaries. However, when the application issues a rendering command (or task), the command may include some control attributes, such as the control attribute CLIP_TO_BOUNDS. When this attribute is False, it indicates that content exceeding the control layout boundary will be preserved and displayed (i.e., not clipped). If the control is too large, the final size of the drawn control may exceed the set control layout boundary. In this case, when HWUI calculates the dirty area of window rendering, it sets the dirty area corresponding to the control to the entire display window. The GPU then needs to redraw the entire display window, but in reality, only the area where the control is located changes; other areas of the image remain unchanged. Redrawing the entire display window significantly increases the waste of rendering resources.
[0053] For example, if the application's rendering instructions include the control property CLIP_TO_BOUNDS, and CLIP_TO_BOUNDS is True, content exceeding the control layout boundary will be clipped. Therefore, the final drawn control size will not exceed the set control layout boundary, even if the control size is too large. As shown in Figure 1, assuming the set control layout boundary is rectangle a, if control b is too large (e.g., exceeding the boundary of rectangle a), the electronic device can clip control b to within rectangle a. In this case, the dirty drawing area corresponding to control b is the area where rectangle a is located. If CLIP_TO_BOUNDS is False, content exceeding the control layout boundary will be retained and displayed, and the final drawn control size may exceed the set control layout boundary. As shown in Figure 2, assuming the set control layout boundary is rectangle c, if control d is too large, the electronic device will draw control d beyond rectangle c. In this case, the dirty drawing area corresponding to control d is the entire display window.
[0054] Taking a video application as an example, as shown in Figure 3, suppose that at a certain moment, the area on the image interface displayed by the application that changes is the area where the progress bar control is located. The control layout boundary corresponding to the progress bar control is rectangle A (shown by the white line). However, because the progress bar control is drawn with a thick stroke, the stroke exceeds the boundary of rectangle A. Furthermore, the value of CLIP_TO_BOUNDS in the drawing and rendering instructions issued by the application is False, which causes the electronic device to determine the entire display window B as the dirty area of window rendering.
[0055] Furthermore, when the dirty region for window rendering calculated by HWUI is too large, for example, if the calculated dirty region is the entire display window, after the GPU renders the entire display window, the data processing unit (DPU) of the electronic device also needs to synthesize the content finally displayed by the electronic device, as well as the content displayed on the screen. This also leads to a waste of processing resources and an increase in power consumption of the electronic device. For example, as shown in Figure 4, when HWUI calculates that the dirty region for window rendering is the entire display window, the GPU needs to render the entire display window. Since the application's display interface may consist of multiple windows (or layers), the DPU needs to synthesize multiple windows to refresh the entire display window. Finally, the DPU will transmit the data of the display window to the display screen for refresh and display.
[0056] In view of this, when the value of the control attribute CLIP_TO_BOUNDS is False, this application provides an image rendering method that enables the electronic device to calculate the actual control area that needs to be drawn, thereby determining the accurate window rendering dirty area for rendering, reducing the waste of rendering resources of the electronic device, and reducing power consumption. It should be noted that the image rendering method provided in this application can be applied to electronic devices with rendering functions, such as mobile phones, tablets, wearable devices, in-vehicle devices, augmented reality (AR) / virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPCs), netbooks, and personal digital assistants (PDAs). This application does not impose any restrictions on the specific type of electronic device.
[0057] For example, FIG5 is a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application. The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, buttons 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identity module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an accelerometer sensor 180E, a distance sensor 180F, a proximity sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0058] Processor 110 may include one or more processing units, such as: application processor (AP), modem processor, GPU, image signal processor (ISP), controller, memory, video codec, audio digital signal processor (ADSP), baseband processor, and / or neural network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.
[0059] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to the instruction opcode and timing signals to complete the control of fetching and executing instructions.
[0060] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0061] In some embodiments, the processor 110 may include one or more interfaces. Interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0062] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.
[0063] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.
[0064] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.
[0065] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.
[0066] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.
[0067] Internal memory 121 can be used to store computer executable program code, which includes instructions. Processor 110 executes various functional applications and data processing of electronic device 100 by running the instructions stored in internal memory 121. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc.
[0068] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.
[0069] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0070] Based on the structure shown in Figure 5, in order to implement the image rendering method of this application embodiment, the electronic device can also be divided into system architectures, as shown in Figure 6. The electronic device may include hardware such as AP processor, ADSP processor, GPU and display screen.
[0071] The AP processor is the main processor, responsible for the main data processing flow in the electronic device, such as controlling the working status and display content of hardware like the display screen. The GPU is used for image rendering according to the instructions of the AP processor. The ADSP processor can communicate with hardware such as sensors (not shown in the figure). Sensors can transmit sensor data to the ADSP processor, which then sends the sensor data to the AP processor for processing.
[0072] AP processors can deploy layered software architectures, event-driven architectures, microkernel architectures, microservice architectures, or cloud architectures. Taking the layered architecture of the Android system as an example, a layered architecture divides the software into several layers, each with a clear role and division of labor. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0073] The application layer can include a series of application packages. As shown in Figure 6, application packages can include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS, and can also include HWUI. HWUI can utilize GPU hardware to draw the interface and handle the UI rendering operations of each application.
[0074] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0075] As shown in Figure 6, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.
[0076] The window manager manages window programs. It can obtain screen size, determine the presence of a status bar, lock the screen, and capture screenshots. The content provider stores and retrieves data, making it accessible to applications. Data can include video, images, audio, made and received calls, browsing history and bookmarks, phone books, etc. The view system includes visual controls, such as controls for displaying text and controls for displaying images. The view system can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon can include views for displaying text and views for displaying images. The phone manager provides communication functionality for the electronic device 100. For example, it manages call status (including connection, hang-up, etc.). The resource manager provides applications with various resources, such as localized strings, icons, images, layout files, video files, etc. The notification manager allows applications to display notification information in the status bar. It can be used to convey informational messages and can disappear automatically after a short pause without user interaction. For example, the notification manager is used to notify of download completion, message alerts, etc. The notification manager can also display notifications as icons or scrolling text in the system's top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting alert sounds, causing electronic devices to vibrate, and flashing indicator lights.
[0077] The Android runtime consists of core libraries and a virtual machine. The Android runtime is responsible for scheduling and managing the Android system.
[0078] The core library consists of two parts: one part is the functionalities that need to be called by the Java language, and the other part is the Android core library.
[0079] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0080] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.
[0081] The Surface Manager manages the display subsystem and provides fusion of 2D and 3D layers for multiple applications. The Media Library supports playback and recording of various common audio and video formats, as well as still image files. The Media Library supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG. The 3D Graphics Processing Library implements 3D graphics drawing, image rendering, compositing, and layer processing. The 2D Graphics Engine is the drawing engine for 2D graphics.
[0082] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.
[0083] For ease of understanding, the following embodiments of this application will take an electronic device with the structure shown in Figures 5 and 6 as an example, and, in conjunction with the accompanying drawings and application scenarios, specifically illustrate the image rendering method provided in the embodiments of this application.
[0084] As described above, if the application issues a drawing and rendering command with the control property CLIP_TO_BOUNDS set to False, content exceeding the set control layout boundaries will be preserved. Therefore, if the control is too large, the final drawn control size may exceed the set control layout boundaries. We will first analyze scenarios where the control might exceed the control layout boundaries during drawing, and then calculate the actual drawing area for these scenarios. Based on research and analysis, as shown in Figure 7, the following five types of drawing scenarios (or drawing effects) may cause the control to exceed the control layout boundaries during drawing:
[0085] The first type: Setting a blur effect using MaskFilter
[0086] As shown in Figure 7(a), blurring or filtering the image creates a blurred effect. Typically, the Android HWUI framework offers two effects: BlurMaskFilter and EmbossMaskFilter. BlurMaskFilter specifies a blur style and radius value to blur the edges of the image, making the target area indistinct. EmbossMaskFilter specifies the direction of the light source and the ambient light intensity to add an embossing effect, creating a raised watermark pattern on the target area.
[0087] For example, when a blur effect is set, the edges of the control may be drawn beyond the set control layout boundaries.
[0088] The second type: Setting the path effect (PathEffect)
[0089] As shown in Figure 7(b), PathEffect is used to set the path style (outline of the line) when drawing geometry, so that the path between each pixel in the image has effects such as discrete, dashed lines, and angles.
[0090] For example, when setting path effects, drawing the control edges may exceed the set control layout boundaries.
[0091] The third type: Setting image effects (ImageFilter)
[0092] As shown in Figure 7(c), ImageFilter mainly includes filtering processes such as smoothing, sharpening, and edge enhancement of images, as well as implementing various image filter effects, such as brightness adjustment, contrast adjustment, and saturation adjustment.
[0093] For example, when setting image effects, the control may extend beyond the set control layout boundaries on one side or another when drawing the control.
[0094] The fourth type: Setting a border effect (Stroke)
[0095] As shown in Figure 7(d), Stroke is a technique for drawing borders. It can be used to draw borders of custom shapes and allows you to set the outline, thickness, style, etc. of the pen when drawing borders.
[0096] For example, when Stroke is set, if the brush is set to be thick, it may exceed the set control layout boundary when drawing the edge of the control.
[0097] Fifth type: Setting shadow effects
[0098] As shown in Figure 7(e), a shadow can be achieved by drawing a shadow image below the image that has the same or similar shape but a different size. The color, offset, and blur of the shadow image can be adjusted through attributes.
[0099] For example, when setting a shadow effect, the side on which the shadow of the control is drawn may extend beyond the set control layout boundary.
[0100] Therefore, based on the above five types of drawing effects, when the drawing and rendering instructions are obtained, the embodiments of this application can calculate the actual control area that needs to be drawn, so as to determine the accurate window rendering dirty area for rendering and drawing, thereby reducing the waste of drawing resources of electronic devices.
[0101] Figure 8 is a flowchart illustrating an example image rendering method provided in an embodiment of this application. This method is executed by an electronic device and may include steps S11-S17:
[0102] S11, obtain drawing and rendering instructions.
[0103] Among them, the drawing and rendering instructions can be instructions issued by the application. For example, when the application is a video application, the video application will issue drawing and rendering instructions to draw the video interface to be displayed in real time.
[0104] In one implementation, the drawing rendering instruction can carry information such as drawing content, drawing method, and drawing attributes. For example, the drawing content can include the image, control, etc., the drawing method can include whether the above five effects need to be drawn, such as whether shadows need to be drawn, or whether blur effects need to be set, as well as other possible drawing methods, etc. The drawing attributes can include, but are not limited to, the CLIP_TO_BOUNDS attribute mentioned above.
[0105] S12, determine the value of the first attribute according to the drawing and rendering instructions.
[0106] S13, determine if the value of the first attribute is the first value. If not, execute S14; if so, execute S15.
[0107] The first attribute can be a drawing attribute carried in the drawing and rendering instructions. It indicates whether content exceeding the control layout boundaries will be clipped, and correspondingly, it can infer whether the final drawn control size will exceed the set control layout boundaries. If the first attribute is set to the first value, it means that if the control is too large, the drawn control size may exceed the set control layout boundaries. If the first attribute is not set to the first value, it means that the drawn control size will not exceed the set control layout boundaries. Alternatively, the first attribute can also be an attribute set by the electronic device's own rendering framework; that is, the rendering framework can set the first attribute to either the first value or a value other than the first value.
[0108] For example, the first attribute is the CLIP_TO_BOUNDS attribute, and the first value is False. That is, when the value of CLIP_TO_BOUNDS is False, it indicates that the size of the drawn control may exceed the set control layout boundary. When the value of CLIP_TO_BOUNDS is not False, it indicates that the size of the drawn control will not exceed the set control layout boundary.
[0109] S14, determine the first area as the window rendering dirty area, and draw and render the first area.
[0110] In other words, if the electronic device determines that the value of the first attribute is not the first value, since the size of the drawn control will not exceed the set control layout boundary, the first area can be determined as the window rendering dirty area, and subsequent drawing and rendering of the first area can be performed.
[0111] In one implementation, the first region can be a region bounded by the control layout boundaries. It can be understood that when the drawing content carried in the drawing and rendering instructions includes multiple controls, the first regions corresponding to each control can be merged together as the window rendering dirty area.
[0112] S15, traverse the control tree and determine the drawing dirty area corresponding to each control.
[0113] S16, merge the drawing dirty areas corresponding to each control into a window rendering dirty area and a drawing rendering window rendering dirty area.
[0114] In other words, when the electronic device determines that the value of the first attribute is the first value, since the size of the drawn control may exceed the set control layout boundary, the electronic device can calculate the actual control area that needs to be drawn (i.e., the drawing dirty area corresponding to the control) separately, instead of directly using the entire display window as the window rendering dirty area as in related technologies. Here, the actual control area that needs to be drawn calculated by the electronic device is likely smaller than the size of the entire display window, meaning that it is not necessary to draw the entire display window. Then, the drawing dirty areas corresponding to each control are merged to obtain the window rendering dirty area.
[0115] The control tree that the electronic device needs to traverse can be the drawing content carried in the aforementioned drawing and rendering instructions, that is, the drawing and rendering instructions indicate which controls need to be drawn. In one implementation, the aforementioned drawing and rendering instructions can include a control drawing instruction queue (DisplayList), where each drawing instruction in the queue is used to instruct the drawing of a control. Therefore, the electronic device can retrieve a drawing instruction at a time, determine the drawing dirty region corresponding to the control to be drawn by the drawing instruction, and finally merge the drawing dirty regions corresponding to each control.
[0116] For example, as shown in Figure 9, assuming that after traversing the control tree, the controls to be drawn include three controls A, B, and C, the electronic device calculates the drawing dirty regions corresponding to the three controls A, B, and C as Q1, Q2, and Q3 respectively. Then, the window rendering dirty region is the area that combines Q1, Q2, and Q3.
[0117] S17, composite the rendered content and send it to the display.
[0118] In other words, after the first area is drawn and rendered in S14, or the dirty area is drawn and rendered in S16, the electronic device will subsequently composite the drawn and rendered content and send it to the display screen to refresh the image interface displayed on the screen.
[0119] As can be seen from the description in Figure 7 above, in scenarios where the size of the drawn control may exceed the set control layout boundary, it may be due to at least one of the following effects: setting a blur effect, setting a path effect, setting an image effect, setting a Stroke effect, or setting a shadow effect. Therefore, when calculating the drawing dirty area corresponding to each control, the electronic device needs to determine which effect is set for each control, and then calculate the drawing dirty area corresponding to the control according to the specific scenario, so as to improve the accuracy of the calculated window rendering dirty area.
[0120] Therefore, as shown in Figure 10, the above step "S15, traverse the control tree and determine the drawing dirty area corresponding to each control" can include the following implementation process of S21-S27:
[0121] S21, traverse the control tree according to the drawing and rendering instructions to obtain the drawing method of the first control.
[0122] The drawing method of the first control can include setting effects for the first control. This information can be carried in the drawing and rendering instructions. For example, the drawing method includes whether to draw the five effects mentioned above. It can be understood that the first control can be any control in the control tree. During the traversal, the first control can be used as the first control first, then the second control can be used as the first control, and so on.
[0123] S22, if the drawing method of the first control includes the need to draw a shadow effect, determine the shadow drawing area.
[0124] Because the shadow effect is typically achieved by drawing a shadow image below the image that has the same or similar shape but a different size, this shadow image is an extra area relative to the original image. Therefore, the electronic device can calculate the shadow drawing area W1 separately. Optionally, the shadow effect can be referred to as a second preset effect.
[0125] In one implementation, the electronic device may use any of the following methods to determine the shadow drawing area W1: shadow mapping, shadow volumes, ray tracing, and screen space shadows.
[0126] In another implementation, the electronic device can estimate the shadow drawing area W1 based on information about the first control (e.g., width and height, position, etc.). For example, assuming the size of the first control is width × height, and estimation coefficients m and n are set, the electronic device can calculate the size of the shadow drawing area based on an expression containing m × width × n and m × height × n. Simultaneously, the position of the shadow drawing area can also be estimated based on the position of the first control. For instance, the direction of the shadow relative to the first control can be determined based on its drawing method, and then the position of the shadow drawing area can be determined in the corresponding direction of the first control.
[0127] S23, determine whether the drawing method of the first control includes the preset drawing method. If yes, execute S24; otherwise, execute S25.
[0128] In some implementations, the preset drawing method can be to draw image effects and / or path effects. Since the functions corresponding to these two effects can provide a calculation interface (function interface) to quickly calculate the drawing area, if the drawing method of the first control includes drawing image effects and / or path effects, the electronic device can further execute S24 to determine whether the drawing area can be quickly calculated. If the drawing method of the first control does not include drawing image effects and path effects, the electronic device can directly execute S25 to start calculating the dirty drawing area corresponding to the first control.
[0129] S24, determine whether the drawing area can be quickly calculated. If yes, execute S25. Otherwise, determine that the dirty drawing area corresponding to the first control is the entire display window.
[0130] That is, if the drawing area can be quickly calculated for the image and / or path effects, i.e., the aforementioned calculation interface is provided, then proceed to step S25 to start calculating the dirty drawing area corresponding to the first control. However, if the drawing area cannot be quickly calculated, i.e., the aforementioned calculation interface is not provided, it means that the electronic device cannot currently calculate the drawing area, and can only temporarily set the dirty drawing area W2 corresponding to the first control as the entire display window.
[0131] S25, call the quick calculation drawing area interface to start calculating the drawing dirty area corresponding to the first control.
[0132] Here, the electronic device can call the fast calculation drawing area interface (such as the computeFastBounds interface) to enter the process of calculating the drawing dirty area corresponding to the first control.
[0133] S26. Determine the dirty drawing area corresponding to the first control based on the drawing parameters corresponding to the first control.
[0134] S27. Determine the final drawing dirty area of the first control based on the shadow drawing area and the drawing dirty area corresponding to the first control.
[0135] When calculating the dirty drawing area corresponding to the first control, since different controls may correspond to different drawing parameters—for example, some controls need to draw the aforementioned types of drawing effects, while others may not need any drawing effects—the electronic device can determine the corresponding dirty drawing area W2 based on the drawing parameters corresponding to the first control. Then, if the first control also has a shadow effect, the final dirty drawing area of the first control should be the result of merging the shadow drawing area W1 and the dirty drawing area W2.
[0136] It is understood that the process of determining the shadow drawing area in S22 can be executed synchronously with the process of determining the drawing dirty area in S23-S26, or they can be executed sequentially. This application embodiment does not limit this.
[0137] Through the above process, the electronic device can determine the drawing dirty area corresponding to each control, and then determine and draw the rendering window's rendering dirty area, as well as perform compositing and display. Therefore, by determining the actual control area that needs to be drawn for each control, and ultimately determining the accurate window rendering dirty area for rendering, the waste of drawing resources in the electronic device can be reduced, and power consumption can be lowered.
[0138] In some embodiments, the drawing parameters corresponding to the first control in S26 above may include parameters such as the set drawing effect and the type of pen used for drawing. The electronic device can then determine the corresponding dirty drawing area based on these parameters. Therefore, as shown in Figure 11, the steps S26-S27 above may include the following implementation processes S31-S34:
[0139] S31, determine whether the pen type used to draw on the first control is the first type. If yes, execute S32; otherwise, execute S33.
[0140] The pen type used to draw on the first control can be obtained from the aforementioned drawing and rendering instructions. The first type can represent a type that only fills the interior of the control, such as the kFill_Style type. When the pen type is the first type, because it involves filling the interior, the corresponding dirty drawing area may differ depending on whether the four types of drawing effects shown in Figure 7 are present (excluding shadow effects, as shadow effects have already been separately determined in S22) or not. Therefore, in this case, the electronic device can determine whether the four types of drawing effects are present in S32, and then determine the corresponding dirty drawing area based on the different determination results.
[0141] If the pen type used to draw on the first control is not the first type, for example, it could be of type Stroke_Style or kFill_and_Stroke_Style, representing the types of stroke-only, fill-only, and stroke respectively. Since stroke is involved here, this corresponds to the drawing effect of setting Stroke as shown in Figure 7 above. Therefore, in this case, the electronic device can directly proceed with the process in S33 of determining the drawing dirty area corresponding to the first control based on different drawing effects.
[0142] S32, determine whether the drawing method of the first control includes at least one of the following drawing effects: blur effect, path effect, image effect, and Stroke. If yes, execute S33; otherwise, determine that the drawing dirty area corresponding to the first control is the area where the control layout boundary is located.
[0143] In other words, if the drawing method of the first control does not include any of the four types of drawing effects mentioned above, meaning it is highly likely that the drawing will not exceed the control layout boundary, the electronic device can directly use the area where the control layout boundary is located as the drawing dirty area W2 corresponding to the first control. However, if the drawing method of the first control includes at least one of the four types of drawing effects, the electronic device needs to perform the process in S33 to determine the drawing dirty area corresponding to the first control based on different drawing effects. Optionally, the above-mentioned blur effect, path effect, image effect, and Stroke effect can also be collectively referred to as the first preset effect.
[0144] S33, determine the dirty drawing area corresponding to the first control based on the different drawing effects set.
[0145] When the drawing method of the first control includes at least one of the four types of drawing effects, the electronic device can calculate the drawing area corresponding to each drawing effect separately, and then merge the drawing areas corresponding to each drawing effect to obtain the drawing dirty area corresponding to the first control.
[0146] For example, when the drawing method of the first control includes setting Stroke, as can be seen from the effect of Figure (d) in Figure 7 above, the pen may exceed the set control layout boundary when drawing the edge of the control. Therefore, the electronic device can set the drawing dirty area 1 to a region that is slightly larger than the control layout boundary. For example, it can be enlarged by p%, which can be 10% or other sizes. That is, the drawing dirty area 1 is 10% larger than the region where the control layout boundary is located.
[0147] When the drawing method of the first control requires setting a blur effect, as can be seen from the effect in Figure 7(a) above, the image has been blurred or filtered. If the processing is performed through the BlurMaskFilter or EmbossMaskFilter blur mechanism, the electronic device can determine the blur area according to the blur radius set by BlurMaskFilter or EmbossMaskFilter, that is, obtain the corresponding drawing dirty area 2.
[0148] When the drawing method of the first control requires setting path effects, different path effects are provided by the PathEffect subclass, which provides different parameters to control the display of the effect. These parameters include radius, interval, phase, etc. By adjusting these parameters, the size of the path effect can be indirectly controlled, and the electronic device can determine the drawing dirty area 3 based on these parameters.
[0149] When the drawing method of the first control requires setting an image effect ImageFilter, since ImageFilter can also be called an image filter, it can include, but is not limited to, operations such as BLUR blur, CONTOUR outline, DETAIL detail, EDGE_ENHANCE edge enhancement, EMBOSS emboss, FIND_EDGES edge highlighting, SHARPEN sharpening, SMOOTH smoothing, SHARPEN blur, etc. The electronic device can determine the drawing dirty area 4 according to the parameters set for different operations.
[0150] Since the drawing methods of the first control may include at least one of the above four drawing effects, the dirty drawing area W2 corresponding to the first control determined by the electronic device should be the combined result of each drawing effect, that is, dirty drawing area W2 = (dirty drawing area 1) U (dirty drawing area 2) U (dirty drawing area 3) U (dirty drawing area 4). It can be understood that during the calculation of W2, if the first control's drawing methods do not include any drawing effect, the dirty drawing area corresponding to that effect can be empty. For example, assuming the first control's drawing methods include setting Stroke and ImageFilter, then W2 is (dirty drawing area 1) U (empty) U (empty) U (dirty drawing area 4).
[0151] S34. Determine the final drawing dirty area of the first control based on the shadow drawing area and the drawing dirty area corresponding to the first control.
[0152] As can be seen from the above S31-S33 process, the dirty drawing area W2 corresponding to the first control determined by the electronic device corresponds to different results under different judgment conditions. If the first control also corresponds to a shadow effect, then the final dirty drawing area of the first control should be the result of merging the shadow drawing area W1 and the dirty drawing area W2. For example, the final dirty drawing area W of the first control = (shadow drawing area W1) U (dirty drawing area W2).
[0153] After the above process, the electronic device determines the final drawing dirty area of the first control. After determining the final drawing dirty area of each control contained in the control tree, the drawing dirty areas corresponding to each control are merged to obtain the window rendering dirty area, and then the window rendering dirty area can be drawn and rendered.
[0154] In the above image rendering method, when the electronic device obtains the rendering instruction, it can traverse the control tree to determine the actual control area that needs to be drawn for each control, provided that the value of the first attribute is the first value. Finally, it can determine the accurate window rendering dirty area for rendering, thereby reducing the waste of rendering resources of the electronic device and reducing power consumption.
[0155] In some embodiments, the implementation process shown in Figures 8-11 above can be executed by the HWUI in the electronic device. That is, the HWUI can obtain the drawing and rendering instructions issued by the application, determine whether the value of the first attribute is a first value based on the drawing and rendering instructions, and then, if the value of the first attribute is not a first value, traverse the control tree, determine the drawing dirty region corresponding to each control, and merge the drawing dirty regions corresponding to each control as the window rendering dirty region. Finally, the HWUI can pass the determined window rendering dirty region to the GPU for drawing and rendering, and finally display it on the display screen.
[0156] Since the dirty window rendering region calculated by HWUI after the process shown in Figures 8-11 is likely the actual area that needs to be rendered, the content that the GPU needs to render can be only a part of the region, instead of the entire display window. Correspondingly, the DPU of the electronic device can only synthesize the actual rendered content and the content displayed on the screen, which reduces the waste of processing resources and power consumption of the electronic device. For example, as shown in Figure 12, when HWUI calculates that the dirty window rendering region is the actual area that needs to be rendered, such as a part of the area G at the bottom of the interface, including the area where the progress bar control is located and the area of the text control, the GPU can render only the content of part G. Then, the DPU synthesizes multiple windows, which is equivalent to only refreshing the content of part G. Finally, the DPU will transmit the data of part G to the display screen for refresh and display.
[0157] The foregoing has detailed examples of image rendering methods provided in the embodiments of this application. It is understood that, in order to achieve the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in conjunction with the embodiments, but such implementation should not be considered beyond the scope of this application.
[0158] This application embodiment can divide the electronic device into functional modules according to the above method example. For example, each function can be divided into a separate functional module, such as a detection unit, a processing unit, a display unit, etc., or two or more functions can be integrated into one module. The integrated module can be implemented in hardware or as a software functional module. It should be noted that the module division in this application embodiment is illustrative and only represents one logical functional division. In actual implementation, there may be other division methods.
[0159] It should be noted that all relevant content of each step involved in the above method embodiments can be referenced from the functional description of the corresponding functional module, and will not be repeated here.
[0160] The electronic device provided in this embodiment is used to execute the above-described image drawing and rendering method, and therefore can achieve the same effect as the above-described implementation method.
[0161] When using integrated units, the electronic device may further include a processing module, a storage module, and a communication module. The processing module is used to control and manage the operation of the electronic device. The storage module supports the execution of stored program code and data. The communication module supports communication between the electronic device and other devices.
[0162] The processing module can be a processor or a controller. It can implement or execute various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of a digital signal processor and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, or other devices that interact with other electronic devices.
[0163] In one embodiment, when the processing module is a processor and the storage module is a memory, the electronic device involved in this embodiment can be a device having the structure shown in FIG5.
[0164] This application also provides a computer-readable storage medium storing a computer program. When the computer program is executed by a processor, the processor performs the image rendering method of any of the above embodiments. The storage medium may include various media capable of storing program code, such as a USB flash drive, a portable hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0165] This application also provides a computer program product that, when run on a computer, causes the computer to perform the aforementioned steps to implement the image rendering method described in the above embodiments.
[0166] In addition, embodiments of this application also provide an apparatus, which may specifically be a chip, component or module. The apparatus may include a connected processor and a memory. The memory is used to store computer execution instructions. When the apparatus is running, the processor can execute the computer execution instructions stored in the memory to cause the chip to execute the image rendering methods in the above-described method embodiments.
[0167] In this embodiment, the electronic device, computer-readable storage medium, computer program product or chip are all used to execute the corresponding methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0168] Through the above description of the embodiments, those skilled in the art will understand that, for the sake of convenience and brevity, only the division of the above functional modules is used as an example. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0169] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0170] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. An image processing method, said method being executed by an electronic device, characterized in that, The method includes: Obtain the first drawing and rendering instruction corresponding to the i-th frame image, wherein the i-th frame image includes N controls, and the first drawing and rendering instruction carries the drawing parameters corresponding to the N controls, i≥1, N≥1; When the obtained control attribute information is the first information, the drawing dirty area corresponding to the N controls is determined according to the drawing parameters corresponding to the N controls respectively, wherein the size of the drawing dirty area corresponding to any one of the N controls is smaller than the size of the display window of the electronic device; The drawing dirty regions corresponding to the N controls are merged to obtain the window rendering dirty region; The i-th frame image is rendered based on the dirty area rendered by the window.
2. The method of claim 1, wherein, The step of determining the drawing dirty regions corresponding to the N controls based on their respective drawing parameters includes: Based on the drawing parameters corresponding to the first control, the drawing dirty area corresponding to the first control is determined, and the first control is any one of the N controls; The step of determining the dirty drawing region corresponding to the first control based on the drawing parameters corresponding to the first control includes: Based on the pen type and drawing method corresponding to the first control, determine the dirty drawing area corresponding to the first control.
3. The method of claim 2, wherein, The step of determining the dirty drawing area corresponding to the first control based on the pen type and drawing method corresponding to the first control includes: When the brush type corresponding to the first control is a first type and the drawing method corresponding to the first control includes a first preset effect, the drawing dirty area corresponding to the first control is determined according to the first preset effect. The first type represents a brush type that only fills the inside of the control. The first preset effect includes at least one of blur effect, path effect, image effect and border effect. When the pen type corresponding to the first control is the first type and the drawing method corresponding to the first control does not include the first preset effect, the preset control layout boundary corresponding to the first control is taken as the drawing dirty area corresponding to the first control. If the pen type corresponding to the first control is not the first type, the drawing dirty area corresponding to the first control is determined according to the first preset effect included in the drawing method corresponding to the first control.
4. The method according to claim 2 or 3, characterized in that, If the drawing method corresponding to the first control also includes a second preset effect, the method further includes: Determine the drawing area corresponding to the second preset effect, where the second preset effect includes a shadow effect; The drawing area corresponding to the second preset effect is merged into the drawing dirty area corresponding to the first control.
5. The method according to any one of claims 2 to 4, characterized in that, The step of determining the dirty drawing region corresponding to the first control based on the drawing parameters corresponding to the first control includes: If the drawing method corresponding to the first control includes a preset drawing method, and there is a function interface for calculating the drawing area based on the preset drawing method, then the drawing dirty area corresponding to the first control is determined according to the drawing parameters corresponding to the first control.
6. The method of claim 5, wherein, The preset drawing methods include image effects and / or path effects.
7. The method according to any one of claims 1 to 6, characterized in that, The control attribute information is CLIP_TO_BOUNDS attribute information, and the first information is False.
8. The method according to claim 7, characterized in that, The CLIP_TO_BOUNDS attribute information is either information carried in the first drawing and rendering instruction or preset information.
9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: If the control attribute information is not the first information, the drawing dirty areas corresponding to the N controls are respectively the control layout boundaries corresponding to the N controls.
10. The method according to any one of claims 1 to 9, characterized in that, The method further includes: The i-th frame image is synthesized and then sent for display.
11. An electronic device, characterized in that, The electronic device includes: One or more processors, and memory; The memory is coupled to the one or more processors, the memory being used to store computer program code, the computer program code including computer instructions, the one or more processors invoking the computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 10.
12. A chip system, characterized in that, The chip system is applied to an electronic device, the chip system including one or more processors, the one or more processors being used to invoke computer instructions to cause the electronic device to perform the method as described in any one of claims 1 to 10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes instructions that, when executed on an electronic device, cause the electronic device to perform the method as described in any one of claims 1 to 10.
14. A computer program product, characterized in that, The computer program product includes a computer program that, when run on an electronic device, causes the electronic device to perform the method as described in any one of claims 1 to 10.