Rendering node detection method and electronic device
By using a one-dimensional algorithm to detect occluded rendering nodes, the problem of processor load redundancy in electronic devices is solved, achieving more efficient graphics rendering smoothness and improved processor performance.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2025-11-05
- Publication Date
- 2026-07-09
AI Technical Summary
In existing technologies, electronic devices still generate drawing instructions for occluded rendering nodes during the graphics rendering process, resulting in redundant processor load and affecting smoothness and performance.
By obtaining the overlap information between the rectangular region and the scan line segment, a one-dimensional algorithm is used to detect occluded rendering nodes, reducing detection complexity and overhead, and generating drawing instructions only for unoccluded rendering nodes.
It effectively reduces the processor load, decreases the probability of stuttering and frame drops, and improves the smoothness of graphics rendering and detection efficiency.
Smart Images

Figure CN2025132691_09072026_PF_FP_ABST
Abstract
Description
Rendering node detection methods and electronic devices
[0001] This application claims priority to Chinese patent application filed on January 3, 2025, with application number 202510013306.9 and entitled "Rendering Node Detection Method and Electronic Device", the entire contents of which are incorporated herein by reference. Technical Field
[0002] This application relates to the field of electronic device technology, and in particular to a rendering node detection method and electronic device. Background Technology
[0003] With the development of electronic device technology, graphics rendering and display, as an important function of electronic devices, have brought users increasingly rich visual experiences. The operation of this function depends on the cooperation of the processor in the electronic device (such as the central processing unit (CPU) and graphics processing unit (GPU). Once the load brought by this function exceeds the processing capacity of the processor, it can easily cause various problems such as stuttering, frame drops, and choppy screens.
[0004] In reality, the graphical interface obtained through graphics rendering includes many rendering nodes, some of which may be occluded and invisible to the user. However, during the graphics rendering process, the electronic device's processor still generates drawing instructions for these invisible rendering nodes to render them, which places a significant redundant load on the processor. Therefore, detecting these occluded rendering nodes to avoid rendering them is crucial for reducing processor load and saving processor resources. Summary of the Invention
[0005] This application provides a rendering node detection method and electronic device, which can detect occluded rendering nodes, reduce the complexity and overhead of detection, and improve detection efficiency.
[0006] To achieve the above objectives, this application adopts the following technical solution:
[0007] Firstly, a rendering node detection method is provided, applied to an electronic device with a display screen. The method includes: acquiring a first rectangular region, which is one of M rectangular regions included in an image to be rendered, each of the M rectangular regions being used to draw a rendering node, where M is an integer greater than or equal to 1; determining K length units that overlap with the first rectangular region in each of X scan line segments, where the X scan line segments are the scan line segments corresponding to the M rectangular regions that overlap with the first rectangular region, where X and K are both integers greater than or equal to 1, and the scan line segments corresponding to the M rectangular regions are obtained based on two scan line segments obtained from each of the M rectangular regions, where the two scan line segments coincide with two parallel boundary lines included in the rectangular region. The electronic device can determine whether the rendering node corresponding to the first rectangular region is hidden based on first information corresponding to each of the K length units included in each of the X scan line segments.
[0008] Based on the above technical solution, for each rectangular region corresponding to a rendering node in the image to be rendered, the electronic device can determine each scan line segment that overlaps with the rectangular region. Then, based on the first information corresponding to the length unit that overlaps with the rectangular region in each scan line segment, it can determine whether the rendering node corresponding to the rectangular region is hidden. In this way, the electronic device only needs to detect the scan line segments that overlap with each rectangle. For an image to be rendered, the average number of scan line segments that overlap with each rectangular region in the image is a fixed value. Therefore, the algorithm complexity of the above detection scheme can satisfy a one-dimensional algorithm (a×c), where a represents the number of rectangular regions corresponding to all rendering nodes included in the graphical interface (i.e., an image to be rendered), and c represents the average number of scan line segments that overlap with a rectangular region. c is a constant value, and c must be less than a. Compared with a two-dimensional algorithm, a single-layer loop implemented using this one-dimensional algorithm can greatly reduce the complexity and overhead of detection and improve detection efficiency.
[0009] In one possible design, when the first information characterizing each of the K length units in each of the X scan segments overlaps with a second rectangular region in the M rectangular regions, the rendering node corresponding to the first rectangular region is hidden, wherein the second rectangular region is a rectangular region located above the first rectangular region. Optionally, the number of second rectangular regions includes at least one.
[0010] Thus, when the first information corresponding to the length unit overlapping with a rectangular area in all scan line segments that overlap with that rectangular area indicates that the corresponding length unit overlaps with the rectangular area above it, it means that the rectangular area is hidden by the rectangular area above it, and thus it means that the rendering node corresponding to the rectangular area is hidden. For a rectangular area, the electronic device can determine whether the rectangular area is hidden, and thus determine whether the rendering node corresponding to the rectangular area is hidden, by detecting the first information corresponding to several length units overlapping with the rectangular area.
[0011] In one possible design, the method further includes: when the first information characterization corresponding to at least one of the K length units in at least one of the X scan line segments does not overlap with the second rectangular region, the rendering node corresponding to the first rectangular region is not hidden.
[0012] Thus, when a scan line segment overlaps with a rectangular area, and the length unit that overlaps with the rectangular area contains first information corresponding to a certain length unit, indicating that the length unit does not overlap with the rectangular area above the rectangular area, it means that the area in the rectangular area that overlaps with the length unit is not occluded, and thus it can be determined that the corresponding rendering node of the rectangular area is not hidden.
[0013] In one possible design, before detecting that the rendering node corresponding to the first rectangular region is hidden, the method further includes: obtaining the second rectangular region; determining L length units that overlap with the second rectangular region in each of the Y scan line segments, wherein the Y scan line segments are the scan line segments that overlap with the second rectangular region among the scan line segments corresponding to the M rectangular regions, and Y and L are both integers greater than or equal to 1; determining the first information corresponding to each of the L length units, wherein the L length units include some or all of the K length units. Optionally, the electronic device determining the first information corresponding to the length unit may refer to generating the first information, that is, the first information does not exist before the electronic device performs the operation of determining the first information. Alternatively, the electronic device determining the first information corresponding to the length unit may also refer to updating the content of the first information.
[0014] Specifically, when a second rectangular region completely obscures a first rectangular region, the L length units may include all of the K length units. When multiple second rectangular regions jointly obscure a first rectangular region, the L length units included in one of the second rectangular regions may include a portion of the K length units. Alternatively, when a rectangular region is not jointly obscured by at least one second rectangular region, the L length units included in one of the second rectangular regions may include a portion of the K length units, or may not include any of the K length units.
[0015] In this way, the electronic device can detect the second rectangular region before detecting the first rectangular region. The second rectangular region is located above the first rectangular region. That is, the electronic device can detect the rectangular regions sequentially from top to bottom. Furthermore, when the electronic device has finished detecting the upper rectangular region, it can determine the first information corresponding to each length unit that overlaps with the upper rectangular region, indicating that these length units have overlapped with the upper rectangular region. Subsequently, for the lower rectangular region, the electronic device can determine whether the lower rectangular region is hidden by obtaining the first information corresponding to each length unit that overlaps with the previously determined rectangular region. By traversing the rectangular regions from top to bottom and determining the first information corresponding to the length units, when detecting the lower rectangular region, it is not necessary to repeatedly check the overlap between each length unit that overlaps with each rectangular region in the upper layer, thus reducing the complexity and overhead of detection and improving detection efficiency.
[0016] In one possible design, before acquiring the second rectangular region, the first information corresponding to each of the L length units is used to characterize that the length unit does not overlap with the rectangular region. Thus, before detecting the uppermost rectangular region, the first information corresponding to the length units that overlap with that rectangular region can be used to characterize that the length unit does not overlap with the rectangular region. Subsequently, after the rectangular region has been detected, the first information corresponding to the length units that overlap with that rectangular region can be updated to characterize that these length units overlap with the rectangular region.
[0017] In one possible design, determining the first information corresponding to each of the L length units includes: determining the first information as a first value when the length unit does not overlap with the rectangular region; and determining the first information as a second value when the length unit overlaps with the rectangular region; the first value is different from the second value. That is, when the first information indicates that the length unit does not overlap with the rectangular region, the first information is the first value; when the first information indicates that the length unit overlaps with the rectangular region, the first information is the second value, and the first value is different from the second value.
[0018] In this way, by implementing the first information as different values, it can characterize whether the corresponding length unit overlaps with the rectangular region.
[0019] In one possible design, the first value can include w zeros, and the second value can include w ones. Alternatively, the first value can include w ones, and the second value can include w zeros, where w is a preset integer greater than or equal to 1.
[0020] In one possible design, the two parallel boundary lines are the upper and lower boundary lines of the rectangular area, and the length of the scan line segment is greater than or equal to the width of the display screen; or the two parallel boundary lines are the left and right boundary lines of the rectangular area, and the length of the scan line segment is less than or equal to the height of the display screen.
[0021] In one possible design, each scan line segment corresponding to the M rectangular regions is divided into N length units, where N is a preset positive integer. The K length units that overlap with the first rectangular region in each scan line segment are part or all of the N length units into which the scan line segment is divided.
[0022] In one possible design, each scan line segment in the scan line segments corresponding to the M rectangular regions is divided into q intervals, each of the q intervals includes p length units, N = p × q, where p and q are both preset positive integers; determining the K length units that overlap with the first rectangular region in each of the X scan line segments includes: determining V intervals that overlap with the first rectangular region in each of the X scan line segments, where the V intervals include the K length units, and V is an integer greater than or equal to 1 and less than or equal to q.
[0023] It is understandable that, for a rectangular region, the intervals that overlap with the rectangular region can include intervals that partially overlap with the rectangular region and intervals that completely overlap with the rectangular region. That is, when a part of an interval overlaps with the rectangular region, that interval is also considered to overlap with the rectangular region.
[0024] Thus, for a scan line segment that overlaps with a rectangular region, the overlapping intervals within that scan line segment are determined. An interval can include at least one length unit. By detecting these intervals, detection efficiency can be improved.
[0025] In one possible design, when it is determined, based on the first information corresponding to each of the K length units, that a length unit overlaps with a second rectangular region within the M rectangular regions, detecting that the rendering node corresponding to the first rectangular region is hidden includes: obtaining a first mask corresponding to each of R intervals and a second mask corresponding to each of VR intervals, where the V intervals include the R intervals and the VR intervals, R being a positive integer greater than or equal to 1 and less than or equal to V, each of the R intervals partially overlaps with the first rectangular region, and each of the VR intervals completely overlaps with the first rectangular region, the first mask including p bits and the second mask including 1 bit; when the first mask corresponding to the R intervals indicates that the length unit in the interval that overlaps with the first rectangular region overlaps with the second rectangular region, and the second mask corresponding to the VR intervals indicates that the interval overlaps with the second rectangular region, the first rectangular region is hidden. The first mask corresponding to an interval is determined based on the first information corresponding to each length unit in that interval. In other words, the first mask corresponding to an interval represents the first information corresponding to each length unit in that interval. The second mask corresponding to an interval is determined based on the first mask corresponding to that interval.
[0026] Thus, for intervals overlapping with a rectangular region, the intervals that partially overlap with the rectangular region obtain a corresponding first mask, and the intervals that partially overlap with the rectangular region obtain a corresponding second mask. That is, for intervals that completely overlap with the rectangular region, the electronic device can perform detection based on the second mask. For intervals that partially overlap with the rectangular region, the electronic device can perform detection based on the first mask. Since the second mask has fewer bits than the first mask, this allows the electronic device to process fewer bits of data, further improving detection efficiency.
[0027] In one possible design, before detecting that the rendering node corresponding to the first rectangular region is hidden, the method further includes: obtaining the second rectangular region; determining J intervals that overlap with the second rectangular region from each of the Y scan segments, wherein the Y scan segments are the scan segments that overlap with the second rectangular region from the scan segments corresponding to the M rectangular regions, and J is an integer greater than or equal to 1 and less than or equal to q; determining the first mask and the second mask corresponding to each of the J intervals, wherein the J intervals include the V intervals. Optionally, when the first rectangular region is completely occluded by a second rectangular region, the J intervals may include the V intervals; when the first rectangular region is jointly occluded by multiple second rectangular regions, the J intervals may include a portion of the V intervals.
[0028] In this way, the electronic device can detect the second rectangular region before detecting the first rectangular region. The second rectangular region is a rectangular region located above the first rectangular region. Furthermore, after detecting the upper rectangular region, the electronic device can determine the first and second masks corresponding to each interval that overlaps with the upper rectangular region, indicating that these intervals overlap with the upper rectangular region, or that some length units within these intervals overlap with the upper rectangular region. Subsequently, for the lower rectangular region, the electronic device can determine whether the lower rectangular region is hidden by obtaining the first mask corresponding to the intervals that partially overlap with the lower rectangular region and the second mask corresponding to the intervals that completely overlap with the lower rectangular region. By traversing the rectangular regions from top to bottom and determining the first and second masks corresponding to the intervals, when detecting the lower rectangular region, the first and second masks are used, eliminating the need to individually check the overlap between each interval that overlaps with the lower rectangular region and each upper rectangular region, thus reducing detection complexity and overhead and improving detection efficiency.
[0029] In one possible design, before obtaining the second rectangular region, each of the q intervals corresponds to a first mask and a second mask, and the bit values in the first mask and the second mask are all third values; determining the first mask and the second mask corresponding to each of the J intervals includes: updating some or all of the bit values in the first mask and the second mask corresponding to each of the J intervals to a fourth value, wherein the fourth value is different from the third value.
[0030] Thus, before detecting the rectangular region, each of the q divided intervals corresponds to a first mask and a second mask, both of which are initially set to the third value. Subsequently, after detecting the upper-layer rectangular region, the first and second masks corresponding to the intervals overlapping with this rectangular region can be determined. At this point, both masks are set to the fourth value, which differs from the third value. Specifically, the values of the first and second masks corresponding to the regions overlapping with this rectangular region are updated from the third value to the fourth value. In this way, by utilizing bitwise operations on binary integers, it is possible to efficiently detect whether the rendering nodes corresponding to the rectangular region are hidden, significantly reducing detection overhead.
[0031] In one possible design, when the first mask corresponding to the R intervals indicates that the length unit overlapping with the first rectangular region and the second rectangular region overlap, and the second mask corresponding to the VR intervals indicates that the interval overlaps with the second rectangular region, the first rectangular region is hidden. This includes: when the bit value in the first mask corresponding to the length unit overlapping with the first rectangular region in the R intervals is a fourth value, and the bit value in the second mask corresponding to the VR intervals is a fourth value, the first rectangular region is hidden. Thus, for a rectangular region, the electronic device can determine whether the rectangular region is hidden by judging whether the first and second masks corresponding to the intervals overlapping with the rectangular region have been updated to the fourth value. This can improve detection efficiency and reduce detection overhead and complexity.
[0032] In one possible design, the third value is 0 and the fourth value is 1; or the third value is 1 and the fourth value is 0.
[0033] In one possible design, the values of p and q are both one of 8, 16, 32, and 64. Thus, setting the values of p and q to 8, 16, 32, and 64 is related to the bandwidth of the electronic device's processor, which facilitates processing by the electronic device.
[0034] In one possible design, the image to be rendered is the (S+1)th frame image, and the M rectangular regions included in the image to be rendered are determined based on all rendering nodes included in the Sth frame image and the changing rendering nodes, where S is an integer greater than or equal to 1; or, the image to be rendered is the (S+1)th frame image, and the M rectangular regions included in the image to be rendered are determined based on all rendering nodes included in the (S+1)th frame image, where S is an integer greater than or equal to 0. The changing rendering nodes can be determined in the rendering service process corresponding to the (S+1)th frame image, and all rendering nodes included in the Sth frame image can be determined in the rendering service process corresponding to the Sth frame image.
[0035] Thus, if, during the rendering service process of the current frame, it is impossible to obtain all the rendering nodes included in the current frame before executing the drawing instructions to generate rendering nodes, then all the rendering nodes included in the current frame can be determined based on all the rendering nodes included in the previous frame obtained during the rendering service process of the previous frame, and the changed rendering nodes obtained in the current frame. Conversely, if, during the rendering service process of the current frame, it is possible to obtain all the rendering nodes included in the current frame before executing the drawing instructions to generate rendering nodes, then all the rendering nodes included in the current frame can be obtained during the rendering service process of the current frame.
[0036] In one possible design, after detecting that the rendering node corresponding to the first rectangular area is hidden, the method further includes: not generating drawing instructions for the rendering node corresponding to the first rectangular area, wherein the drawing instructions for the rendering node are used to draw the rendering node. In this way, not generating drawing instructions for the hidden rendering node avoids redundant load on the processor, thereby reducing processor overhead and lowering the probability of stuttering, frame drops, and unplayable performance.
[0037] Secondly, an electronic device is provided, which has the function of implementing the method in any of the designs described in any of the above aspects. This function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above-described function.
[0038] Thirdly, an electronic device is provided, comprising: a processor, a memory, and a display screen, wherein the memory and the display screen are coupled to the processor, the memory is used to store program code, the program code including instructions, and the processor reads instructions from the memory to cause the electronic device to perform a method as described in any of the above aspects and designs. Optionally, the memory may be coupled to the processor or may be independent of the memory. The display screen may be used by the electronic device to perform display operations.
[0039] Fourthly, a computer-readable storage medium is provided, comprising a computer program that, when executed on an electronic device, causes the electronic device to perform a method as designed in any of the above aspects.
[0040] Fifthly, a computer program product is provided, comprising: a computer program or instructions that, when executed on a computer, cause the computer to perform a method designed as described in any of the preceding aspects.
[0041] In a sixth aspect, a chip system is provided, including at least one processor and at least one interface circuit, wherein the at least one interface circuit is used to perform transceiver functions and send instructions to the at least one processor, and when the at least one processor executes instructions, the at least one processor performs a method designed as in any of the above aspects.
[0042] The technical effects of the aforementioned aspects can be referenced from each other, and will not be elaborated further here. Attached Figure Description
[0043] Figure 1 is a schematic diagram of an application transition scenario provided by an embodiment of this application;
[0044] Figure 2 is a schematic diagram of a pop-up window scenario provided in an embodiment of this application;
[0045] Figure 3 is a schematic diagram of a multi-tasking scenario provided in an embodiment of this application;
[0046] Figure 4 is a schematic diagram of the occlusion relationship of a rendering node provided in an embodiment of this application;
[0047] Figure 5 is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0048] Figure 6 is a schematic diagram of a scanning line segment provided in an embodiment of this application;
[0049] Figure 7 is a schematic diagram of a mask provided in an embodiment of this application;
[0050] Figure 8 is a schematic diagram of occlusion detection in a rectangular region provided in an embodiment of this application;
[0051] Figure 9 is a schematic diagram of another method for occlusion detection of a rectangular region provided in an embodiment of this application;
[0052] Figure 10 is a schematic diagram of another method for occlusion detection of a rectangular region provided in an embodiment of this application;
[0053] Figure 11 is a schematic diagram of a scenario in which an occlusion detection scheme provided in an embodiment of this application is applied;
[0054] Figure 12 is a flowchart illustrating a rendering node detection method provided in an embodiment of this application;
[0055] Figure 13 is a schematic diagram of the structure of another electronic device provided in an embodiment of this application;
[0056] Figure 14 is a schematic diagram of a chip system provided in an embodiment of this application. Detailed Implementation
[0057] In the description of this application, unless otherwise stated, " / " indicates that the objects before and after are in an "or" relationship. For example, A / B can mean A or B. "And / or" in this application is merely a description of the relationship between the related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. A and B can be singular or plural.
[0058] In the description of this application, unless otherwise stated, "multiple" means two or more. "At least one of the following" or similar expressions refer to any combination of these items, including any combination of single or multiple items. For example, at least one of a, b, or c can mean: a, b, c, a and b, a and c, b and c, a and b and c, where a, b, and c can be single or multiple.
[0059] Furthermore, to facilitate a clear description of the technical solutions in the embodiments of this application, the terms "first" and "second" are used in the embodiments of this application to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first" and "second" do not limit the quantity or execution order, and the terms "first" and "second" are not necessarily different.
[0060] Currently, a graphical interface (or interface, user interface, etc.) obtained through graphics rendering may include at least one layer, and each layer may include multiple rendering nodes. That is, a graphical interface can be composed of many rendering nodes. In this embodiment, a rendering node can refer to the smallest drawing unit in the graphical interface; for example, a search box, image, button, icon, and text can all be a rendering node. Rendering nodes can also be called controls, components, etc. A rendering node can correspond to a rectangular area, and each rectangular area can be used to draw or support that rendering node. In some scenarios, certain rendering nodes in a graphical interface may be obscured by other rendering nodes in the same graphical interface; that is, these rendering nodes may be hidden and not visible to the user. However, during the graphics rendering process, to facilitate developers in implementing various dynamic effects for the graphical interface, the processor of the electronic device still generates drawing instructions for these user-invisible rendering nodes to draw them, which brings a significant redundant load to the processor.
[0061] For example, taking the application transition scenario shown in Figure 1 as an example, as shown in Figure 1(1), the electronic device displays the main interface 100 of the travel application. The main interface 100 can include one or more rendering nodes, such as rendering node 101 "ridesharing", rendering node 102 "train icon" (only two are shown in Figure 1(1)), etc. The rectangular area corresponding to each rendering node can be a dashed rectangle outside the rendering node. Then, the user can perform various user operations to achieve interface jump. For example, taking the user's operation such as clicking on the "homestay apartment" control 103 in the main interface 100 as an example, as shown in Figure 1(3), the electronic device displays the homestay booking interface 110. The homestay booking interface 110 can also include one or more rendering nodes, as shown in Figure 1(3), such as rendering node 111 "homestay apartment", rendering node 112 "delete icon" (only two are shown in Figure 1(3)), etc. The rectangular area corresponding to each rendering node can also be a dashed rectangle outside the rendering node.
[0062] During the process of the electronic device changing from displaying the main interface 100 shown in Figure 1(1) to displaying the homestay booking interface 110 shown in Figure 1(3), as shown in Figure 1(2), the homestay booking interface 110 will gradually obscure the main interface 100. That is, the rendering nodes in the homestay booking interface 110 will obscure the rendering nodes in the main interface 100. As shown in Figure 1(2), the interface composed of the main interface 100 and the homestay booking interface 110 can be a graphical interface. When the electronic device renders the graphical interface shown in Figure 1(2), for the rendering nodes hidden (i.e. not visible to the user) in the main interface 100, the processor of the electronic device will still generate drawing instructions for these rendering nodes.
[0063] For example, taking the pop-up scenario shown in Figure 2 as an example, as shown in Figure 2(1), the electronic device displays the main interface 200 of the alarm clock application. Similarly, the main interface 200 of the alarm clock application can also include one or more rendering nodes. Then, the user can perform operations such as clicking the new button 201 included in the main interface 200. In response to this operation, as shown in Figure 2(2), the electronic device can display the pop-up interface 210. The rendering nodes in the pop-up interface 210 will cover the rendering nodes in the main interface 200. As shown in Figure 2(2), the interface composed of the main interface 200 and the pop-up interface 210 can be a graphical interface. When the electronic device renders the graphical interface shown in Figure 2(2), the processor of the electronic device will still generate drawing instructions for the hidden rendering nodes in the main interface 200.
[0064] For example, consider the multitasking scenario shown in Figure 3. As shown in Figure 3, the electronic device displays a split-screen gallery interface 300 and a video interface 302, as well as multiple floating interfaces such as a memo interface 301, a video call interface 303, an SMS interface 305, and a shopping interface 304. Rendering nodes in some of these interfaces may obscure each other. For instance, rendering nodes in the SMS interface 305 may obscure rendering nodes in the shopping interface 304, video interface 302, and gallery interface 300, and vice versa. Similarly, in this scenario, the interface comprised of the gallery interface 300, video interface 302, memo interface 301, video call interface 303, SMS interface 305, and shopping interface 304 can be a single graphical interface. When the electronic device renders this graphical interface, the processor will also generate drawing instructions for the hidden rendering nodes.
[0065] To address the issue of redundant processor load caused by drawing instructions for hidden rendering nodes, resulting in high processor overhead, hidden rendering nodes can be detected to prevent the generation of drawing instructions for these hidden rendering nodes, thereby reducing processor overhead. In one possible detection scheme, the electronic device can traverse all rectangular regions corresponding to all rendering nodes included in the graphical interface. For each rectangular region, the electronic device can perform occlusion judgment with all other rectangular regions to determine which rectangular region occludes the rectangular region, or which rectangular regions jointly occlude it. For example, Figure 4 shows an example of a rectangular region being occluded. As shown in Figure 4 (1), the display screen 400 includes three rectangular regions, namely rectangular regions 401 to 403, each corresponding to a rendering node. Among them, rectangular region 402 is jointly occluded by multiple rectangular regions (i.e., rectangular regions 403 and 401). As shown in Figure 4(2), the display screen 400 includes two rectangular areas, namely rectangular area 411 and rectangular area 412, each of which corresponds to a rendering node. Rectangular area 411 is obscured by another rectangular area (rectangular area 412). It is understood that the example shown in Figure 4 illustrates the rectangular areas corresponding to several rendering nodes in a graphical user interface displayed on the display screen 400. In actual scenarios, a graphical interface can include more rendering nodes.
[0066] In the above detection scheme, the algorithm complexity satisfies (a 2 +a×b 3Here, 'a' represents the number of rectangular regions corresponding to all rendering nodes included in the graphical interface, and 'b' represents the average number of overlapping rectangular regions, which refers to the average number of rectangular regions overlapping with one other rectangular region. This scheme requires at least two nested loops, resulting in excessive complexity and an average processing time of approximately 1.5 milliseconds, which is unacceptable for current electronic devices with a common frame rate of 120 (frames per second, FPS). This scheme also incurs significant processor overhead and low detection efficiency.
[0067] For example, Table 1 shows examples of results when the above detection scheme is used in some scenarios.
[0068] Table 1
[0069] In Table 1, the time consumed refers to the duration required for the occlusion detection process. As shown in Table 1, taking the scenario of the alarm clock application transitioning from the main display interface to the alarm clock pop-up interface as an example, the time consumed using the above detection scheme reaches 1265.8us.
[0070] Based on this, embodiments of this application provide a rendering node detection method that can detect occluded rendering nodes, reduce detection complexity and overhead, and improve detection efficiency.
[0071] The technical solutions provided in this application can be applied to electronic device 100 or to a system including electronic device 100.
[0072] Electronic device 100 can be a mobile phone, a personal digital assistant (PDA), a desktop computer, a laptop computer, a handheld computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, as well as augmented reality (AR) devices, virtual reality (VR) devices, artificial intelligence (AI) devices, wearable devices, in-vehicle devices, smart home devices, and / or smart city devices. Optionally, electronic device 100 can be a fixed device or a portable device. Optionally, the operating system installed on electronic device 100 can include, but is not limited to, […]. Alternatively, other operating systems may be used. This application does not impose specific limitations on the specific type of electronic device or the operating system installed.
[0073] For example, Figure 5 shows a schematic diagram of the structure of an electronic device 100 provided in an embodiment of this application.
[0074] As shown in Figure 5, the electronic device 100 may include a processor 110, a memory 120, 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, buttons 180, a display screen 190, etc.
[0075] Processor 110 may include one or more processing units, such as application processor (AP), modem processor, graphics processing unit (GPU), image signal processor (ISP), controller, video codec, digital signal processor (DSP), baseband processor, and / or neural network processing unit (NPU). These different processing units may be independent devices or integrated into one or more processors.
[0076] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.
[0077] 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.
[0078] In some embodiments, processor 110 may include one or more interfaces, such as USB interface 130.
[0079] The charging management module 140 receives charging input from the charger. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.
[0080] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 to power the processor 110, memory 120, display 190, and wireless communication module 160, etc.
[0081] 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.
[0082] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be reused to improve antenna utilization.
[0083] The mobile communication module 150 can provide wireless communication solutions, including 2G / 3G / 4G / 5G, for use on electronic devices 100.
[0084] 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), Starflash, global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR) technology, etc.
[0085] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, Starflash, GNSS, WLAN, NFC, FM, and / or IR technologies, etc.
[0086] The display screen 190 is used to display images, videos, etc. The display screen 190 includes a display panel. In some embodiments of this application, the display screen 190 can be used to display various graphical interfaces.
[0087] The memory 120 can be used to store computer executable program code, which includes instructions. The memory 120 may include a program storage area and a data storage area. The program storage area may store the operating system, applications required for at least one function, etc. The data storage area may store data created during the use of the electronic device 100, etc. Furthermore, the memory 120 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. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the memory 120 and / or instructions stored in memory disposed in the processor.
[0088] The audio module 170 is used to convert digital audio information into analog audio signal output, and also to convert analog audio input into digital audio signal.
[0089] Buttons 180 include a power button, volume buttons, etc. Buttons 180 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.
[0090] It is understood that the structure illustrated in Figure 5 does 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 processing steps or functional characteristics of the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0091] The technical solutions involved in the following embodiments can all be implemented in a device with the structure shown in Figure 5.
[0092] This application provides a rendering node detection method. An electronic device can acquire rectangular regions (e.g., M rectangular regions, where M is an integer greater than or equal to 1) included in an image to be rendered. It is understood that for each frame of the image to be rendered, the image can include at least one rendering node, and each rendering node can correspond to a rectangular region. The rectangular region corresponding to each rendering node can be used to draw the rendering node. The electronic device can detect the rectangular region based on overlapping scan line segments (referred to as scan lines) to determine whether the rectangular region is hidden, and thus determine whether the rendering node corresponding to the rectangular region is hidden.
[0093] Optionally, when the electronic device determines that a rendering node corresponding to a rectangular area is hidden, the electronic device may not generate drawing instructions for that rendering node. When a rendering node corresponding to a rectangular area is not hidden, the electronic device may generate drawing instructions for that rendering node. These drawing instructions can be used to draw the rendering node. By not generating drawing instructions for hidden rendering nodes, redundant load is avoided on the processor, thus reducing processor overhead and lowering the probability of stuttering, frame drops, and unplayable animations.
[0094] The scanning line segments described in the embodiments of this application will be introduced below.
[0095] In some embodiments, the electronic device may obtain scan lines based on the boundary lines of all rectangular regions included in the image to be rendered.
[0096] In this embodiment, as one possible implementation, the electronic device can obtain two scan line segments based on the upper and lower boundary lines of each rectangular region. These two scan line segments overlap with the upper and lower boundary lines of the rectangular region, respectively. The electronic device can then obtain the scan line segments corresponding to all rectangular regions included in the image to be rendered, based on the two scan line segments obtained for each rectangular region.
[0097] For example, as shown in Figure 6(1), taking rectangular regions 601, 602, and 603 included in the image to be rendered as examples, the two scan line segments obtained based on the upper and lower boundary lines of rectangular region 601 are scan line 1 and scan line 4, respectively. The two scan line segments obtained based on the upper and lower boundary lines of rectangular region 602 are scan line 2 and scan line 5, respectively. The two scan line segments obtained based on the upper and lower boundary lines of rectangular region 603 are scan line 3 and scan line 4, respectively. Furthermore, in this example, the scan line segments corresponding to all rectangular regions included in the image to be rendered obtained by the electronic device include scan line 1 to scan line 5.
[0098] In the implementation shown in Figure 6(1), the length of each scan line segment obtained by the electronic device is equal, and the length of each scan line segment must be greater than or equal to the width of the display screen 600. The length of each scan line segment is equal to the width of the created virtual canvas (i.e., rectangular area 610) and is located within the virtual canvas; that is, the width of the created virtual canvas must be greater than or equal to the width of the display screen 600. The position of the display screen 600 must be within the virtual canvas. This ensures that all rectangular areas included in the image to be rendered within the display screen 600 can be detected based on the scan line segments.
[0099] It is understood that, in this embodiment of the application, since the electronic device may be in different usage states, such as portrait mode or landscape mode, the width of the electronic device display screen in this embodiment of the application may refer to the length of the display screen in the horizontal direction, and the height of the display screen may refer to the length of the display screen in the vertical direction. This will be explained uniformly here.
[0100] As another possible implementation, the electronic device can also obtain two scan lines based on the left and right boundary lines of each rectangular region. These two scan lines can overlap with the left and right boundary lines of the rectangular region, respectively. Then, the electronic device can also obtain the scan lines corresponding to all rectangular regions included in the image to be rendered, based on the two scan lines obtained for each rectangular region.
[0101] For example, as shown in Figure 6(3), taking rectangular regions 601, 602, and 603 included in the image to be rendered as examples, the two scan line segments obtained based on the left and right boundary lines of rectangular region 601 are scan line 2 and scan line 4, respectively. The two scan line segments obtained based on the left and right boundary lines of rectangular region 602 are scan line 1 and scan line 3, respectively. The two scan line segments obtained based on the left and right boundary lines of rectangular region 603 are scan line 2 and scan line 4, respectively. Furthermore, in this example, the scan line segments corresponding to all rectangular regions included in the image to be rendered obtained by the electronic device include scan line 1 to scan line 4.
[0102] It is understandable that, in the two methods of obtaining scan line segments shown in Figure 6(1) and Figure 6(3), the number of scan line segments corresponding to all rectangular regions included in the image to be rendered may be the same or different. Taking the image to be rendered as having M rectangular regions as an example, the number of scan line segments corresponding to all rectangular regions included in the image to be rendered must be less than or equal to 2M, where M is a positive integer.
[0103] In the implementation shown in Figure 6(3), the length of each scan line segment obtained by the electronic device is equal, and the length of each scan line segment must be greater than or equal to the height of the display screen 600. The length of each scan line segment is equal to the height of the created virtual canvas (i.e., rectangular area 610) and is located within the virtual canvas. In other words, the height of the created virtual canvas must be greater than or equal to the height of the display screen 600. The position of the display screen 600 must be within the virtual canvas. This ensures that all rectangular areas included in the image to be rendered within the display screen 600 can be detected based on the scan line segments.
[0104] It is understandable that the number of scan lines overlapping with each rectangular region may include at least two, and the number of scan lines overlapping with different rectangular regions may be the same or different. For example, taking the scan lines shown in Figure 6(1) as an example, the scan lines overlapping with rectangular region 601 include 4 (which can be used as an example of Y, where Y is an integer greater than or equal to 1), namely scan lines 1 to 4. The scan lines overlapping with rectangular region 602 include 4 (which can be used as an example of X, where X is an integer greater than or equal to 1), namely scan lines 2 to 5. The scan lines overlapping with rectangular region 603 include 2 (which can also be used as an example of X), namely scan lines 3 and 4. For another example, taking the scan lines shown in Figure 6(3) as an example, the scan lines overlapping with rectangular region 601 include 3, namely scan lines 2 to 4. The scan lines overlapping with rectangular region 602 include 3, namely scan lines 1 to 3. There are three scan line segments that overlap with the rectangular area 603, namely scan line 2 to scan line 4. And so on.
[0105] It is understood that, in this embodiment of the application, for a rectangular region, a scan line segment that overlaps with the rectangular region can refer to a scan line segment that passes through the rectangular region. For a scan line segment that overlaps with the rectangular region, it is possible that only a portion of the scan line segment overlaps with the rectangular region, or it is possible that the entire scan line segment overlaps with the rectangular region. That is to say, in this embodiment of the application, both a scan line segment that partially overlaps with the rectangular region and a scan line segment that completely overlaps with the rectangular region are referred to as a scan line segment that overlaps with the rectangular region.
[0106] The scanning line segments described in the embodiments of this application have been introduced above. The process of detecting a rectangular region based on overlapping scanning line segments within that region is described below.
[0107] In some embodiments, for a rectangular region, the electronic device determines at least one scan line segment that overlaps with the rectangular region. For each scan line segment, the electronic device can determine the line segments included in the scan line segment that overlap with the rectangular region. It is understood that the line segments included in the scan line segment that overlap with the rectangular region (hereinafter referred to as the overlapping line segments included in the scan line segment) may be part or all of the scan line segment. The electronic device can then determine whether the rectangular region is hidden by whether the overlapping line segments included in each scan line segment simultaneously overlap with a rectangular region above the rectangular region. It is understood that the overlapping line segments included in the scan line segment and the rectangular region above the rectangular region may mean that the overlapping line segments included in the scan line segment are jointly covered by at least one rectangular region above the rectangular region.
[0108] For a rectangular region, if all overlapping line segments included in the scan line segments overlap with the upper rectangular region, then the rectangular region is occluded. Conversely, if a scan line segment includes overlapping line segments that do not overlap with the upper rectangular region, then the rectangular region is not occluded. It can be understood that "overlapping line segments included in the scan line segment do not overlap with the upper rectangular region" means that some or all of the overlapping line segments included in the scan line segment are not covered by the upper rectangular region.
[0109] In some embodiments, the electronic device can determine the region in the scan line segment that overlaps with the rectangular region by dividing the scan line segment into intervals or length units.
[0110] In some embodiments, as shown in Figure 6(2) or (4), the electronic device can divide each obtained scan line segment into q intervals, namely intervals A, B, C, D, and E. Each interval includes p length units. For ease of understanding, Figure 6(2) and Figure 6(4) both use p as an example, and only show the length units divided in a certain interval. The other intervals are the same. That is, each scan line segment can be divided into p multiplied by q length units, that is, N length units, N = p × q. N, p, and q are all preset positive integers. In the embodiments of this application, the length unit can be a fixed length or a fixed number of pixels.
[0111] Optionally, the values of p and q can be determined based on the bandwidth of the electronic device's processor. As a concrete example, the value of p can be 2. r Where r is greater than or equal to 3, such that p can take any value from 8, 16, 32, or 64. q can also take a value of 2. r For example, q can take any value from 8, 16, 32, or 64. The value of p can be the same as or different from the value of q. Correspondingly, the value of N can be 64, 128, 256, etc.
[0112] The electronic device can then sequentially detect each rectangular region in the image to be rendered, from top to bottom, to determine whether a rectangular region is hidden. Optionally, the electronic device can determine which rectangle is in the upper layer of which rectangle based on the Z-order value of each rectangular region. A higher Z-order value indicates a higher layer for that rectangular region. It is understood that there may be one or more rectangles in the same layer. When multiple rectangular regions exist in the same layer, the electronic device can sequentially traverse these rectangular regions to detect each one in the same layer. After detecting the rectangular regions in the same layer, the electronic device continues to detect the rectangular regions in the next layer.
[0113] In one possible implementation, the rectangular region in the rendering layer to which this solution applies includes at least two layers, with at least one rectangular region in each layer. In this embodiment, as a possible implementation, the electronic device can detect the rectangular region based on the divided N length units. For example, the electronic device can first sequentially detect each rectangular region in the top layer (which can be called the first layer) (which can be used as an example of the second rectangular region). For a rectangular region in the top layer, the electronic device can determine Y scan lines that overlap with the rectangular region. Then, for each of the Y scan lines, the electronic device can determine L length units that overlap with the rectangular region. Here, L and Y are both integers greater than or equal to 1. It is understood that the number of length units that overlap with the rectangular region in each scan line can be the same or different; this applies to the overlap determination of other rectangular regions or scan lines, and will not be elaborated further. Next, the electronic device can determine the information 1 corresponding to each of the L length units in each of the Y scan lines.
[0114] For an explanation of how the implementation determines scan segments that overlap with a rectangular region, please refer to the above description. It is understood that a scan segment comprising segments overlapping a rectangular region may include at least one length unit.
[0115] Next, after the electronic device finishes detecting the rectangular regions of the first layer, it can sequentially detect each rectangular region of the next layer (which can be considered an example of the first rectangular region). For a rectangular region in the second layer, the electronic device can identify X scan line segments that overlap with the rectangular region. Then, for each of the X scan line segments, the electronic device can identify K length units that overlap with the rectangular region within that scan line segment. Here, X and K are both integers greater than or equal to 1. Then, the electronic device can determine whether the rectangular region is hidden based on the information 1 corresponding to the K length units included in each of the X scan line segments.
[0116] After the electronic device has finished detecting a rectangular area of the second layer, it can also determine the information 1 corresponding to each of the K length units in each of the X scan line segments.
[0117] Then, after the electronic device finishes detecting the rectangular regions of the second layer, it can continue to detect each rectangular region of the next layer (which can be called the third layer). When a rectangular region of the third layer is used as an example of the first rectangular region, both the rectangular regions of the second and first layers can be used as examples of the second rectangular region. For an introduction to detecting the rectangular regions of the third layer, please refer to the introduction to the rectangular regions of the second layer. This process continues until all rectangular regions have been detected.
[0118] In this implementation, for example, as shown in Figure 6(2), the image to be rendered includes rectangular regions 601, 602, and 603. Rectangular region 601 has the highest layer, that is, rectangular region 601 (which can be used as an example of a second rectangular region) is at the top layer, and rectangular region 603 (which can be used as an example of a first rectangular region) has the lowest layer, that is, rectangular region 603 is at the bottom layer. The electronic device can detect rectangular regions 601, 602 (which can also be used as an example of a first rectangular region), and 603 in sequence.
[0119] Taking the detection of a rectangular region 601 as an example, for each scan line segment that overlaps with the rectangular region 601, there may be Y scan line segments, where Y is an integer greater than or equal to 1. In the example shown in Figure 6 (2), the exemplary value of Y is 4. The electronic device can determine at least one length unit that overlaps with the rectangular region 601, such as L length units, where L is an integer greater than or equal to 1. It is understood that in the embodiments of this application, for each scan line segment that overlaps with a rectangular region, the length units that overlap with the rectangular region may be part or all of the length units divided in the scan line segment. It is understood that for a length unit, as long as a part of the length unit overlaps with the rectangular region, the length unit is determined to be a length unit that overlaps with the rectangular region.
[0120] For example, taking scan line 1, which overlaps with rectangular region 601, as an example, the electronic device can determine that scan line 1 includes 16 length units that overlap with rectangular region 601. In this example, the exemplary value of L is 16. These 16 length units are the 4 length units included in each of intervals B, C, and D, and the 1 length unit (i.e., a1) included in interval A and the 3 length units (i.e., e1, e2, e3) included in interval E. For example, if part of the 1 length unit included in interval A overlaps with rectangular region 601, then the 1 length unit included in interval A is also determined to be a length unit that overlaps with rectangular region 601. Similarly, for scan lines 2 to 4, which overlap with rectangular region 601, the electronic device can also determine the length units that overlap with rectangular region 601. In this example, scan lines 2 to 4 each include 16 length units, the same as scan line 1. The electronic device can then determine information 1 corresponding to each length unit that overlaps with the rectangular region 601, wherein information 1 corresponding to each length unit can be used to characterize that the length unit overlaps with the rectangular region.
[0121] Optionally, the electronic device determines that the information 1 (or first information) corresponding to each length unit that overlaps with the rectangular area 601 can refer to generating the information 1. That is, before the electronic device performs the operation of generating the information 1 corresponding to a certain length unit, the corresponding information 1 may not exist for that length unit.
[0122] Alternatively, the information 1 corresponding to each length unit that overlaps with the rectangular region 601, as determined by the electronic device, can also refer to the content of the updated information 1. That is, before the electronic device performs the operation of determining the information 1 corresponding to a certain length unit, that length unit may already have a corresponding information 1. However, this information 1 can be used to indicate that the length unit does not overlap with the rectangular region. For example, before detecting the uppermost rectangular region in the image to be rendered, the electronic device can preset the information 1 corresponding to each length unit in all length units included in each scan line segment, i.e., initialize information 1. At this time, the preset information 1 can be used to indicate that the corresponding length unit does not overlap with the rectangular region. In this implementation, combined with the example of detecting the rectangular region 601, before the electronic device detects the rectangular region 601, the information 1 corresponding to each length unit that overlaps with the rectangular region 601 can indicate that the corresponding length unit does not overlap with the rectangular region.
[0123] For example, when the length unit represented by information 1 does not overlap with the rectangular area, information 1 can be value 1 (or the first value); when the length unit represented by information 1 overlaps with the rectangular area, information 1 can be value 2 (or the second value). Value 1 and value 2 are different. In a specific example, value 1 can include w zeros, and value 2 can include w ones. Alternatively, value 1 can include w ones, and value 2 can include w zeros, where w is a preset integer greater than or equal to 1. Optionally, the value of w can be set based on the bandwidth of the electronic device's processor. For example, value 1 can be 0, and value 2 can be 1.
[0124] Next, after detecting each scan line segment in rectangular region 601, the electronic device can continue detecting rectangular region 602. Similarly, for each scan line segment that overlaps with rectangular region 602, the electronic device can also determine at least one length unit that overlaps with rectangular region 602. For example, for scan line 2 that overlaps with rectangular region 602, the electronic device can determine that scan line 2 includes a total of 4 length units that overlap with rectangular region 602. In this example, when rectangular region 602 is used as an example of the first rectangular region, the exemplary value of K is 4. When rectangular region 602 is used as an example of the second rectangular region, the exemplary value of L is 4. These 4 length units are the 3 length units included in interval A and the 1 length unit included in interval B. Similarly, for scan lines 3 to 5 that overlap with rectangular region 602, the electronic device can also determine the length units that overlap with rectangular region 602. In this example, scan lines 3 to 5 each include 4 length units, the same as scan line 2. The electronic device can then determine whether the rectangular region 602 is hidden based on information 1 corresponding to each length unit that overlaps with the rectangular region 602.
[0125] As one possible scenario, for each length unit that overlaps with a certain rectangular region, if the information 1 corresponding to that length unit indicates that the length unit has overlapped with rectangular regions other than that rectangular region, then the electronic device can detect that the rectangular region has been hidden. It can be understood that since the electronic device traverses and detects rectangular regions in a top-to-bottom order, the aforementioned rectangular regions other than that rectangular region can refer to rectangular regions that are in the same image to be rendered and are located above that rectangular region.
[0126] Optionally, in this case, for all length units that overlap with the rectangular region, it may overlap with multiple rectangular regions above the rectangular region. That is, there may be multiple rectangular regions above the rectangular region, and the rectangular region may be occluded by multiple upper rectangular regions. Of course, the rectangular region may also be completely occluded by a single upper rectangular region.
[0127] In this scenario, when a rectangular area is completely obscured by an upper rectangular area, the length units overlapping with the upper rectangular area can include all of the length units overlapping with the obscured rectangular area. Alternatively, when a rectangular area is obscured by multiple upper rectangular areas, the length units overlapping with these multiple upper rectangular areas can include all of the length units overlapping with the obscured rectangular area, and the length units overlapping with a particular upper rectangular area can include a portion of the length units overlapping with the obscured rectangular area.
[0128] As another possible scenario, if there is information 1 corresponding to a certain length unit that overlaps with a rectangular region, indicating that the length unit does not overlap with any other rectangular region besides the rectangular region, then the electronic device can detect that the rectangular region is not hidden. Figure 6(2) is an example of rectangular region 602 not being hidden. For an introduction to rectangular regions other than the rectangular region, please refer to the introduction of the previous scenario.
[0129] Optionally, in this other case, all length units overlapping with the upper rectangular region may include some length units overlapping with the rectangular region. For example, as shown in the example in Figure 6(2), rectangular region 601 is above rectangular region 602, and all length units overlapping with rectangular region 601 include a portion of all length units overlapping with rectangular region 602. Alternatively, in this other case, all length units overlapping with the rectangular region may not overlap with any rectangular region above the rectangular region, that is, length units overlapping with the rectangular region are not included in the length units overlapping with the upper rectangular region.
[0130] Furthermore, after the electronic device has detected the rectangular region 602, it can determine the information 1 corresponding to each length unit that overlaps with the rectangular region 602. This information 1 is used to characterize the overlap between the length unit and the rectangular region. Optionally, if the information 1 corresponding to a certain length unit already characterizes the overlap, the electronic device may not need to determine the information 1 for that length unit. For example, if the electronic device has already determined several pieces of information 1 characterizing the overlap between length units and the rectangular region after detecting the rectangular region above the rectangular region 602 (such as rectangular region 601), it may not need to determine these additional pieces of information 1. Alternatively, if the information 1 corresponding to a certain length unit does not characterize the overlap, the electronic device can determine the information 1 for that length unit to characterize the overlap.
[0131] For example, taking scan line 2 as an example, as shown in Figure 6(2), the length units that overlap with the rectangular region 602 include: three length units (a2, a3, a4) in interval A and one length unit (b1) in interval B. One length unit (a2) in interval A and one length unit (b1) in interval B overlap with the rectangular region 601. When detecting the rectangular region 601, the information 1 corresponding to these two length units has already been determined. Therefore, after detecting the rectangular region 602, it is not necessary to determine the information 1 corresponding to these two length units again. The remaining two length units (a3, a4) in interval A do not overlap with the rectangular region above the rectangular region 602. Therefore, after detecting the rectangular region 602, the electronic device can determine the information 1 corresponding to these two remaining length units, such as updating the value of information 1 from value 1 to value 2. The same applies to the length units in other scan line segments that overlap with the rectangular region 602.
[0132] In other words, for the same scan line segment, the electronic device can determine the length units that overlap with the rectangular regions in the scan line segment according to the hierarchical order of the rectangular regions. In this process, the length units that have been judged to overlap with the upper rectangular regions are not judged again.
[0133] Optionally, the implementation of the electronic device for determining the information 1 corresponding to each length unit that overlaps with the rectangular region 602 can refer to the corresponding implementation when detecting the rectangular region 601.
[0134] Next, the electronic device can continue to detect the rectangular region 603. Similarly, for each scan line segment that overlaps with the rectangular region 603, the electronic device can also determine that it includes at least one length unit that overlaps with the rectangular region 603. For example, for scan line 3 that overlaps with the rectangular region 603, the electronic device can determine that scan line 3 includes a total of 14 length units that overlap with the rectangular region 603. In this example, the exemplary value of K is 14. These 14 length units are the 4 length units included in each interval of C and D, the 3 length units included in B (i.e., b2, b3, b4), and the 3 length units included in E (i.e., e7, e8, e9). Similarly, for scan line 4 that overlaps with the rectangular region 603, the electronic device can also determine that it includes length units that overlap with the rectangular region 603. In this example, scan line 4 also includes 14 length units, the same as scan line 3. Then, the electronic device can also determine whether the rectangular region 603 is hidden based on the information 1 corresponding to each length unit that overlaps with the rectangular region 603.
[0135] Similarly, when detecting rectangular region 603, there may be two situations as described above when detecting rectangular region 602. For an introduction to these two situations, please refer to the relevant introduction to the detection region rectangular region 602 described above. In Figure 6 (2), the rectangular region 603 is completely hidden by the rectangular region 601 as an example.
[0136] Furthermore, after the electronic device has detected the rectangular region 603, it can also determine the information 1 corresponding to each length unit that overlaps with the rectangular region 603. The information 1 corresponding to each length unit is used to characterize the overlap between that length unit and the rectangular region. For example, taking the scan line 3 as an example, as shown in Figure 6(2), the length units that overlap with the rectangular region 603 include: four length units in each of intervals C and D, and three length units in each of intervals B and E. These length units also overlap with the rectangular region 601, and the information 1 corresponding to these length units has already been determined when detecting the rectangular region 601. Therefore, after detecting the rectangular region 603, it is not necessary to determine the information 1 corresponding to these length units.
[0137] For the implementation of the electronic device determining the information 1 corresponding to each length unit that overlaps with the rectangular region 603, refer to the implementation of the information 1 corresponding to each length unit that overlaps with the rectangular region 602 described above.
[0138] Similarly, electronic devices can detect all rectangular regions included in the image to be rendered.
[0139] Using the above scheme, the electronic device only needs to detect scan line segments that overlap with each rectangular region. For a given image to be rendered, the average number of scan line segments that overlap with each rectangular region in that image is a fixed value. Therefore, the algorithm complexity of the detection scheme provided in this application embodiment can satisfy (a×c), where a represents the number of rectangular regions corresponding to all rendering nodes included in the graphical interface (i.e., an image to be rendered), and c represents the average number of scan line segments that overlap with a rectangular region. c is a fixed value, and c must be less than a. Compared to the complexity (a) of the above detection scheme, 2 +a×b 3 The technical solution provided in this application simplifies a two-dimensional algorithm into a one-dimensional one, reducing the complexity and overhead of detection and improving detection efficiency.
[0140] The above embodiments use the example of an electronic device performing overlap judgment on a single length unit included in each scan line. In some embodiments, to improve detection efficiency, the electronic device can also perform overlap judgment on the entire interval included in each scan line. This interval can be q intervals as divided above, such as intervals A, B, C, D, and E as shown in Figure 7. For ease of understanding, the example in Figure 7 and subsequent figures uses a value of 5 for q.
[0141] In some embodiments, each interval may correspond to a mask 1 (or first mask), which can be used to determine whether the length unit in the interval overlaps with the rectangular region. As a possible example, mask 1 may include p bit values, i.e., p binary bits. Each bit value corresponds sequentially to a length unit in the interval to characterize whether the length unit overlaps with the rectangular region. That is, in this embodiment, information 1 can be implemented as one bit value in mask 1. For an explanation of p and q, please refer to the above description. For example, as shown in Figure 7, the mask 1 corresponding to intervals A, B, C, D, and E are "0111", "1111", "1111", "1111", and "1100", respectively. It is understood that, for ease of understanding, the example in Figure 7 and subsequent figures uses a value of 4 for p.
[0142] In this way, mask 1 contains exactly p bit values, that is, each length unit is represented by 1 binary bit, which can reduce the amount of bit data processed by the electronic device and make the detection efficiency higher.
[0143] Of course, in other examples, mask 1 can also include 2p bits, 3p bits, 4p bits, etc. Each pair of bits corresponds to a length unit within the interval. It can be understood that using the same number of bits to represent each length unit simplifies the computation of electronic devices.
[0144] Optionally, to further improve detection efficiency, each interval can also correspond to a mask 2 (or second mask). Mask 2 can be used to determine whether the interval overlaps with the rectangular region. The number of bits included in mask 2 can be less than the number of bits included in mask 1. As a possible example, mask 2 can include one bit, i.e., one binary bit. For example, as shown in Figure 7, the mask 2 corresponding to intervals A, B, C, D, and E are "0", "1", "1", "1", and "0", respectively. In this way, mask 2 includes only one bit, meaning each interval (i.e., p length units) is represented by one binary bit, which further reduces the amount of bit data processed by the electronic device, resulting in higher detection efficiency.
[0145] Of course, in other examples, mask 2 can also include more than one but less than p bits, such as two bits, three bits, etc. This also allows the electronic device to process less bit data, improving detection efficiency.
[0146] In some embodiments, there may be a correspondence between mask 2 and mask 1 corresponding to the same interval. When mask 1 of the interval indicates that all length units of the interval overlap with the rectangular region, mask 2 of the interval indicates that the interval overlaps with the rectangular region. When mask 1 of the interval indicates that some length units in the interval do not overlap with the rectangular region, mask 2 of the interval indicates that the interval does not overlap with the rectangular region. As a specific example, as shown in Figure 7, for an interval, when all the bit values included in mask 1 corresponding to the interval (any one of intervals B, C, and D shown in Figure 7) are "1" (which can be used as an example of the fourth value), it indicates that all length units in the interval overlap with the rectangular region, and mask 2 corresponding to the interval can be "1". This "1" mask 2 can be used to indicate that the interval overlaps with the rectangular region. For a given interval, when the bit value included in the mask 1 corresponding to the interval (either of intervals A or E as shown in Figure 7) is "0" (which can be used as an example of the third value), then "0" indicates that the corresponding length unit does not overlap with the rectangular region. The mask 2 corresponding to the interval can be "0", and the mask 2 with "0" can be used to indicate that the interval does not overlap with the rectangular region.
[0147] Alternatively, for a given interval, if all the bit values in mask 1 corresponding to that interval are "0", it indicates that all length units within that interval overlap with the rectangular region. Mask 2 corresponding to that interval can be "0", and this "0" in mask 2 can be used to indicate that the interval overlaps with the rectangular region. Conversely, if any bit value in mask 1 corresponding to that interval is "1", then "1" indicates that the corresponding length unit does not overlap with the rectangular region. Mask 2 corresponding to that interval can be "1", and this "1" in mask 2 can be used to indicate that the interval does not overlap with the rectangular region.
[0148] Alternatively, for a given interval, if all the bit values in mask 1 corresponding to that interval are "1", it indicates that all length units within that interval overlap with the rectangular region. The corresponding mask 2 can then be "0", and this "0" in mask 2 can be used to indicate that the interval overlaps with the rectangular region. Conversely, if any bit value in mask 1 corresponding to that interval is "0", then "0" indicates that the corresponding length unit does not overlap with the rectangular region. The corresponding mask 2 can then be "1", and this "1" in mask 2 can be used to indicate that the interval does not overlap with the rectangular region.
[0149] Alternatively, for a given interval, if all the bit values in mask 1 corresponding to that interval are "0", it indicates that all length units within that interval overlap with the rectangular region. The corresponding mask 2 can then be "1", which indicates that the interval overlaps with the rectangular region. Conversely, if any bit value in mask 1 corresponding to that interval is "1", it indicates that the corresponding length unit does not overlap with the rectangular region. The corresponding mask 2 can then be "0", which indicates that the interval does not overlap with the rectangular region.
[0150] It is understood that in the embodiments of this application, for a given interval, there is a corresponding relationship between mask 1, which indicates that all length units of the interval overlap with the rectangular region, and mask 2, which indicates that the interval overlaps with the rectangular region. Similarly, there is a corresponding relationship between mask 1, which indicates that some length units in the interval do not overlap with the rectangular region, and mask 2, which indicates that the interval does not overlap with the rectangular region. However, the embodiments of this application do not limit the specific bit values (such as "0" or "1") used to represent the corresponding masks 1 and 2.
[0151] In this embodiment, as one possible implementation, the electronic device can detect rectangular regions based on q divided intervals and a mask 1 corresponding to each interval. For example, the electronic device can first sequentially detect each rectangular region of the topmost layer (which can be called the first layer) (which can be used as an example of a second rectangular region). For a topmost rectangular region, the electronic device can determine Y scan lines that overlap with the rectangular region. Then, for each of the Y scan lines, the electronic device can determine J intervals that overlap with the rectangular region within that scan line segment. Here, J is an integer greater than or equal to 1 and less than or equal to q. It is understood that the number of intervals that overlap with the rectangular region in each scan line segment can be the same or different; this applies to the overlap determination of other rectangular regions or intervals, and will not be elaborated further. Next, the electronic device can determine the mask 1 corresponding to each of the J intervals within each of the Y scan lines.
[0152] Next, after the electronic device finishes detecting the rectangular regions of the first layer, it can sequentially detect each rectangular region of the next layer (which can be considered an example of the first rectangular region). For a rectangular region in the second layer, the electronic device can identify X scan lines that overlap with the rectangular region. Then, for each of the X scan lines, the electronic device can identify V intervals that overlap with the rectangular region. These V intervals include the aforementioned K length units. V is an integer greater than or equal to 1 and less than or equal to q. The electronic device can then determine whether the rectangular region is hidden based on the mask 1 corresponding to the V intervals included in each of the X scan lines.
[0153] After the electronic device has finished detecting a rectangular area of the second layer, it can also determine the mask 1 corresponding to each of the V intervals included in each of the X scan lines.
[0154] Then, after the electronic device finishes detecting the rectangular regions of the second layer, it can continue to detect each rectangular region of the next layer (which can be called the third layer). When a rectangular region of the third layer is used as an example of the first rectangular region, both the rectangular regions of the second and first layers can be used as examples of the second rectangular region. For an introduction to detecting the rectangular regions of the third layer, please refer to the introduction to the rectangular regions of the second layer. This process continues until all rectangular regions have been detected.
[0155] In this implementation, we will take the sequential detection of rectangular regions 601 to 603 as an example, and introduce the detection process of electronic devices by combining the method of overlapping judgment of the entire interval included by each scan line segment and the above-mentioned mask.
[0156] Taking the detection of rectangular region 601 as an example, as shown in Figure 8 (1) or (2), for each scan line segment that overlaps with rectangular region 601, the electronic device can determine at least one interval that overlaps with rectangular region 601, such as J intervals, where J is an integer greater than or equal to 1 and less than or equal to q. It can be understood that in this embodiment, for each scan line segment that overlaps with a rectangular region, the intervals that overlap with the rectangular region can be part or all of the intervals into which the scan line segment is divided. In this embodiment, for each scan line segment, the at least one interval that overlaps with the rectangular region includes fully overlapping intervals and partially overlapping intervals. That is, an interval that partially overlaps with the rectangular region is also determined to be an interval that overlaps with the rectangular region.
[0157] For example, as shown in Figure 8(2), taking scan line 1 that overlaps with the rectangular region as an example, the electronic device can determine that the intervals in scan line 1 that overlap with the rectangular region 601 include intervals A, B, C, D, and E. Among them, intervals A and E are intervals that partially overlap with the rectangular region 601, and intervals B, C, and D are intervals that completely overlap with the rectangular region. In this example, the exemplary value of J is 5. The electronic device can determine the mask 1 corresponding to each of these intervals. Among them, the mask 1 corresponding to each interval can be used to characterize that some or all of the length units included in the interval overlap with the rectangular region 601.
[0158] For example, as shown in Figure 8(2), after the electronic device detects scan line 1, the mask 1 for intervals A, B, C, D, and E determined by the electronic device is “0001”, “1111”, “1111”, “1111”, and “1110”, respectively. Among them, the mask 1 corresponding to intervals B, C, and D is used to indicate that all length units in the corresponding intervals overlap with the rectangular region. The mask 1 corresponding to interval A is used to indicate that the rightmost length unit included in this interval overlaps with the rectangular region, while other length units do not overlap with the rectangular region. The mask 1 corresponding to interval E is used to indicate that the rightmost length unit included in this interval does not overlap with the rectangular region, while other length units overlap with the rectangular region. Similarly, after the electronic device detects other scan lines that overlap with the rectangular region 601, it can also determine the mask 1 corresponding to the intervals included in these scan lines that overlap with the rectangular region 601.
[0159] Similarly, in this embodiment, the electronic device determines that the mask 1 corresponding to each interval that overlaps with the rectangular region 601 can refer to the generated mask 1. That is, before the electronic device performs the operation of generating the mask 1 corresponding to a certain interval, the interval may not have a corresponding mask 1.
[0160] Alternatively, the electronic device can determine that the mask 1 corresponding to each interval overlapping with the rectangular region 601 can also refer to updating the bit value in the mask 1. That is, before the electronic device performs the operation of determining the mask 1 corresponding to a certain interval, the interval may have a corresponding mask 1, but at this time the mask 1 can be used to characterize that the length unit included in the interval does not overlap with the rectangular region. For example, as shown in Figure 8 (1), before detecting the rectangular region 601, the mask 1 corresponding to the intervals A, B, C, D, and E included in the scan line 1 is "0000". As shown in Figure 8 (2), after the electronic device detects the rectangular region 601, the electronic device can update the bit value in the mask 1 corresponding to the interval based on whether the length unit included in the intervals A, B, C, D, and E overlaps with the rectangular region 601.
[0161] Next, after the electronic device has finished detecting each scan line segment of the rectangular region 601, the electronic device can continue to detect the rectangular region 602. Similarly, for each scan line segment that overlaps with the rectangular region 602, the electronic device can also determine at least one interval that overlaps with the rectangular region 602. For example, as shown in Figure 9 (1), taking scan line 2 that overlaps with the rectangular region 602 as an example, the electronic device can determine that the intervals included in scan line 2 that overlap with the rectangular region include intervals A and B. In this example, when the rectangular region 602 is used as an example of the first rectangular region, the exemplary value of V is 2. When the rectangular region 602 is used as an example of the second rectangular region, the exemplary value of J is 2. For another example, as shown in Figure 9 (3), taking scan line 5 that overlaps with the rectangular region 602 as an example, the electronic device can determine that the intervals included in scan line 5 that overlap with the rectangular region 602 include intervals A and B.
[0162] The electronic device can determine whether the rectangular region 602 is hidden based on the mask 1 corresponding to each interval that overlaps with the rectangular region 602. Similarly, as a possible scenario, for each interval that overlaps with a rectangular region, if the mask 1 corresponding to that interval indicates that all length units within that interval that overlap with the rectangular region overlap with rectangular regions other than the rectangular region itself, then the electronic device can detect that the rectangular region is hidden. In this case, when a rectangular region is completely obscured by an upper rectangular region, the intervals overlapping with the upper rectangular region can include all the intervals overlapping with the obscured rectangular region. Alternatively, when a rectangular region is jointly obscured by multiple upper rectangular regions, the intervals overlapping with these multiple upper rectangular regions can include all the intervals overlapping with the obscured rectangular region, and the interval overlapping with one of the upper rectangular regions can include a portion of the intervals overlapping with the obscured rectangular region.
[0163] As another possible scenario, for each interval that overlaps with a rectangular region, if the mask 1 corresponding to a certain interval indicates that a certain length unit included in that interval that overlaps with the rectangular region does not overlap with any other rectangular regions besides that rectangular region, then the electronic device can detect that the rectangular region is not hidden. Figure 9 shows an example where the rectangular region 602 is not hidden.
[0164] For example, as shown in Figure 9(1), taking scan line 2 as an example, the intervals that overlap with the rectangular region include intervals A and B. Before detecting the rectangular region 602, the mask 1 corresponding to interval A is "0001". This mask 1 indicates that the rightmost length unit in interval A overlaps with the rectangular region above the rectangular region 602 (taking rectangular region 601 as an example in Figure 9), and the three length units on the left side of interval A do not overlap with the rectangular region above the rectangular region 602. In interval A, the length units that overlap with the rectangular region 602 are the three length units on the right. Therefore, the two middle length units in interval A overlap with the rectangular region 602 but do not overlap with the rectangular region above the rectangular region 602. The mask 1 corresponding to interval B is "1111". This mask 1 indicates that all length units in interval B overlap with the rectangular region above the rectangular region 602. In interval B, the length unit that overlaps with the rectangular region 602 is the leftmost length unit. Therefore, based on the mask 1, the electronic device can determine that in the interval that overlaps with the rectangular region 602, the two middle length units of the interval A that overlap with the rectangular region 602 do not overlap with the rectangular region above the rectangular region 602, and the electronic device can detect that the rectangular region 602 is not hidden.
[0165] For example, as shown in Figure 9(3), taking scan line 5 as an example, the intervals that overlap with the rectangular area include intervals A and B. Before detecting the rectangular area 602, the mask 1 corresponding to interval A is "0000", which indicates that all length units included in interval A do not overlap with the rectangular area above the rectangular area 602. In interval A, the length units that overlap with the rectangular area 602 are the three length units on the right. The mask 1 corresponding to interval B is "0000", which indicates that all length units in interval B also do not overlap with the rectangular area above the rectangular area 602. In interval B, the length unit that overlaps with the rectangular area 602 is the one length unit on the far left. Therefore, the electronic device can also detect that the rectangular area 602 is not hidden based on this mask 1.
[0166] Similarly, after the electronic device detects the rectangular region 602, it can also determine the mask 1 corresponding to the intervals of the scan lines that overlap with the rectangular region 602. For example, taking scan line 2 as an example, the electronic device can update the mask 1 "0001" corresponding to interval A as shown in Figure 9 (1) to the mask 1 "0111" as shown in Figure 9 (2). The mask 1 "1111" corresponding to interval B as shown in Figure 9 (1) does not need to be updated. For another example, taking scan line 5 as an example, the electronic device can update the mask 1 "0000" corresponding to interval A as shown in Figure 9 (3) to the mask 1 "0111" as shown in Figure 9 (4), and update the mask 1 "0000" corresponding to interval B as shown in Figure 9 (3) to the mask 1 "1000" as shown in Figure 9 (4).
[0167] For the implementation of the mask 1 corresponding to the intervals that overlap with the rectangular region 602, which are included in the scan lines that overlap with the rectangular region 602, please refer to the relevant implementation when detecting the rectangular region 601.
[0168] Next, the electronic device can continue to detect the rectangular region 603. Similarly, for each scan line segment that overlaps with the rectangular region 603, the electronic device can also determine at least one interval that overlaps with the rectangular region 603. For example, as shown in Figure 10 (1), taking scan line 3 that overlaps with the rectangular region as an example, the electronic device can determine that the intervals in scan line 3 that overlap with the rectangular region 603 include intervals B, C, D, and E. It is understood that since there is no overlap between the rectangular region 602 and the rectangular region 603, the rectangular region 602 is not shown in Figure 10 for ease of understanding.
[0169] The electronic device can also determine whether the rectangular region 603 is hidden based on the mask 1 corresponding to each interval that overlaps with the rectangular region 603. Similarly, when detecting the rectangle 603, there may be two situations as described above when detecting the rectangular region 602. For a description of these two situations, please refer to the relevant introduction to detecting the rectangular region 602 described above. Figure 10 shows an example where the rectangular region 603 is completely hidden by the rectangular region 601.
[0170] As shown in Figure 10(1), the mask 1 corresponding to intervals B, C, and D is "1111". This mask 1 indicates that all length units included in the corresponding intervals overlap with the rectangular region above the rectangular region 602 (rectangular region 601 is taken as an example in Figure 10). In interval B, the length units that overlap with the rectangular region 603 are the three length units on the right. In intervals C and D, the length units that overlap with the rectangular region 603 are all included length units. The mask 1 corresponding to interval E is "1110". This mask 1 indicates that only the three length units on the left of interval E overlap with the rectangular region above the rectangular region 602. In interval E, the length units that overlap with the rectangular region 603 are also the three length units on the left. Therefore, the electronic device can detect that the rectangular region 603 is hidden based on this mask 1.
[0171] Furthermore, after the electronic device has detected the rectangular region 603, it can also determine the mask 1 corresponding to the intervals that overlap with the rectangular region 603, which are included in the scan lines that overlap with the rectangular region 603. For example, as shown in Figure 10, taking the intervals B, C, D, and E that overlap with the rectangular region 603 included in scan line 3 as an example, since the rectangular region 603 is completely hidden by the rectangular region 601, the mask 1 corresponding to these intervals has been updated when the rectangular region 601 has been detected. Therefore, after the rectangular region 603 has been detected, there is no need to update the mask 1 corresponding to these intervals. As shown in Figure 10(1) and Figure 10(2), the mask 1 corresponding to these intervals is the same before and after the detection of the rectangular region 603. For the implementation of determining the mask 1 corresponding to the intervals that overlap with the rectangular region 603, which are included in the scan lines that overlap with the rectangular region 603, please refer to the relevant introduction when detecting the rectangular region 602.
[0172] In this embodiment, for a rectangular area, the electronic device can update the corresponding mask 1, mask 2, etc., after detecting all scan segments that overlap with the rectangular area. Of course, in other embodiments, the electronic device can also update the corresponding mask 1, mask 2, etc., after detecting a scan segment.
[0173] The above embodiment uses the example of an electronic device detecting a rectangular region based on mask 1. In some embodiments, the electronic device can also combine mask 2 to detect the rectangular region to improve detection efficiency.
[0174] In some embodiments, for intervals that overlap with a rectangular region, the electronic device can classify the intervals into segments based on the overlap between the rectangular region and the interval. An interval segment can include at least one interval. For example, an interval segment can include at least one type: interval segments that completely overlap with the rectangular region and interval segments that partially overlap with the rectangular region. Alternatively, the electronic device can divide the intervals into different types based on the overlap between the rectangular region and the interval. For example, the resulting interval types can include at least one type: intervals that completely overlap with the rectangular region and intervals that partially overlap with the rectangular region. An interval segment that completely overlaps with the rectangular region can refer to an interval segment in which the included intervals completely overlap with the rectangular region. An interval segment that partially overlaps with the rectangular region can refer to an interval segment in which the included intervals partially overlap with the rectangular region.
[0175] For example, as shown in Figure 8(3) or (4), the intervals A, B, C, D, and E that overlap with the rectangular region 601 can be divided into a middle segment, a left segment, and a right segment. Among them, the intervals B, C, and D included in the middle segment completely overlap with the rectangular region 601, while the intervals A included in the left segment and E included in the right segment partially overlap with the rectangular region 601.
[0176] As another example, as shown in Figure 9, the intervals A and B that overlap with the rectangular region 602 can be divided into left and right segments. The interval A in the left segment and the interval B in the right segment partially overlap with the rectangular region 602.
[0177] As another example, as shown in Figure 10, the intervals B, C, D, and E that overlap with the rectangular region 603 can be divided into three segments: a middle segment, a left segment, and a right segment. The middle segment, including intervals C and D, completely overlaps with the rectangular region 603, while the left segment, including interval B, and the right segment, including interval E, partially overlap with the rectangular region 603.
[0178] Understandably, for an area that overlaps with a rectangular region, it can be divided into segments that may include at least one of the following: a left segment, a middle segment, and a right segment. The middle segment contains segments that completely overlap with the rectangular region, while the left or right segment contains segments that partially overlap with the rectangular region.
[0179] In this embodiment, for different types of intervals, the electronic device can use different masks (such as mask 1 and mask 2) to detect the rectangular region. For example, for intervals that completely overlap with the rectangular region, the electronic device can perform detection based on mask 2. For intervals that partially overlap with the rectangular region, the electronic device can perform detection based on mask 1. Since mask 2 has fewer bits than mask 1, this allows the electronic device to process fewer bits of data, further improving detection efficiency.
[0180] For example, referring to the examples shown in Figure 8 (3) and (4), when the electronic device detects the intervals A, B, C, D, and E (left, middle, and right segments) that overlap with the rectangular region 601 within the scan line 1, the electronic device can detect the rectangular region 601 based on the mask 2 corresponding to each interval in the middle segment and the mask 1 corresponding to each interval in the left and right segments. Similarly, in this example, after the electronic device detects the scan line 1, it can determine the mask 1 and mask 2 corresponding to all intervals included in the left, middle, and right segments. The mask 1 corresponding to each interval can be used to characterize the overlap between some or all of the length units included in that interval and the rectangular region 601. The mask 2 corresponding to each interval can be used to characterize the overlap between that interval and the rectangular region 601.
[0181] For ease of understanding, in the accompanying drawings of the embodiments of this application, mask 1 is represented by 4 bits and mask 2 is represented by 1 bit.
[0182] For example, the electronic device can update the mask 1 and mask 2 before detection as shown in Figure 8 (3) to the mask 1 and mask 2 shown in Figure 8 (4). For example, the mask 1 "0000" corresponding to interval A is updated to "0001", and the mask 2 "0" corresponding to interval A is not updated. The mask 1 "0000" corresponding to intervals B, C, and D is updated to "1111", and the mask 2 "0" corresponding to intervals B, C, and D is updated to "1". The mask 1 "0000" corresponding to interval E is updated to "1110", and the mask 2 "0" corresponding to interval E is not updated. Among them, a mask 2 of "0" indicates that the interval corresponding to the mask 2 does not overlap with the rectangular area, and a mask 2 of "1" indicates that the interval corresponding to the mask 2 overlaps with the rectangular area. It can be understood that when mask 2 is "0", it indicates that the interval corresponding to mask 2 does not overlap with the rectangular area. This can include two cases: the entire interval corresponding to mask 2 does not overlap with the rectangular area, and a portion of the interval corresponding to mask 2 does not overlap with the rectangular area. Similarly, when mask 2 uses other values to indicate that the interval corresponding to mask 2 does not overlap with the rectangular area, it also includes the aforementioned two cases. This will be explained uniformly here. In the example shown in Figure 8 (4), the mask 2 corresponding to intervals A and E is "0", which specifically means that a portion of the interval corresponding to mask 2 does not overlap with the rectangular area.
[0183] For example, referring to the examples shown in (1) and (2) of Figure 9, when the electronic device detects the intervals that overlap with the rectangular region 602 in the detection scan line 2, namely intervals A and B, that is, the left segment and the right segment, the electronic device can detect the rectangular region 601 based on the mask 1 corresponding to each interval in the left and right segments. The same applies to the examples shown in (3) and (4) of Figure 9.
[0184] For example, in conjunction with the example shown in Figure 10, when the electronic device detects the intervals that overlap with the rectangular region 603 in the scan line 3, namely intervals B, C, D, and E, which are the left segment, middle segment, and right segment, the electronic device can detect the rectangular region 603 based on the mask 2 corresponding to each interval included in the middle segment, and the mask 1 corresponding to each interval in the left and right segments. For example, as shown in Figure 10 (1), the mask 2 corresponding to intervals C and D (which can be used as an example of R intervals) is "1", and the electronic device can determine that intervals C and D overlap with the rectangular region above the rectangular region 603. The mask 1 corresponding to interval B (which can be used as an example of one of R intervals) is "1111", and the electronic device can determine that the length unit in interval B that overlaps with the rectangular region 603 overlaps with the rectangular region above the rectangular region 603. The mask 1 corresponding to interval E (which can be used as an example of one of R intervals) is "1110", and the electronic device can determine that the length unit in interval E that overlaps with the rectangular region 603 overlaps with the rectangular region above the rectangular region 603. Similarly, in this example, after the electronic device detects scan line 3, it can also determine the mask 1 and mask 2 corresponding to all intervals included in the left, middle, and right segments. This can be referred to in the description of the rectangular area 601. Optionally, the electronic device can determine only the mask 1 and mask 2 for the left and right segments, without determining the mask 1 and mask 2 for the middle segment.
[0185] Based on the above scheme of using mask 1, mask 2, etc. to detect rectangular regions, by utilizing bitwise operations of binary integers, it is possible to efficiently detect whether the rendering nodes corresponding to the rectangular region are hidden, which can significantly reduce the detection overhead.
[0186] In some embodiments, the operating system of an electronic device may include a render service process, which can be used to perform unified rendering for all applications. Each frame of an image to be rendered may correspond to a render service process, which can be used to render the image, which may include at least one application window or interface.
[0187] In this embodiment, as one possible application scenario, for example: for HarmonyOS Operating systems and other electronic devices can apply the detection scheme provided in the embodiments of this application to detect all rendering nodes included in the (S+1)th frame image when the image to be rendered is the (S+1)th frame image, so as to determine which rendering nodes in the (S+1)th frame image are hidden. Here, S is an integer greater than or equal to 1.
[0188] For example, in this application scenario, when an electronic device executes the rendering service process for the S-frame image to render the S-frame image, if the rendering service process can only obtain all the rendering nodes included in the S-frame image when generating the drawing instructions for all the rendering nodes included in the S-frame image, then the electronic device can apply the detection scheme provided in this application embodiment when the image to be rendered is the S+1-frame. Specifically, all the rendering nodes (i.e., all rectangular regions) included in the S+1-frame image can be determined based on all the rendering nodes included in the S-frame image and the changed rendering nodes obtained when executing the rendering service process for the S+1-frame image. In other words, the rendering service process corresponding to this frame image can obtain the changed rendering nodes in this frame image relative to the previous frame image before generating the drawing instructions.
[0189] For example, as shown in Figure 11(1), the rendering service process includes a main rendering service thread (hereinafter referred to as the main thread) and a unified rendering thread (hereinafter referred to as the child thread). In this example, the main thread is responsible for some preprocessing and updating rendering nodes in the dirty region during the preparation phase. The main thread can obtain rendering nodes that have changed relative to the previous frame during the preparation phase. It can be understood that the dirty region in graphics rendering can refer to the area where elements have changed (such as changes in color, shape, position, etc.). Thread synchronization can be used to synchronize data between the main thread and the child thread. The child thread is responsible for generating drawing instructions for rendering nodes during the drawing phase and for sending the image to the display screen during the display phase. The child thread can obtain all rendering nodes included in the current frame during the drawing phase. It can be understood that when the vertical synchronization (VSYNC) signal arrives, the electronic device can start the rendering service process of a frame.
[0190] In the example shown in Figure 11(1), the electronic device can obtain the rendering nodes that have changed relative to the S-frame image during the preparation stage of the main thread corresponding to the S+1-th frame image, and obtain all the rendering nodes included in the S-frame image during the drawing stage of the sub-thread corresponding to the S-frame image, thereby obtaining all the rendering nodes included in the S+1-th frame image. Subsequently, the detection scheme provided in this application embodiment can be executed during the occlusion detection stage of the sub-thread to obtain the hidden rendering nodes. It is understood that the occlusion detection stage is before the drawing stage. Then, during the drawing stage, the drawing instructions for the hidden rendering nodes are not generated. And during the display stage, the S+1-th frame image is sent to the display screen for display.
[0191] As another possible application scenario, for example: for Operating systems and other electronic devices can apply the detection scheme provided in this application embodiment to detect all rendering nodes included in the S-frame image when the image to be rendered is the S-frame image, in order to determine which rendering nodes in the S-frame image are hidden. Here, S is an integer greater than or equal to 1.
[0192] For example, in this scenario, when the electronic device executes the rendering service process for the S-frame image to render the S-frame image, if the rendering service process can obtain all the rendering nodes included in the S-frame image before generating the drawing instructions for all the rendering nodes included in the S-frame image, then the electronic device can apply the detection scheme provided in the embodiments of this application when the image to be rendered is the S-frame. That is to say, the rendering service process corresponding to this frame image can obtain the rendering nodes that have changed in this frame image relative to the previous frame image before generating the drawing instructions.
[0193] For example, as shown in Figure 11(2), the rendering service process can also include a main thread and a sub-thread. In this example, the main thread can be responsible for the preprocessing of all rendering nodes during the preparation phase. The main thread can obtain all rendering nodes included in the current frame image during the preparation phase. Therefore, the electronic device can obtain all rendering nodes included in the S-frame image during the preparation phase of the main thread corresponding to the S-frame image. Subsequently, the detection scheme provided in this application embodiment can be executed during the occlusion detection phase of the sub-thread to obtain the hidden rendering nodes. Then, during the drawing phase, the drawing instructions for the hidden rendering nodes are not generated. And during the display phase, the S-frame image is sent to the display screen for display.
[0194] In the above application scenarios, the technical solution provided by the embodiments of this application can reduce the load of the rendering service process, reduce the rendering time of a single frame image, and improve the frame rate.
[0195] For example, Table 2 shows a comparison of the results of the detection scheme provided by the embodiments of this application and the above-mentioned solutions in some scenarios.
[0196] Table 2
[0197] As shown in Table 2, under the same application scenario, the detection scheme provided in this application embodiment takes significantly less time than the solution described above, improving speed by at least 30 times. Furthermore, the technical solution provided in this application embodiment can achieve the same rejection rate as the solution described above, where the rejection rate refers to the number of occluded rendering nodes in the graphical interface divided by the total number of rendering nodes in the rectangular interface, thus achieving the same accuracy.
[0198] For example, Figure 12 shows a schematic flowchart of a rendering node detection method provided in an embodiment of this application. As shown in Figure 12, the method includes the following steps:
[0199] S1201, The electronic device acquires the first rectangular area.
[0200] The first rectangular region is one of the M rectangular regions included in the image to be rendered. Each of the M rectangular regions is used to draw a rendering node, and M is an integer greater than or equal to 1.
[0201] S1202, The electronic device determines that each of the X scan line segments includes K length units that overlap with the first rectangular region.
[0202] Among them, X scan line segments are the scan line segments that overlap with the first rectangular region among the scan line segments corresponding to M rectangular regions. X and K are both integers greater than or equal to 1. The scan line segments corresponding to the M rectangular regions are obtained based on two scan line segments obtained from each of the M rectangular regions. The two scan line segments coincide with the two parallel boundary lines included in the rectangular region, respectively.
[0203] S1203. In the X scan line segments, when the first information characterization of each length unit in the K length units of each scan line segment overlaps with the second rectangular region in the M rectangular regions, the rendering node corresponding to the first rectangular region is hidden.
[0204] The second rectangular region is a rectangular region located above the first rectangular region. It can be understood that there can be at least one second rectangular region.
[0205] For example, in this step, the first rectangular region can be the rectangular region 603 as described above, and the second rectangular region can be the rectangular region 601 as described above.
[0206] S1204. When the first information characterization of at least one length unit among the K length units included in at least one of the X scan line segments indicates that the at least one length unit does not overlap with the second rectangular area, the rendering node corresponding to the first rectangular area is not hidden.
[0207] For example, in this step, the first rectangular region can be the rectangular region 602 as described above, and the second rectangular region can be the rectangular region 601 as described above.
[0208] For details on the implementation of Figure 12, please refer to the above description.
[0209] The above primarily describes the solutions provided by the embodiments of this application from a methodological perspective. It is understood that, in order to achieve the above functions, the electronic device includes hardware structures and / or software modules corresponding to the execution of each function. Based on the units and algorithm steps of the various examples described in the embodiments disclosed in this application, the embodiments of this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by a computer 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, but such implementation should not be considered to exceed the scope of the technical solutions of the embodiments of this application.
[0210] This application provides embodiments for dividing an electronic device into functional modules based on the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into a single processing unit. The integrated unit can be implemented in hardware or as a software functional module. It should be noted that the unit division in this application embodiment is illustrative and represents only one logical functional division; in actual implementation, other division methods may be used.
[0211] Figure 13 shows a schematic diagram of an electronic device provided in an embodiment of this application. This electronic device 1300 can be used to implement the methods executed by the electronic devices described in the above method embodiments. For example, the electronic device 1300 may include a processing unit 1301 and a display unit 1302.
[0212] The processing unit 1301 is used to support the electronic device 1300 in performing the processing function described in any one of Figures 1 to 12, and the display unit 1302 is used to support the electronic device 1300 in performing the display function described in any one of Figures 1 to 12.
[0213] Optionally, the electronic device 1300 shown in FIG13 may further include a storage unit 1303, which stores programs or instructions. When the processing unit 1301 executes the program or instructions, the electronic device 1300 shown in FIG13 can perform the method described in the above-described method embodiments.
[0214] The technical effects of the electronic device 1300 shown in Figure 13 can be referred to the technical effects described in the above method embodiments, and will not be repeated here. The processing unit 1301 involved in the electronic device 1300 shown in Figure 13 can be implemented by a processor or processor-related circuit components, and can be a processor or processing module. The display unit 1302 can be implemented by display screen-related components.
[0215] This application also provides a chip system, as shown in FIG14, which includes at least one processor 1401 and at least one interface circuit 1402. The processor 1401 and the interface circuit 1402 are interconnected via lines. For example, the interface circuit 1402 can be used to receive signals from other devices. As another example, the interface circuit 1402 can be used to send signals to other devices (e.g., the processor 1401). Exemplarily, the interface circuit 1402 can read instructions stored in a memory and send the instructions to the processor 1401. When the instructions are executed by the processor 1401, the electronic device can perform the various steps performed by the electronic device in the above embodiments. Of course, the chip system may also include other discrete devices, which are not specifically limited in this application.
[0216] Optionally, the chip system may contain one or more processors. These processors can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, an integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.
[0217] Optionally, the chip system may contain one or more memories. The memory may be integrated with the processor or disposed separately from it; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed separately on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.
[0218] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.
[0219] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.
[0220] This application also provides a computer storage medium storing computer instructions, which, when executed on an electronic device, cause the electronic device to perform the methods described in the above-described method embodiments.
[0221] This application provides a computer program product, which includes a computer program or instructions that, when run on a computer, cause the computer to perform the methods described in the above-described method embodiments.
[0222] In addition, this application also provides 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 apparatus to perform the methods in the above-described method embodiments.
[0223] In this embodiment, the electronic device, computer storage medium, computer program product or chip are all used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can be referred to the beneficial effects of the corresponding method provided above, and will not be repeated here.
[0224] 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.
[0225] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. The embodiments can be combined with or referenced to each other without conflict. The apparatus embodiments described above are merely illustrative; for example, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another device, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.
[0226] The units described as separate components may or may not be physically separate. A component shown as a unit can be one or more physical units; that is, it can be located in one place or distributed in multiple different locations. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0227] 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.
[0228] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, in essence, or the parts that contribute to the prior art, or all or part of the technical solutions, can be embodied in the form of a software product. This software product is stored in a storage medium and includes several instructions to cause a device (which may be a microcontroller, chip, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0229] 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. A method for detecting rendering nodes, characterized in that, Applied to an electronic device having a display screen, the method includes: Obtain a first rectangular region, which is one of the M rectangular regions included in the image to be rendered. Each of the M rectangular regions is used to draw a rendering node, and M is an integer greater than or equal to 1. Each of the X scan line segments includes K length units that overlap with the first rectangular region. The X scan line segments are the scan line segments that overlap with the first rectangular region among the scan line segments corresponding to the M rectangular regions. X and K are both integers greater than or equal to 1. The scan line segments corresponding to the M rectangular regions are obtained based on two scan line segments obtained for each of the M rectangular regions. The two scan line segments coincide with two parallel boundary lines included in the rectangular region. In the X scan line segments, each of the K length units included in each scan line segment represents the first information indicating that when the length unit overlaps with the second rectangular region in the M rectangular regions, the rendering node corresponding to the first rectangular region is hidden, wherein the second rectangular region is a rectangular region located above the first rectangular region.
2. The method according to claim 1, characterized in that, The method further includes: When at least one of the K length units in the X scan line segments represents a first information characteristic that the at least one length unit does not overlap with the second rectangular region, the rendering node corresponding to the first rectangular region is not hidden.
3. The method according to claim 1 or 2, characterized in that, Before detecting that the rendering node corresponding to the first rectangular region is hidden, the method further includes: Obtain the second rectangular region; Each of the Y scan line segments is determined to include L length units that overlap with the second rectangular region. The Y scan line segments are the scan line segments that overlap with the second rectangular region among the scan line segments corresponding to the M rectangular regions. Y and L are both integers greater than or equal to 1. Determine the first information corresponding to each of the L length units, wherein the L length units include some or all of the K length units.
4. The method according to claim 3, characterized in that, Before acquiring the second rectangular region, the first information corresponding to each of the L length units is used to characterize that the length unit does not overlap with the rectangular region.
5. The method according to claim 3 or 4, characterized in that, Determining the first information corresponding to each of the L length units includes: When the length unit does not overlap with the rectangular area, the first information is determined to be the first value; When the length unit overlaps with the rectangular region, the first information is determined to be the second value; the first value is different from the second value.
6. The method according to any one of claims 1-5, characterized in that, The two parallel boundary lines are the upper and lower boundary lines of the rectangular area, and the length of the scan line segment is greater than or equal to the width of the display screen; or the two parallel boundary lines are the left and right boundary lines of the rectangular area, and the length of the scan line segment is less than or equal to the height of the display screen.
7. The method according to any one of claims 1-6, characterized in that, Each scan line segment in the scan line segments corresponding to the M rectangular regions is divided into N length units, where N is a preset positive integer. The K length units that overlap with the first rectangular region in each scan line segment are part or all of the N length units into which the scan line segment is divided.
8. The method according to claim 7, characterized in that, Each scan line segment in the scan line segments corresponding to the M rectangular regions is divided into q intervals. Each of the q intervals includes p length units. N = p × q, where p and q are both preset positive integers. The determination of the K length units overlapping with the first rectangular region in each of the X scan line segments includes: Each of the X scan line segments is identified as having V intervals that overlap with the first rectangular region. The V intervals include the K length units, and V is an integer greater than or equal to 1 and less than or equal to q.
9. The method according to claim 8, characterized in that, When determining, based on the first information corresponding to each of the K length units, that a length unit overlaps with a second rectangular region within the M rectangular regions, the step of detecting that the rendering node corresponding to the first rectangular region is hidden includes: Obtain a first mask corresponding to each of the R intervals and a second mask corresponding to each of the VR intervals, wherein the V intervals include the R intervals and the VR intervals, where R is a positive integer greater than or equal to 1 and less than or equal to V, each of the R intervals partially overlaps with the first rectangular region, and each of the VR intervals completely overlaps with the first rectangular region, wherein the first mask includes p bit values and the second mask includes 1 bit value; When the first mask corresponding to the R intervals indicates that the length unit in the interval that overlaps with the first rectangular region and the second rectangular region overlap, and the second mask corresponding to the VR intervals indicates that the interval overlaps with the second rectangular region, the first rectangular region is hidden.
10. The method according to claim 9, characterized in that, Before detecting that the rendering node corresponding to the first rectangular region is hidden, the method further includes: Obtain the second rectangular region; Each of the Y scan line segments is identified as having J intervals that overlap with the second rectangular region. The Y scan line segments are the scan line segments that overlap with the second rectangular region among the scan line segments corresponding to the M rectangular regions. J is an integer greater than or equal to 1 and less than or equal to q. Determine the first mask and the second mask corresponding to each of the J intervals, wherein the J intervals include the V intervals.
11. The method according to claim 10, characterized in that, Before obtaining the second rectangular region, each of the q intervals corresponds to a first mask and a second mask, and the bit values in the first mask and the second mask are all third values; determining the first mask and the second mask corresponding to each of the J intervals includes: Update some or all of the bit values in the first and second masks corresponding to each of the J intervals to a fourth value, wherein the fourth value is different from the third value.
12. The method according to claim 11, characterized in that, When the first mask corresponding to the R intervals indicates that the length unit overlapping with the first rectangular region and the second rectangular region overlap, and the second mask corresponding to the VR intervals indicates that the interval overlaps with the second rectangular region, the first rectangular region is hidden, including: When the bit value in the first mask corresponding to the length unit that overlaps with the first rectangular region in the R intervals is the fourth value, and the bit value in the second mask corresponding to the VR intervals is the fourth value, the first rectangular region is hidden.
13. The method according to claim 11 or 12, characterized in that, The third value is 0, and the fourth value is 1; or the third value is 1, and the fourth value is 0.
14. The method according to any one of claims 8-13, characterized in that, The values of p and q are both one of 8, 16, 32, and 64.
15. The method according to any one of claims 1-14, characterized in that, The image to be rendered is the (S+1)th frame image. The M rectangular regions included in the image to be rendered are determined based on all rendering nodes included in the Sth frame image and the changing rendering nodes, where S is an integer greater than or equal to 1. Alternatively, the image to be rendered is the (S+1)th frame image, and the M rectangular regions included in the image to be rendered are determined based on all rendering nodes included in the (S+1)th frame image, where S is an integer greater than or equal to 0.
16. The method according to any one of claims 1-15, characterized in that, After detecting that the rendering node corresponding to the first rectangular region is hidden, the method further includes: No drawing instructions are generated for the rendering node corresponding to the first rectangular area. The drawing instructions for the rendering node are used to draw the rendering node.
17. An electronic device, characterized in that, include: A processor, a memory, and a display screen, wherein the memory and the display screen are coupled to the processor, the memory is used to store program code including instructions, and the processor reads the instructions from the memory to cause the electronic device to perform the method as described in any one of claims 1-16.
18. A computer-readable storage medium, characterized in that, The computer-readable storage medium 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-16.
19. A computer program product, characterized in that, The computer program product includes: a computer program or instructions that, when run on a computer, cause the computer to perform the method as described in any one of claims 1-16.