View overdrawing detection method, device, readable medium and electronic device
By monitoring the visibility changes of page control views and automatically searching for root views and subviews for collision detection, the problem of overdrawing of control views is solved, the comprehensiveness and accuracy of overdrawing troubleshooting are improved, and time consumption is reduced.
Patent Information
- Application Number
- CN202411515400.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2044-10-28
AI Technical Summary
Excessive drawing between control views leads to increased hardware resource usage, affecting page loading efficiency and rendering effects. Existing technologies can only display the top-level visible content, requiring manual analysis, which is time-consuming and inefficient.
By monitoring the visibility changes of the page control views, automatically searching for the root view and subviews, performing collision detection, forming a control set, and determining that the intersection control views whose number of combined views is greater than the threshold are overdrawn.
Improved the comprehensiveness and accuracy of overdrawing troubleshooting, shortened the time and increased efficiency, and clarified the control view composition of the overdrawing area.
Smart Images

Figure CN119440949B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present disclosure relate to the field of computer technology, and more particularly, to a view over-rendering detection method, a view over-rendering detection device, a computer-readable medium, and an electronic device. Background Art
[0002] This section is intended to provide a background or context to the embodiments of the disclosure that are recited in the claims, and no statement herein is admitted to be prior art by inclusion in this section.
[0003] The control view is a visual display element contained in the page of the APP (Application). Each page can usually include multiple control views. During the page display process, the control view needs to be drawn so that it presents a display effect that meets the definition. When there is an overlapping relationship between control views, only the top layer of the jointly covered area is visible, but the lower layer will still be drawn in the same frame, resulting in the problem of overdrawing. Overdrawing will occupy additional hardware resources and even cause the APP to run stuck, affecting the page loading efficiency and presentation effect.
[0004] Currently, you can enable the GPU overdraw debugging function to display the areas of the page that have overdraw. However, simply displaying the areas with overdraw provides insufficient information. Subsequent analysis and optimization require more in-depth and detailed troubleshooting, which is time-consuming and inefficient. Summary of the Invention
[0005] In this context, embodiments of the present disclosure are intended to provide a view over-rendering detection method, a view over-rendering detection apparatus, a computer-readable medium, and an electronic device.
[0006] According to a first aspect of an embodiment of the present disclosure, a method for detecting over-drawing of views is provided, which may include: when a visibility change of a control view is detected on a page, obtaining a root view in the page; searching for sub-views of corresponding branches in the page based on the root view, and adding the root view and the sub-views as original control views to a control set; in the control set, taking the original control view in an unused state as a baseline control, performing collision detection with each other original control view in an unused state, and performing collision detection with each intersection control view that does not contain the baseline control, and setting the baseline control to a used state after the collision detection process is completed; wherein the baseline control is combined with the other original control views or the intersection control views that generate intersections during the collision detection process to form a newly added intersection control view in the control set; when all the original control views in the control set are in a used state, determining that the intersection control view whose number of combined views is greater than or equal to an excessive number threshold is over-drawn.
[0007] Optionally, when a visibility change of a control view is detected on a page, the root view in the page is obtained, including: when a visibility change of a control view is detected on a page, waiting for a preset loading time; when no visibility change of the control view occurs on the page within the preset loading time, obtaining the root view in the page.
[0008] Optionally, in the control set, the original control view in an unused state is used as a baseline control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the baseline control. After the collision detection process is completed, before setting the baseline control to a used state, the method further includes: filtering the original control views in the control set based on a pruning condition; the pruning condition is set based on the area covered by the drawing content of the original control view.
[0009] Optionally, the pruning condition includes at least one of the following:
[0010] Filtering the original control view without drawing content;
[0011] The original control views having drawn content and an area covered by the drawn content is smaller than or equal to a first preset area size are filtered.
[0012] Optionally, the pruning conditions include:
[0013] Filtering the original control views that have drawn content and whose area covered by the drawn content is greater than or equal to the second preset area size;
[0014] Furthermore, before determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is over-drawn, it also includes: when the original control views in the control set are all in use, the original control view with drawing content and the area covered by the drawing content is greater than or equal to the second preset area size is combined with each of the original control views or the intersection control views in the control set to form a newly added intersection control view in the control set.
[0015] Optionally, after determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is over-drawn, it also includes: when it is determined that the over-drawn intersection control view has an ignore mark, filtering based on the ignore mark; the ignore mark indicates that the over-drawing of the intersection control view is not processed.
[0016] Optionally, after determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is over-drawn, it also includes: in the intersection control view determined to be over-drawn, respectively obtaining the original view snapshot of each original control view; combining the intersection view snapshot corresponding to the intersection control view based on the original view snapshot; and writing the intersection view snapshot into a circular buffer pool.
[0017] Optionally, after writing the intersection view snapshot into the circular buffer pool, the method further includes: in response to a visualization request for the intersection view snapshot in the circular buffer pool, performing a visual hierarchical display based on the hierarchical relationship between the original view snapshots in the intersection view snapshot.
[0018] Optionally, the visual hierarchical display based on the hierarchical relationship between the original view snapshots in the intersection view snapshot further includes: displaying code information of the original view snapshot in response to a selection operation on the original view snapshot in the intersection view snapshot.
[0019] Optionally, the visual hierarchical display is based on the hierarchical relationship between the original view snapshots in the intersection view snapshot, and further includes: in response to an ignore operation on the intersection view snapshot, setting an ignore mark for the intersection control view corresponding to the intersection view snapshot; the ignore operation is used to indicate that over-drawing of the intersection control view corresponding to the intersection view snapshot shall not be processed.
[0020] Optionally, the method is applied to the client, and after setting the ignore mark for the intersection control view corresponding to the intersection view snapshot, the method further includes: synchronizing the intersection control view with the ignore mark to the server; the server is used to store the intersection control view with the ignore mark provided by at least one client, and when any client determines that the intersection control view is over-drawn, provide the intersection control view with the ignore mark to any client.
[0021] Optionally, after determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is over-drawn, it also includes: among the intersection control views determined to be over-drawn, analyzing at least one of the intersection control views, and providing corresponding modification suggestions based on the analysis; the modification suggestions include removing the background, reducing the hierarchy, and customizing the drawing area.
[0022] According to a second aspect of an embodiment of the present disclosure, a view overdrawing detection device is provided, which may include: a control view acquisition module, configured to acquire a root view in a page when monitoring a visibility change of a control view on the page; the control view acquisition module, further configured to search for subviews of corresponding branches in the page based on the root view, and add the root view and the subviews as original control views to a control set; a view collision detection module, configured to use the unused original control view in the control set as a reference control, perform collision detection with each other unused original control view, and perform collision detection with each intersection control view that does not contain the reference control, and set the reference control to a used state after the collision detection process is completed; wherein the reference control is combined with the other original control views or the intersection control views that intersect during the collision detection process to form a newly added intersection control view in the control set; and an overdrawing extraction module, configured to determine, when all the original control views in the control set are in a used state, that the intersection control view whose number of combined views is greater than or equal to an excessive number threshold is overdrawn.
[0023] Optionally, the control view acquisition module is specifically used to wait for a preset loading time when monitoring a visibility change of the control view on the page; when no visibility change of the control view occurs on the page within the preset loading time, obtain the root view in the page.
[0024] Optionally, the control view acquisition module is further configured to filter the original control views in the control set based on a pruning condition; the pruning condition is set based on an area covered by the drawing content of the original control view.
[0025] Optionally, the pruning condition includes at least one of the following:
[0026] Filtering the original control view without drawing content;
[0027] The original control views having drawn content and an area covered by the drawn content is smaller than or equal to a first preset area size are filtered.
[0028] Optionally, the pruning conditions include:
[0029] Filtering the original control views that have drawn content and whose area covered by the drawn content is greater than or equal to the second preset area size;
[0030] In addition, the view collision detection module is also used to combine the original control view with drawing content and the area covered by the drawing content greater than or equal to the second preset area size with each of the original control views or the intersection control view in the control set when all the original control views in the control set are in use, so as to form a newly added intersection control view in the control set.
[0031] Optionally, the over-drawing extraction module is further configured to, when it is determined that an ignore mark exists for the over-drawn intersection control view, perform filtering based on the ignore mark; the ignore mark indicates that the over-drawing of the intersection control view is not to be processed.
[0032] Optionally, the device also includes a view snapshot cache module, which is used to obtain the original view snapshot of each original control view in the intersection control view determined to be overdrawn; combine the intersection view snapshot corresponding to the intersection control view based on the original view snapshot; and write the intersection view snapshot into a circular buffer pool.
[0033] Optionally, the apparatus further comprises a view snapshot display module for responding to a visualization request for the intersection view snapshot in the circular buffer pool and performing a visual hierarchical display based on a hierarchical relationship between the original view snapshots in the intersection view snapshot.
[0034] Optionally, the view snapshot display module is further configured to display code information of the original view snapshot in response to a selection operation on the original view snapshot in the intersection view snapshot.
[0035] Optionally, the view snapshot display module is used to set an ignore mark for the intersection control view corresponding to the intersection view snapshot in response to an ignore operation on the intersection view snapshot; the ignore operation is used to indicate that over-drawing of the intersection control view corresponding to the intersection view snapshot shall not be processed.
[0036] Optionally, the device is applied to a client, and the device further includes: an ignore mark synchronization module, used to synchronize the intersection control view with the ignore mark to a server; the server is used to store the intersection control view with the ignore mark provided by at least one client, and when any client determines that the intersection control view is over-drawn, provide the intersection control view with the ignore mark to any client.
[0037] Optionally, the over-drawing analysis module is used to analyze at least one of the intersection control views determined to be over-drawn, and provide corresponding modification suggestions based on the analysis; the modification suggestions include at least one of removing the background, reducing the hierarchy, and customizing the drawing area.
[0038] According to a third aspect of the embodiments of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the computer program is executed by a processor, any one of the above-mentioned view overdrawing detection methods is implemented.
[0039] According to a fourth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to perform any of the above-mentioned view overdrawing detection methods by executing the executable instructions.
[0040] According to the view over-drawing detection method of the embodiment of the present disclosure, when a visibility change of a control view is detected on a page, the root view in the page is obtained, and then the sub-views of the corresponding branch are searched in the page based on the root view, and a control set is obtained with the root view and the sub-views as the original spatial views; in the control set, the original control view in an unused state is used as the baseline control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the baseline control, and the baseline control is set to the used state after the collision detection process is completed; wherein, the baseline control is combined with other original control views or intersection control views that generate intersections during the collision detection process to form a newly added intersection control view in the control set; when all original control views in the control set are in the used state, the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is determined to be over-drawn. This solution automatically monitors the visibility changes of control views on the page, triggers a page control view search based on the root view and subviews, and then performs collision detection on the control views and their combinations to check for possible overdrawing problems. It can clearly identify the control view composition of the overdrawing area, effectively improving the comprehensiveness and accuracy of overdrawing troubleshooting, and is time-saving and efficient. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] The above and other objects, features and advantages of the exemplary embodiments of the present disclosure will become readily understood by reading the detailed description below with reference to the accompanying drawings, in which several embodiments of the present disclosure are shown by way of example and not limitation, wherein:
[0042] Figure 1 One of the flowcharts of the view overdrawing detection method according to an embodiment of the present disclosure is shown.
[0043] Figure 2 A schematic diagram of the view tree structure in a page of an embodiment of the present disclosure is shown.
[0044] Figure 3 A schematic diagram of the collision detection principle of an embodiment of the present disclosure is shown.
[0045] Figure 4 The second flowchart of the view overdrawing detection method according to the embodiment of the present disclosure is shown.
[0046] Figure 5 The third step flow chart of the view overdrawing detection method according to the embodiment of the present disclosure is shown.
[0047] Figure 6 A schematic diagram of a ring buffer pool according to an embodiment of the present disclosure is shown.
[0048] Figure 7 A schematic diagram of an intersection view snapshot display interface according to an embodiment of the present disclosure is shown.
[0049] Figure 8 A schematic flow chart of the ignore mark management steps according to an embodiment of the present disclosure is shown.
[0050] Figure 9 A schematic diagram of a view over-drawing detection device according to an embodiment of the present disclosure is shown.
[0051] Figure 10 A schematic diagram of a computer-readable medium illustrating an embodiment of the present disclosure is shown.
[0052] Figure 11 A schematic diagram of an electronic device according to an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0053] The principles and spirit of the present disclosure will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are provided solely to enable those skilled in the art to better understand and implement the present disclosure, and are not intended to limit the scope of the present disclosure in any way. Rather, these embodiments are provided to make the present disclosure more thorough and complete, and to fully convey the scope of the present disclosure to those skilled in the art.
[0054] Those skilled in the art will appreciate that the embodiments of the present disclosure may be implemented as a system, apparatus, device, method, or computer program product. Therefore, the present disclosure may be implemented in the following forms: entirely in hardware, entirely in software (including firmware, resident software, microcode, etc.), or in a combination of hardware and software.
[0055] According to an embodiment of the present disclosure, a view over-rendering detection method, a view over-rendering detection device, a computer-readable medium, and an electronic device are provided.
[0056] In this document, any number of elements in the drawings is for illustration and not for limitation, and any naming is for distinction only and does not have any limiting meaning.
[0057] The principles and spirit of the present disclosure are described in detail below with reference to several representative embodiments of the present disclosure.
[0058] Any page in an app is typically composed of multiple control views, structured in a tree-like manner. From the root node, child nodes and their sub-nodes branch out layer by layer. Each node is a control view. When two or more control views overlap, the overlapping areas experience overdraw. In this case, only the topmost pair of views will see the overlapping areas, but the overlapped areas will also be drawn in the same frame, resulting in additional resource usage.
[0059] To address the above issues, the current common practice is to enable the native system's GPU over-drawing debugging function to display over-drawn areas on the page. However, this method can only display the top-level visible content in overlapping areas. Further manual analysis of the control views involved in the over-drawing is usually required to support subsequent control view optimization work, which is time-consuming and inefficient.
[0060] In the implementation manner of the present disclosure, by automatically monitoring the visibility changes of the control views on the page, triggering the page control view search based on the root view and subviews, and then performing collision detection on the control views and their combinations to check for possible over-drawing problems, the control view composition of the over-drawing area can be clarified, effectively improving the comprehensiveness and accuracy of over-drawing troubleshooting, saving time and increasing efficiency.
[0061] After introducing the basic principles of the present invention, various non-limiting embodiments of the present invention are described in detail below.
[0062] Example application scenarios
[0063] It should be noted that the following application scenarios are only provided to facilitate understanding of the spirit and principles of the present invention, and the embodiments of the present disclosure are not limited in this respect. On the contrary, the embodiments of the present disclosure can be applied to any applicable scenario.
[0064] The view over-drawing detection method of the embodiment of the present disclosure can be applied to a variety of application scenarios involving page development and view optimization as well as optimization of hardware resource utilization in page presentation.
[0065] In one application scenario, which may involve APP page development, overdraw detection is performed on control views during page development and device adaptation.
[0066] In another application scenario, view optimization may be involved during the actual display of the APP page, and the embodiments of the present disclosure do not impose specific restrictions on this.
[0067] Exemplary Methods
[0068] In combination with the above application scenarios, Figure 1 A view overdrawing detection method according to an exemplary embodiment of the present disclosure is described.
[0069] like Figure 1 One of the flowcharts of the view overdrawing detection method according to an exemplary embodiment of the present disclosure may include the following steps 101 to 104:
[0070] Step 101: When a visibility change of a control view is detected on a page, the root view of the page is obtained.
[0071] In the disclosed embodiment, the visibility changes of the control view can be monitored separately for each page that needs to be detected for over-drawing. Visibility is the display mechanism of the control view, including the transparency, display and hide status of the control, and can also be size, shape or size, etc. It can be seen that the visibility change of the control view will further cause the coverage relationship of the control view to change. Therefore, by monitoring the visibility changes, it can be further determined whether to perform subsequent collision detection and over-drawing troubleshooting based on the change in the coverage relationship of the control view. The above monitoring can be achieved by registering a corresponding listener for each page. Through the monitoring callback, a prompt will be triggered when the visibility change of the control view occurs on the page.
[0072] Furthermore, the page is a tree structure, constructed from nested control views. The root view is the control view corresponding to the root node in the tree structure. From the root node, all child nodes and their child nodes can be identified. When determining that the visibility of a control view on a page has changed, its root view can be retrieved based on the tree structure.
[0073] Step 102: Search for the subviews of the corresponding branches in the page based on the root view, and add the root view and the subviews as original control views to the control collection.
[0074] In the disclosed embodiment, after obtaining the root view, the tree structure can be searched from the root view to the end of the corresponding branch subviews on the page to obtain all subviews on the page. Based on this, the root view and subviews can be used as the original control views of the page to create a control collection containing the original control views. Subsequent overdraw detection is performed on the control collection.
[0075] like Figure 2 The diagram shows a view tree structure in a page according to an exemplary embodiment of the present disclosure. The page includes pages 201 that overlap each other. Page 201 includes control views A, B, C, D, E, F, and G. The nested relationship among the control views in page 201 can be represented as a view tree 202. In view tree 202, there are four layers, from control view A at the root node to control view G at the end node.
[0076] On this basis, when the visibility change of the control view is monitored in page 201, the root view A can be obtained, and based on the root view A, the subviews of the corresponding branch can be searched in the page to obtain subviews B, C, D, E, F, and G. The root view A and subviews B, C, D, E, F, and G are added to the control collection as the original control views of the page 201 for subsequent overdrawing detection.
[0077] Step 103: In the control set, an original control view in an unused state is used as a base control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the base control. After the collision detection process is completed, the base control is set to a used state; wherein, the base control is combined with other original control views or intersection control views that intersect during the collision detection process to form a newly added intersection control view in the control set.
[0078] In the disclosed embodiment, the overlapping relationship between control views can be determined through collision detection, and then overdrawing detection can be implemented based on the overlapping relationship. In the control set, each original control view can be subjected to collision detection one by one. The original control view that has not completed the collision detection is in the unused state, and the original control view that has completed the collision detection is set from the unused state to the used state. Before the first original control view in the control set completes the collision detection, each original control view is in the unused state; after the last original control view completes the collision detection, each original control view is in the used state.
[0079] Furthermore, unused original control views can serve as reference controls during collision detection. The reference control performs collision detection on each other unused original control view, as well as on each intersection control view that does not contain the reference control. The reference control is then combined with other original control views or intersection control views that intersect during collision detection to form a new intersection control view in the control collection. In a control collection, no intersection control view exists until collision detection is completed for the first original control view.
[0080] For example, the control collection includes original control views a, b, c, d, and e, all of which are unused. First, use original control view a as the base control and perform collision detection with original control views b, c, d, and e, respectively. The base control intersects with original control views b, d, and e, respectively.
[0081] Taking the original control views a and b as an example, the collision detection principle in the embodiment of the present disclosure is as follows: Figure 3 Schematic diagram. Taking the page corner as coordinates (0,0), the coordinate information of control view a on the page can be obtained, with the upper left endpoint coordinates (50,70) and the lower right endpoint coordinates (100,140); and the coordinate information of control view b, with the upper left endpoint coordinates (80,80) and the lower right endpoint coordinates (90,125). The shadow area 301 is the intersection of the original control views a and b. At this time, the coordinate information of the shadow area 301 can be obtained using the following algorithm.
[0082] MaxLeft=Max(ALeft,BLeft)
[0083] MaxTop=Max(ATop,BTop)
[0084] MinRIght=Min(ARight,BRight)
[0085] MinBottom=Min(ABottom,BBottom)
[0086] Also, the coordinates of the upper left endpoint and the lower right endpoint of the shadow area 301 surrounded by (MaxLeft, MaxTop), (MinRight, MinBottom) are (80, 80) and (100, 125).
[0087] The same logic can be applied to other original control views. According to the collision detection results, new intersection control views ab, ad, and ae are added to the control collection, and the baseline control at this time, that is, the original control view a, is set to the used state.
[0088] Next, using the original control view b as the baseline control, collision detection is performed with the original control views c, d, and e, as well as with the intersection control views ad and ae. Since the intersection control view ab already contains the baseline control for this round of collision detection, no further collision detection is performed. Since the baseline control intersects with the original control view c and the intersection control view ae, respectively, intersection control views bc and bae are added to the control collection, and the baseline control, the original control view b, is set to the used state.
[0089] The subsequent collision detection process of the original control views c, d, and e can be deduced in this way until the original control views a, b, c, d, and e are all in the used state.
[0090] Step 104: When all original control views in the control set are in a used state, it is determined that the intersection control views whose number of combined views is greater than or equal to an excessive number threshold are overdrawn.
[0091] In the embodiment of the present disclosure, after completing the collision detection of all original control views, the control set includes all the original control views in use and the newly added intersection control view. On this basis, the intersection control views in the control set are checked for over-drawing. The number of combined views refers to the number of single original control views contained in the intersection control view. Since the intersection control view is composed of different original control views that have a common area after collision detection, there is a problem of overlapping intersection areas, and the number of combined views corresponds to the number of drawing times. The excessive number threshold can be dynamically set according to actual conditions such as business characteristics, hardware conditions and network quality. For example, when the hardware configuration and network quality are high without affecting normal business, a higher excessive number threshold can be set; or, the excessive number threshold can also be a statically set custom value, such as 2, 3, 4, etc., and the embodiment of the present disclosure does not impose specific restrictions on this.
[0092] On this basis, in the intersection control view, when the number of combined views is greater than or equal to the excessive number threshold, it can be considered that there is an over-drawing problem, thereby completing the over-drawing detection on the page.
[0093] like Figure 4 The second flowchart of the view overdrawing detection method according to the exemplary embodiment of the present disclosure may include the following steps 401 to 407:
[0094] Step 401: When monitoring a visibility change of a control view on a page, wait for a preset loading time.
[0095] In the embodiment of the present disclosure, the visibility change of the control view may also occur during the page loading process, or when the page is in the animation playback state. Therefore, when the visibility change of the control view is monitored on the page, you can first wait for the preset loading time to determine whether the monitoring of the visibility change is called back multiple times within a certain period of time. The preset loading time can be set according to the loading speed of the page. The loading speed of the page may be affected by factors such as hardware conditions, network quality, and the number of page elements, or it can be a custom value. For example, the preset loading time can be set to 1 second, 1.5 seconds, 2 seconds, etc., and the embodiment of the present disclosure does not impose specific restrictions on this.
[0096] Step 402: When the visibility of the control view does not change on the page within the preset loading time, obtain the root view in the page.
[0097] In an embodiment of the present disclosure, when no new visibility change of the control view occurs on the page while waiting for the preset loading time, it can be considered that the control view visibility change that triggered the waiting for the preset loading time occurred when the page has been loaded or the animation has been played; conversely, if a new visibility change of the control view occurs on the page within the preset loading time, it is considered that the control view visibility change that triggered the waiting for the preset loading time occurred when the page has not been loaded or the animation has not been played, and at this time you can wait for the change in the page to end.
[0098] Furthermore, after monitoring the visibility change of the control view on the page and no new visibility change of the control view occurs on the page within the preset loading time, the root view acquisition of the subsequent steps is further triggered, thereby saving hardware resources and avoiding wasting resources by searching for redundant root views and subviews of the control view in the page.
[0099] For example, after monitoring the visibility change of the control view on the page and waiting for a preset loading time if no new visibility change of the control view occurs on the page, you can obtain the root view of the page through the API (Application Programming Interface): getWindow().getDecorView().
[0100] Step 403: Search the page for the subview of the corresponding branch based on the root view, and add the root view and the subview as original control views to the control collection.
[0101] In the embodiment of the present disclosure, step 403 may correspond to the relevant description of the aforementioned step 102, and will not be described again here to avoid repetition.
[0102] Step 404: Filter the original control views in the control set based on a pruning condition; the pruning condition is set based on the area covered by the drawing content of the original control view.
[0103] In the disclosed embodiment, the control collection created in step 403 includes all original control views in the page. Performing collision detection on all original control views is time-consuming and inefficient. Therefore, the original control views in the control collection can be filtered by setting pruning conditions. Pruning conditions can be set based on the area covered by the original control view's drawn content. Since the area covered by the original control view's drawn content is related to whether there is an intersection with other original control views, setting pruning conditions based on this can evaluate the probability of each original control view intersecting with other original control views. For example, if the area covered by the original control view's drawn content is large, the probability of intersecting with other original control views is high, while if it is low, it is low. Alternatively, depending on the layout of the original control views in the page, the probability of intersecting with other original control views may be high if the area covered by the original control view's drawn content is located at the center of the page, while if it is low, it is low, and so on. Therefore, by filtering the original control views in the control collection based on pruning conditions, it is possible to select the original control views that require subsequent collision detection based on actual needs, thereby reducing time and improving efficiency.
[0104] In an optional embodiment of the present disclosure, the pruning condition may include filtering original control views without drawing content.
[0105] In the disclosed embodiment, when an original control view has no drawn content, it has no area covered by the drawn content and therefore does not intersect with other original control views with drawn content, making it not an object of overdrawing analysis. This can be filtered by setting appropriate pruning conditions to avoid excessive collision detection.
[0106] In an optional embodiment of the present disclosure, the pruning condition may include filtering original control views that have drawn content and an area covered by the drawn content that is smaller than or equal to a first preset area size.
[0107] In the embodiment of the present disclosure, the size of the first preset area can be set according to the actual page size and the statistical index of the size of the area covered by the drawing content of the original control view. The statistical index can be the mean, median, standard deviation, etc. On this basis, the original control view may have drawing content, but the area covered by the drawing content is less than or equal to the first preset area size, so the probability of intersection with other original control views is low, or even if an intersection occurs, the impact on page loading is low due to the small common area, which is within the acceptable range set by technical personnel in this field according to actual needs. For example, the original control view is a backgroundless control view, and the area covered by its drawing content is smaller than the first preset area size, thus falling within the filtering range of the pruning condition.
[0108] The above pruning condition examples are set from the perspective of ensuring that the original control view does not intersect with other original control views, or that the impact of any intersection is within an acceptable range. Based on this concept, those skilled in the art may also set other pruning conditions to streamline the control set, or may also streamline the control set from other perspectives. This disclosure does not impose any specific limitations on this.
[0109] Step 405: In the control set, the original control view in an unused state is used as the base control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the base control. After the collision detection process is completed, the base control is set to the used state; wherein, the base control is combined with other original control views or intersection control views that intersect during the collision detection process to form a newly added intersection control view in the control set.
[0110] In the embodiment of the present disclosure, step 405 may correspond to the relevant description of the aforementioned step 103, and will not be described again here to avoid repetition.
[0111] Step 406: When all original control views in the control set are in a used state, determine that the intersection control views whose number of combined views is greater than or equal to an excessive number threshold are overdrawn.
[0112] In the embodiment of the present disclosure, step 406 may correspond to the relevant description of the aforementioned step 104, and will not be described again here to avoid repetition.
[0113] In an optional embodiment of the present disclosure, the pruning condition in step 404 may further include filtering original control views that have drawn content and an area covered by the drawn content that is greater than or equal to a second preset area size.
[0114] On this basis, the following step 407 may be further included before step 406:
[0115] Step 407: When all original control views in the control set are in the used state, the original control view with drawing content and the area covered by the drawing content is greater than or equal to the second preset area size is combined with each original control view or intersection control view in the control set to form a newly added intersection control view in the control set.
[0116] In the embodiment of the present disclosure, the second preset area size can be set according to the actual page size and the statistical index of the size of the area covered by the drawing content of the original control view. The statistical index can be the mean, median, standard deviation, etc. On this basis, the original control view has drawing content, and the area covered by the drawing content is greater than or equal to the second preset area size, so the probability of intersection with other original control views is high, which has a greater impact on page loading and is not within the acceptable range set by technical personnel in this field according to actual needs. For example, the original control view belongs to a full-screen control view or an extra-large control view, and the area covered by its drawing content is greater than the first preset area size, so it falls within the filtering range of the pruning condition. At this time, the filtered part of the original control view is combined with each original control view or intersection control view in the control set before step 406 to form a newly added intersection control view in the control set.
[0117] The above-mentioned example of pruning conditions is set from the perspective that the original control view will inevitably intersect with other original control views, and the impact of the intersection is not within an acceptable range. In step 404, the original control views of this part are filtered out, and collision detection is performed only on the remaining original control views. Since the original control views filtered out under the pruning condition will inevitably intersect, the filtered original control views can be added to each original control view or intersection control view in the control set after step 405 before step 406 for combination. In this process, the original control views that will inevitably intersect with each other unused original control view during collision detection are pre-filtered, which saves computing resources, and the original control views are directly added to the original control view drawing or intersection control view in the control set before step 406 to avoid omissions.
[0118] like Figure 5 The third step flow chart of the view overdrawing detection method according to the exemplary embodiment of the present disclosure may include the following steps 501 to 513:
[0119] Step 501: When a visibility change of a control view is detected on a page, the root view of the page is obtained.
[0120] Step 502: Search the page for the subviews of the corresponding branches based on the root view, and add the root view and the subviews as original control views to the control collection.
[0121] Step 503: In the control set, the original control view in an unused state is used as the base control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the base control. After the collision detection process is completed, the base control is set to the used state; wherein, the base control is combined with other original control views or intersection control views that intersect during the collision detection process to form a newly added intersection control view in the control set.
[0122] Step 504: When all original control views in the control set are in a used state, it is determined that the intersection control views whose number of combined views is greater than or equal to an excessive number threshold are overdrawn.
[0123] In the embodiment of the present disclosure, steps 501 to 504 may correspond to the aforementioned Figure 1 Steps 101 to 104 shown, or the aforementioned Figure 4 To avoid repetition, the descriptions of steps 401 to 408 are not repeated here.
[0124] Step 505: In the intersection control view determined to be overdrawn, obtain the original view snapshot of each original control view respectively.
[0125] In the disclosed embodiment, the overdrawn intersection control view is composed of different original control views. After rendering, when the drawn content needs to be displayed on the page, each original control view has a corresponding original view snapshot (Bitmap). The original view snapshot is a data structure used to represent an image, storing the image's pixel information, which is organized into a snapshot in a specific format and bit depth.
[0126] Step 506: Combine the intersection view snapshot corresponding to the intersection control view based on the original view snapshot.
[0127] Based on the original view snapshots, the original view snapshots can be combined into an intersection view snapshot corresponding to the intersection control view based on the nesting structure of the original control view within the intersection control view. The nesting structure of the original control view within the intersection control view can include the hierarchy and position of the original control view. The intersection view snapshot can provide the content that the intersection control view needs to display on the page, providing information about overdraw issues in a more intuitive and convenient manner.
[0128] Step 507: Write the intersection view snapshot into the ring buffer pool.
[0129] In the disclosed embodiment, the intersection view snapshot can be cached to save the intersection control views determined by overdrawing detection within a period of time, so as to facilitate the backtracking of overdrawing problem information. In this case, a circular buffer pool can be used for caching. The circular buffer pool has a predefined size. Assuming that the size of the circular buffer pool is m, and the visibility change monitoring interval of the control view in the page is n seconds, the circular buffer pool can write the intersection view snapshots with problems after overdrawing detection within the last m*n seconds; in addition, after the buffer zone of the circular buffer pool is full, the newly written intersection view snapshot will automatically overwrite the historical written content, thereby effectively saving memory consumption.
[0130] like Figure 6 A schematic diagram of a ring buffer pool according to an exemplary embodiment of the present disclosure is shown. The ring buffer pool size can be set to 60. Assuming the visibility change monitoring interval for control views in a page is 1 second, the ring buffer pool can write snapshots of intersection views with problems after overdrawing detection within the last 60 seconds.
[0131] exist Figure 6 In the example, the circular buffer pool can be divided into six buffers: 1, 2, 3, 4, 5, and 6. When writing an intersection view snapshot, writes are started from the starting position of number 1 in the order of numbers, and return to the starting position of number 1 along the order of 1, 2, 3, 4, 5, and 6 on the circular buffer pool. This indicates that the buffer is full. At this time, the newly written intersection view snapshot can overwrite the historical written content at the starting position of number 1 and thereafter.
[0132] In an optional method embodiment of the present disclosure, step 507 further includes the following step 508:
[0133] Step 508 : In response to the visualization request for the intersection view snapshot in the ring buffer pool, perform a visual hierarchical display based on the hierarchical relationship between the original view snapshots in the intersection view snapshot.
[0134] In an embodiment of the present disclosure, in the intersection view snapshot written to the ring buffer pool, a corresponding visualization request can be received, and a visual hierarchical display can be performed on any intersection view snapshot. In the visual hierarchical display, the original view snapshots are arranged based on the hierarchical relationship defined by the intersection view snapshot, so that the overlapping relationship between the original control views can be displayed intuitively and clearly. On this basis, operations such as selection, rotation, scaling, and movement of one or more original view snapshots in the intersection view snapshot can also be received to adjust the intersection view snapshot.
[0135] like Figure 7A schematic diagram of the intersection view snapshot display interface of an exemplary embodiment of the present disclosure is shown. The intersection view snapshot selection bar 701 provides a list of intersection view snapshots written to the ring buffer that have overdrawing issues. After the intersection view snapshot selection bar 701 receives a visualization request for intersection view snapshot a, intersection view snapshot a can be visualized hierarchically in the visualization display area 702. At this time, a combination of rotation and translation display effects can be used to achieve a three-dimensional hierarchical display.
[0136] In an optional method embodiment of the present disclosure, step 508 further includes the following step 509:
[0137] Step 509 : In response to the selection operation on the original view snapshot in the intersection view snapshot, code information of the original view snapshot is displayed.
[0138] In the disclosed embodiment, when a selection operation is received for an intersection view snapshot or an original view snapshot, code information may be further provided, including the ID name and layout name of the original control view corresponding to the original view snapshot. This code information facilitates rapid location and optimization of overdraw at the code level, effectively improving analysis efficiency.
[0139] like Figure 7 As shown, the level selection bar 703 also provides level selection keys for the intersection view snapshot a, including the first level, the second level, and the third level. When a selection operation is received for the second level, the original view snapshot of the second level is highlighted in the visual display area 702, and the code information such as the original control view ID name (id:view1) and the layout name (ayout:xxx.xml) corresponding to the original view snapshot of the second level is displayed in the code area 704 at the bottom bar.
[0140] In an optional method embodiment of the present disclosure, step 509 further includes the following step 510:
[0141] Step 510: In response to an ignore operation on the intersection view snapshot, an ignore mark is set for the intersection control view corresponding to the intersection view snapshot; the ignore operation is used to indicate that overdrawing of the intersection control view corresponding to the intersection view snapshot is not processed.
[0142] In an embodiment of the present disclosure, based on business needs, there may be situations where over-drawing does not need to be analyzed, processed, or optimized. An ignore operation for an intersection view snapshot may be received, and an ignore mark may be set for the intersection control view corresponding to the intersection view snapshot in response to the ignore operation. The ignore mark is used to indicate that over-drawing of the intersection control view corresponding to the intersection view snapshot is not to be processed. When over-drawing detection is subsequently performed, the analysis of the number of intersection control view combinations may be ignored when the intersection control view exists in a control set, or the subsequent analysis and processing flow may be ignored when it is determined that the number of view combinations has an over-drawing problem.
[0143] like Figure 7 As shown, a tag filter button 705 is also included. Upon receiving a selection operation on the tag filter button 705, an ignore mark can be set for the intersection control view corresponding to the intersection view snapshot currently displayed in the visualization display area 702. In subsequent rounds of overdrawing detection, the intersection control view with the ignore mark in the control set can be directly ignored in the overdrawing determination, or the subsequent analysis and processing flow can be ignored when overdrawing is determined to exist.
[0144] In an optional method embodiment of the present disclosure, the method may be applied to a client, and after step 510, the method further includes the following step 511:
[0145] Step 511: Synchronize the intersection control view with the ignore mark to the server; the server is used to store the intersection control view with the ignore mark provided by at least one client, and provide the intersection control view with the ignore mark to any client when any client determines that the intersection control view is overdrawn.
[0146] In the embodiment of the present disclosure, when the method is applied to the client, there is a client and server architecture. In the case of setting an ignore mark for the intersection control view, the client can synchronize the intersection control view with the ignore mark to the server. The server can receive data synchronized by one or more clients, and can provide data synchronized by other clients to the client, and can also provide data synchronized by the client to other clients. Thus, the intersection control view with the ignore mark can be shared among multiple clients. In actual applications, the client can synchronize the data of all intersection control views with the ignore mark from the server at different times such as startup, page display, before excessive collision detection, and after excessive collision detection. It can store all intersection control views with the ignore mark locally, and can also determine whether the ignore mark is set based on the intersection control view in the control set after excessive collision detection. The embodiment of the present disclosure does not impose specific restrictions on this.
[0147] In an optional embodiment of the present disclosure, the server may also provide an ignore mark management function to manage, maintain, and update data synchronized by multiple clients on the server, such as adding, deleting, or modifying ignore marks for intersection control views.
[0148] like Figure 8 The schematic diagram of the ignore mark management process of the exemplary embodiment of the present disclosure is shown, which includes a client and a server, the server can provide the ignore mark management function, and the ignore mark management process can include the following steps 801 to 805.
[0149] Step 801: The client obtains the intersection control view with the ignore flag 1 set from the server.
[0150] Step 802: The client filters the intersection control views in the control set based on the ignore flag 1.
[0151] Step 803: The client displays the remaining intersection control views that have overdrawing problems.
[0152] Step 804: The client sets an ignore flag 2 for the intersection control view in response to the ignore operation.
[0153] Step 805: The client synchronizes the intersection control view with the ignore flag 2 set to the server.
[0154] The above-mentioned markings of ignoring marks 1 and 2 are only used to distinguish scenes.
[0155] In an optional method embodiment of the present disclosure, the aforementioned step 504 further includes the following step 512:
[0156] Step 512: If it is determined that an ignore tag exists for the over-drawn intersection control view, filtering is performed based on the ignore tag; the ignore tag indicates that the over-drawing of the intersection control view is not processed.
[0157] In the disclosed embodiment, upon determining that an intersection control view has an overdrawing problem, further analysis may be performed to determine whether the intersection control view is set with an ignore flag. The ignore flag may correspond to the description of steps 510 to 511 above, and will not be described again here to avoid repetition. If the intersection control view is set with an ignore flag, the subsequent analysis and processing flow may be ignored.
[0158] For example, the intersection control views with overdrawing issues include "A+B+D", "A+B+G", "A+E+F", "A+F+G", "A+E+G", and "A+E+F+G". Among them, "A+E+F" and "A+F+G" are set to be ignored. In this case, they are filtered to obtain the intersection control views "A+B+D", "A+B+G", "A+E+G", and "A+E+F+G" for subsequent analysis and processing.
[0159] In an optional method embodiment of the present disclosure, the aforementioned step 504 further includes the following step 513:
[0160] Step 513: Analyze at least one intersection control view among the intersection control views that are determined to be overdrawn, and provide corresponding modification suggestions based on the analysis; the modification suggestions include at least one of removing the background, reducing the level, and customizing the drawing area.
[0161] In the embodiment of the present disclosure, for an intersection control view that is determined to have an overdrawing problem, an automated analysis can be performed on the overdrawing problem, and corresponding modification suggestions can be provided based on the background settings, hierarchical relationships, etc. of the original view control. The modification suggestions can be as follows:
[0162] Remove the background: For example, if the ImageView component sets both imageDrawable and background, its background will often be completely covered by imageDrawable. In this case, the background is unnecessary and it is recommended to remove it.
[0163] Reduce the hierarchy: For example, when the intersection view controls of complex layout hierarchies are implemented using traditional layout methods, it will lead to serious layout nesting and too deep a hierarchy. In this case, it is recommended to use RelativeLayout, ConstraintLayout, etc. to flatten the layout hierarchy, and it is recommended to use include, merge, and Viewstub tags to reduce the hierarchy and optimize the layout.
[0164] Customize the drawing area: For example, it is recommended to use the onDraw method to customize the view. When drawing pictures, you can use methods such as clipRect of Canvas to control the drawing of only the area that needs to be drawn.
[0165] In an optional embodiment of the present disclosure, when the intersection view snapshot is displayed in a visual hierarchical manner, modification suggestions for the corresponding intersection control view may be displayed accordingly.
[0166] like Figure 7As shown, the intersection control view corresponding to the intersection view snapshot being displayed in the visual display area 702 is analyzed to obtain modification suggestions, which are then displayed in the suggestion area 706 at the bottom bar.
[0167] According to the view over-drawing detection method of the embodiment of the present disclosure, when a visibility change of a control view is detected on a page, the root view in the page is obtained, and then the sub-views of the corresponding branch are searched in the page based on the root view, and a control set is obtained with the root view and the sub-views as the original spatial views; in the control set, the original control view in an unused state is used as the baseline control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the baseline control, and the baseline control is set to the used state after the collision detection process is completed; wherein, the baseline control is combined with other original control views or intersection control views that generate intersections during the collision detection process to form a newly added intersection control view in the control set; when all original control views in the control set are in the used state, the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is determined to be over-drawn. This solution automatically monitors the visibility changes of control views on the page, triggers a page control view search based on the root view and subviews, and then performs collision detection on the control views and their combinations to check for possible overdrawing problems. It can clearly identify the control view composition of the overdrawing area, effectively improving the comprehensiveness and accuracy of overdrawing troubleshooting, and is time-saving and efficient.
[0168] Exemplary devices
[0169] After introducing the view overdrawing detection method according to the exemplary embodiment of the present disclosure, Figure 9 A view overdrawing detection apparatus according to an exemplary embodiment of the present disclosure will be described.
[0170] It should be noted that other specific details of the functional modules of the view over-rendering detection apparatus according to the embodiment of the present disclosure have been described in detail in the embodiment of the view over-rendering detection method described above and will not be repeated here.
[0171] Figure 9A view overdrawing detection device 900 according to an exemplary embodiment of the present disclosure is shown. The device 900 may include: a control view acquisition module 901, configured to acquire a root view in a page when monitoring a visibility change of a control view on the page; the control view acquisition module 901, further configured to search for subviews of corresponding branches in the page based on the root view, and add the root view and the subviews as original control views to a control set; a view collision detection module 902, configured to use an unused original control view as a reference control in the control set, perform collision detection with each other unused original control view, and perform collision detection with each intersection control view that does not contain the reference control, and set the reference control to a used state after the collision detection process is completed; wherein the reference control is combined with other original control views or intersection control views that intersect during the collision detection process to form a newly added intersection control view in the control set; and an overdrawing extraction module 903, configured to determine, when all original control views in the control set are in a used state, that an intersection control view whose number of combined views is greater than or equal to an overdrawing threshold is an overdrawn view.
[0172] In an optional embodiment of the present disclosure, the control view acquisition module 901 is specifically used to wait for a preset loading time when monitoring a visibility change of the control view on the page; when no visibility change of the control view occurs on the page within the preset loading time, obtain the root view in the page.
[0173] In an optional embodiment of the present disclosure, the control view acquisition module 901 is further configured to filter the original control views in the control set based on a pruning condition; the pruning condition is set based on the area covered by the drawing content of the original control view.
[0174] In an optional embodiment of the present disclosure, the pruning condition includes at least one of the following:
[0175] Filter the original control view without drawing content;
[0176] Filter original control views that have drawn content and whose area covered by the drawn content is smaller than or equal to the first preset area size.
[0177] In an optional embodiment of the present disclosure, the pruning conditions include:
[0178] Filtering original control views that have drawn content and whose area covered by the drawn content is greater than or equal to the size of a second preset area;
[0179] In addition, the view collision detection module 902 is also used to combine the original control view with drawing content and the area covered by the drawing content greater than or equal to the second preset area size with each original control view or intersection control view in the control set when all original control views in the control set are in use, so as to form a newly added intersection control view in the control set.
[0180] In an optional embodiment of the present disclosure, the over-drawing extraction module 903 is further used to filter based on the ignore mark when it is determined that the over-drawn intersection control view has an ignore mark; the ignore mark indicates that the over-drawing of the intersection control view is not processed.
[0181] In an optional embodiment of the present disclosure, the device also includes a view snapshot cache module, which is used to obtain the original view snapshot of each original control view in the intersection control view determined to be overdrawn; combine the intersection view snapshot corresponding to the intersection control view based on the original view snapshot; and write the intersection view snapshot into a circular buffer pool.
[0182] In an optional embodiment of the present disclosure, the device further includes a view snapshot display module for responding to a visualization request for an intersection view snapshot in the circular buffer pool and performing a visual hierarchical display based on the hierarchical relationship between the original view snapshots in the intersection view snapshot.
[0183] In an optional embodiment of the present disclosure, the view snapshot display module is further configured to display code information of the original view snapshot in response to a selection operation on the original view snapshot in the intersection view snapshot.
[0184] In an optional embodiment of the present disclosure, the view snapshot display module is used to set an ignore mark for the intersection control view corresponding to the intersection view snapshot in response to an ignore operation on the intersection view snapshot; the ignore operation is used to indicate that over-drawing of the intersection control view corresponding to the intersection view snapshot shall not be processed.
[0185] In an optional embodiment of the present disclosure, the device is applied to a client, and the device also includes: an ignore mark synchronization module, which is used to synchronize the intersection control view with the ignore mark to the server; the server is used to store the intersection control view with the ignore mark provided by at least one client, and when any client determines that the intersection control view is over-drawn, provide the intersection control view with the ignore mark to any client.
[0186] In an optional embodiment of the present disclosure, an over-drawing analysis module is used to analyze at least one intersection control view among the intersection control views determined to be over-drawn, and provide corresponding modification suggestions based on the analysis; the modification suggestions include at least one of removing the background, reducing the hierarchy, and customizing the drawing area.
[0187] According to the view over-drawing detection device of the embodiment of the present disclosure, when a visibility change of a control view is monitored on a page, the root view in the page is obtained, and then the sub-views of the corresponding branch are searched in the page based on the root view, and a control set is obtained with the root view and the sub-views as the original spatial views; in the control set, the original control view in an unused state is used as the baseline control, and collision detection is performed with each other original control view in an unused state, and with each intersection control view that does not contain the baseline control, and after the collision detection process is completed, the baseline control is set to the used state; wherein, the baseline control is combined with other original control views or intersection control views that generate intersections during the collision detection process to form a newly added intersection control view in the control set; when all original control views in the control set are in the used state, the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is determined to be over-drawn. This solution automatically monitors the visibility changes of control views on the page, triggers a page control view search based on the root view and subviews, and then performs collision detection on the control views and their combinations to check for possible overdrawing problems. It can clearly identify the control view composition of the overdrawing area, effectively improving the comprehensiveness and accuracy of overdrawing troubleshooting, and is time-saving and efficient.
[0188] It should be noted that although several modules or units of the view overdrawing detection device are mentioned in the detailed description above, such division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided to be embodied by multiple modules or units.
[0189] Exemplary computer-readable media
[0190] The following describes a computer-readable medium according to an exemplary embodiment of the present disclosure.
[0191] In this exemplary embodiment, referring to Figure 10 As shown, a program product 1000 for implementing the above method according to an exemplary embodiment of the present disclosure is described. For example, a portable compact disk read-only memory (CD-ROM) may be used and includes program code, and can be run on a device such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a computer-readable medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0192] The program product 1000 can be implemented in any combination of one or more readable media. The readable medium can be a readable signal medium or a computer-readable medium. The computer-readable medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination thereof. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0193] A computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A readable signal medium may also be any readable medium other than a computer-readable medium that can transmit, propagate, or transfer a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0194] The program code contained on the readable medium can be transmitted using any appropriate medium, including but not limited to wireless, wired, optical fiber cable, RE, etc., or any suitable combination of the foregoing.
[0195] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, and the like, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device via any type of network, including a local area network (FAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., via the Internet using an Internet service provider).
[0196] Exemplary electronic devices
[0197] refer to Figure 11 An electronic device according to an exemplary embodiment of the present disclosure will be described.
[0198] Figure 11 The electronic device 1100 shown is merely an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0199] like Figure 11 As shown, electronic device 1100 is implemented as a general-purpose computing device. Components of electronic device 1100 may include, but are not limited to, at least one processing unit 1110, at least one storage unit 1120, a bus 1130 connecting various system components (including storage unit 1120 and processing unit 1110), and a display unit 1140.
[0200] The storage unit stores program codes, which can be executed by the processing unit 1110, so that the processing unit 1110 performs the steps described in the "Exemplary Method" section of the present specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 1110 can perform the following steps: Figure 1 The method steps shown, etc.
[0201] The storage unit 1120 may include a volatile storage unit, such as a random access memory unit (RAM) 1121 and / or a cache memory unit 1122 , and may further include a read-only memory unit (ROM) 1123 .
[0202] The storage unit 1120 may also include a program / utility 1124 having a set (at least one) of program modules 1125, such program modules 1125 including but not limited to: an operating system, one or more server applications, other program modules and program data, each of which or some combination may include an implementation of a network environment.
[0203] The bus 1130 may include a data bus, an address bus, and a control bus.
[0204] The electronic device 1100 can also communicate with one or more external devices 1200 (e.g., a keyboard, a pointing device, a Bluetooth device, etc.), and such communication can be performed via an input / output (I / O) interface 1150. The electronic device 1100 also includes a display unit 1140, which is connected to the input / output (I / O) interface 1150 for display. In addition, the electronic device 1100 can also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network such as the Internet) via a network adapter 1160. As shown, the network adapter 1160 communicates with other modules of the electronic device 1100 via a bus 1130. It should be understood that although not shown in the figure, other hardware and / or software modules can be used in conjunction with the electronic device 1100, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0205] It should be noted that although several modules or submodules of the device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more units / modules described above can be embodied in a single unit / module. Conversely, the features and functions of a single unit / module described above can be further divided and embodied by multiple units / modules.
[0206] Furthermore, although the operations of the disclosed method are described in a particular order in the accompanying drawings, this does not require or imply that the operations must be performed in this particular order, or that all illustrated operations must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps.
[0207] Although the spirit and principles of the present disclosure have been described with reference to several specific embodiments, it should be understood that the present disclosure is not limited to the specific embodiments disclosed, and the division into various aspects does not mean that the features in these aspects cannot be combined to benefit. Such division is only for the convenience of expression. The present disclosure is intended to cover various modifications and equivalent arrangements included in the spirit and scope of the appended claims.
Claims
1. A view overdrawing detection method, characterized in that: The method comprises: When monitoring the visibility change of the control view on the page, obtain the root view of the page; Searching for a subview of a corresponding branch in the page based on the root view, and adding the root view and the subview as original control views to a control collection; In the control set, the original control view in an unused state is used as a reference control, and collision detection is performed with each other original control view in an unused state, as well as with each intersection control view that does not contain the reference control, and after the collision detection process is completed, the reference control is set to a used state; wherein, the reference control is combined with the other original control views or the intersection control views that generate intersections during the collision detection process to form a newly added intersection control view in the control set; When all the original control views in the control set are in a used state, it is determined that the intersection control views whose number of combined views is greater than or equal to an excessive number threshold are overdrawn.
2. The method according to claim 1, characterized in that When monitoring a visibility change of a control view on a page, obtaining a root view in the page includes: When monitoring the visibility change of the control view on the page, wait for the preset loading time; When no visibility change of the control view occurs on the page within the preset loading time, the root view in the page is obtained.
3. The method according to claim 1, characterized in that In the control set, taking the original control view in an unused state as a reference control, performing collision detection with each of the other original control views in an unused state, and performing collision detection with each intersection control view that does not contain the reference control, and before setting the reference control to a used state after the collision detection process is completed, the method further includes: The original control views in the control set are filtered based on a pruning condition; the pruning condition is set based on an area covered by the drawing content of the original control view.
4. The method according to claim 3, characterized in that The pruning conditions include at least one of the following: Filtering the original control view without drawing content; The original control views having drawn content and an area covered by the drawn content is smaller than or equal to a first preset area size are filtered.
5. The method according to claim 3, characterized in that The pruning conditions include: Filtering the original control views that have drawn content and whose area covered by the drawn content is greater than or equal to the second preset area size; Furthermore, before determining that the intersection control view whose number of combined views is greater than or equal to an excessive number threshold is overdrawn, the method further includes: When all the original control views in the control set are in the used state, the original control view with drawing content and an area covered by the drawing content greater than or equal to the second preset area size will be combined with each of the original control views or the intersection control views in the control set to form a newly added intersection control view in the control set.
6. The method according to claim 1, characterized in that After determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is overdrawn, the method further includes: When it is determined that the overdrawn intersection control view has an ignore tag, filtering is performed based on the ignore tag; the ignore tag indicates that the overdrawing of the intersection control view is not to be processed.
7. The method according to claim 1, characterized in that After determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is overdrawn, the method further includes: In the intersection control view determined to be overdrawn, respectively obtaining an original view snapshot of each original control view; Combining the intersection view snapshot corresponding to the intersection control view based on the original view snapshot; The intersection view snapshot is written to a ring buffer pool.
8. The method according to claim 7, characterized in that After writing the intersection view snapshot into the ring buffer pool, the method further includes: In response to a visualization request for the intersection view snapshot in the ring buffer pool, a visual hierarchical presentation is performed based on the hierarchical relationship between the original view snapshots in the intersection view snapshot.
9. The method according to claim 8, characterized in that The step of performing a visual hierarchical display based on the hierarchical relationship between the original view snapshots in the intersection view snapshot further includes: In response to a selection operation on the original view snapshot in the intersection view snapshot, code information of the original view snapshot is displayed.
10. The method according to claim 7, characterized in that The step of performing a visual hierarchical display based on the hierarchical relationship between the original view snapshots in the intersection view snapshot further includes: In response to an ignore operation on the intersection view snapshot, an ignore mark is set for the intersection control view corresponding to the intersection view snapshot; the ignore operation is used to indicate that overdrawing of the intersection control view corresponding to the intersection view snapshot is not processed.
11. The method according to claim 10, characterized in that The method is applied to a client, and after setting an ignore mark for the intersection control view corresponding to the intersection view snapshot, the method further includes: The intersection control view with the ignore mark is synchronized to the server; the server is used to store the intersection control view with the ignore mark provided by at least one client, and when any client determines that the intersection control view is overdrawn, the server provides the intersection control view with the ignore mark to any client.
12. The method according to claim 1, characterized in that After determining that the intersection control view whose number of combined views is greater than or equal to the excessive number threshold is overdrawn, the method further includes: Among the intersection control views determined to be overdrawn, at least one of the intersection control views is analyzed, and corresponding modification suggestions are provided based on the analysis; the modification suggestions include at least one of removing the background, reducing the level, and customizing the drawing area.
13. A view overdrawing detection device, characterized in that: The device comprises: The control view acquisition module is used to obtain the root view of the page when monitoring the visibility change of the control view on the page; The control view acquisition module is further configured to search for subviews of corresponding branches in the page based on the root view, and add the root view and the subviews as original control views to the control set; A view collision detection module is configured to, in the control set, use the original control view in an unused state as a reference control, perform collision detection with each other original control view in an unused state, and perform collision detection with each intersection control view that does not contain the reference control, and set the reference control to a used state after the collision detection process is completed; wherein the reference control is combined with the other original control views or the intersection control views that intersect during the collision detection process to form a newly added intersection control view in the control set; The over-drawing extraction module is configured to determine, when all the original control views in the control set are in a used state, that the intersection control views whose number of combined views is greater than or equal to an excessive number threshold are over-drawing.
14. The device according to claim 13, characterized in that The control view acquisition module is specifically used to wait for a preset loading time when monitoring a visibility change of the control view on the page; when no visibility change of the control view on the page occurs within the preset loading time, obtain the root view in the page.
15. The device according to claim 13, characterized in that The control view acquisition module is further configured to filter the original control views in the control set based on a pruning condition; the pruning condition is set based on an area covered by the drawing content of the original control view.
16. The device according to claim 15, characterized in that The pruning conditions include at least one of the following: Filtering the original control view without drawing content; The original control views having drawn content and an area covered by the drawn content is smaller than or equal to a first preset area size are filtered.
17. The device according to claim 15, characterized in that The pruning conditions include: Filtering the original control views that have drawn content and whose area covered by the drawn content is greater than or equal to the second preset area size; In addition, the view collision detection module is also used to combine the original control view with drawing content and the area covered by the drawing content greater than or equal to the second preset area size with each of the original control views or the intersection control view in the control set when all the original control views in the control set are in use, so as to form a newly added intersection control view in the control set.
18. The device according to claim 13, characterized in that The over-drawing extraction module is further configured to perform filtering based on an ignore mark when determining that the over-drawn intersection control view has an ignore mark; the ignore mark indicates that the over-drawing of the intersection control view is not to be processed.
19. The device according to claim 13, characterized in that The device also includes a view snapshot caching module, which is used to obtain the original view snapshot of each original control view in the intersection control view determined to be overdrawn; combine the intersection view snapshot corresponding to the intersection control view based on the original view snapshot; and write the intersection view snapshot into a circular buffer pool.
20. The device according to claim 19, characterized in that The apparatus further includes a view snapshot display module configured to respond to a visualization request for the intersection view snapshot in the ring buffer pool and perform a visual hierarchical display based on a hierarchical relationship between the original view snapshots in the intersection view snapshot.
21. The device according to claim 20, characterized in that The view snapshot display module is further configured to display code information of the original view snapshot in response to a selection operation on the original view snapshot in the intersection view snapshot.
22. The device according to claim 20, characterized in that The view snapshot display module is used to set an ignore mark for the intersection control view corresponding to the intersection view snapshot in response to an ignore operation on the intersection view snapshot; the ignore operation is used to indicate that overdrawing of the intersection control view corresponding to the intersection view snapshot shall not be processed.
23. The device according to claim 22, characterized in that The device is applied to a client, and the device further includes: An ignore mark synchronization module is used to synchronize the intersection control view with the ignore mark to the server; the server is used to store the intersection control view with the ignore mark provided by at least one client, and when any client determines that the intersection control view is over-drawn, provide the intersection control view with the ignore mark to any client.
24. The device according to claim 13, characterized in that The over-drawing analysis module is used to analyze at least one of the intersection control views determined to be over-drawn, and provide corresponding modification suggestions based on the analysis; the modification suggestions include at least one of removing the background, reducing the hierarchy, and customizing the drawing area.
25. A computer-readable medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the view overdrawing detection method according to any one of claims 1 to 12 is implemented.
26. An electronic device, characterized in that: include: processor; as well as a memory for storing executable instructions of the processor; The processor is configured to perform the view overdrawing detection method according to any one of claims 1 to 12 by executing the executable instructions.
Citation Information
Patent Citations
Overdraw evaluation method and system
CN108389151A
Method and system for recognizing transition drawing
CN113568840A