View data processing method and device, electronic equipment and storage medium
By building canvas arrays and cache arrays, cache and draw subviews in turn, the problem of lag caused by large cache occupancy when the computer draws list views is solved, and efficient view display and fluency improvement are achieved.
Patent Information
- Application Number
- CN202510169807.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-17
- Publication Date
- 2025-07-04
AI Technical Summary
During the computer drawing list view, due to the large amount of data in the item to be drawn, the cache occupies a large amount, causing the computer to stutter.
Build a canvas array and a cache array. The cache array is used to cache the subviews drawn by the sub-canvas object, and cache the subviews of the item to be drawn to the cache array, and draw them to the canvas array in sequence according to the preset number to realize the sliding refresh display of the sub-view.
While meeting the display efficiency, it saves cache space, improves fluency, avoids repeated cache of all subviews, and reduces computer lag.
Smart Images

Figure CN120259480A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and particularly relates to a view data processing method, apparatus, electronic device, and storage medium. Background Art
[0002] In the process of a computer drawing a list view, different parts of the drawing can be viewed through a swipe refresh operation. In the related art, usually all the items to be drawn are loaded into the cache and generated all at once. However, due to the large amount of data of the items to be drawn, the cache occupied is large, resulting in the computer being prone to jamming. Figure 1 Once generated, but due to the large amount of data of the items to be drawn, the cache occupied is large, resulting in the computer being prone to jamming. Summary of the Invention
[0003] In order to solve at least one of the above-mentioned technical problems, the present disclosure provides a view data processing method, apparatus, electronic device, and storage medium.
[0004] On the one hand, the present disclosure provides a view data processing method, the method including:
[0005] Construct a canvas array, the canvas array includes at least three sub-canvas objects, the at least three sub-canvas objects include a first canvas object, a second canvas object, and at least one first display canvas object, the at least one first display canvas object is arranged in sequence, the first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object, and each sub-canvas object is used to draw a sub-view, and the sub-view is a sub-view in the item to be drawn;
[0006] Construct a cache array, the cache array is used to cache the sub-views drawn by the at least three sub-canvas objects;
[0007] Cache a preset number of sub-views in the item to be drawn into the cache array, the item to be drawn includes at least three sub-views, and the preset number is the same as the number of sub-canvas objects;
[0008] Draw the sub-views cached in the cache array onto the canvas array in sequence, the sub-views drawn in the at least one first display canvas object are used for display in the display area, and the sub-views drawn in the first canvas object and the second canvas object are used for display after the display area is swiped and refreshed.
[0009] In an optional embodiment, the widths of the sub-canvas objects are equal, and the sliding length corresponding to each swipe refresh operation is equal to the width of the sub-canvas object.
[0010] In an optional embodiment, the number of sub-views cached in the cache array is not greater than the number of sub-canvas objects.
[0011] In an optional embodiment, the widths of the sub-views in the item to be drawn are equal, and the method further includes:
[0012] Obtain the width information corresponding to the sub-views;
[0013] According to the width information, perform a division process on the display area to obtain at least one sub-display area, and the first display canvas object corresponds to the sub-display area one by one;
[0014] Copy the sub-views drawn by at least one first display canvas object to at least one sub-display area, so as to realize the display of the sub-views drawn in at least one first display canvas object.
[0015] In an optional embodiment, the method further includes:
[0016] In response to a sliding refresh operation on the display area, determine the sliding direction information corresponding to the sliding refresh operation;
[0017] When the sliding direction information indicates that the sliding direction is the target sliding direction, translate at least three sub-canvas objects by the length of one sub-canvas object in the direction from the second canvas object to the first canvas object, so as to change the corresponding relationship between at least one sub-display area and at least three sub-canvas objects, and the target sliding direction is the direction from the first canvas object to the second canvas object;
[0018] Copy the sub-views drawn in the sub-canvas object currently corresponding to at least one sub-display area to at least one sub-display area.
[0019] In an optional embodiment, each sub-view is configured with a corresponding view label, and the sub-views cached in the cache array are arranged in sequence according to the view labels corresponding to the sub-views. After copying the sub-views drawn in the sub-canvas object currently corresponding to at least one sub-display area to at least one sub-display area, the method further includes:
[0020] Determine a first target sub-view and a second target sub-view according to the view index corresponding to the sub-view drawn in the second display canvas object. The first target sub-view is the sub-view in the first canvas object cached in the cache array, and the second target sub-view is the sub-view in the item to be drawn that is adjacent to the view label of the sub-view in the second canvas object and is not cached in the cache array;
[0021] Delete the first target sub-view from the cache array;
[0022] Cache the second target sub-view into the cache array.
[0023] In an optional embodiment, after caching the second target sub-view into the cache array, the method further includes:
[0024] Construct a third canvas object, and the position of the third canvas object is adjacent to the second canvas object;
[0025] Draw the second target sub-views cached in the cache array in the third canvas object.
[0026] In a second aspect, the present invention further provides a view data processing device, including:
[0027] A first construction module for constructing a canvas array, the canvas array includes at least three sub-canvas objects, the at least three sub-canvas objects include a first canvas object, a second canvas object, and at least one first display canvas object, the at least one first display canvas object is arranged in sequence, the first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object, and each sub-canvas object is used to draw a sub-view, and the sub-view is a sub-view in the item to be drawn;
[0028] A second construction module for constructing a cache array, and the cache array is used to cache the sub-views drawn by the at least three sub-canvas objects;
[0029] A cache module for caching a preset number of sub-views in the item to be drawn into the cache array, the item to be drawn includes at least three sub-views, and the preset number is the same as the number of sub-canvas objects;
[0030] A drawing module for sequentially drawing the sub-views cached in the cache array into the canvas array, and the sub-views drawn in the at least one first display canvas object are used for display in the display area, and the sub-views drawn in the first canvas object and the second canvas object are used for display after the display area is slid and refreshed.
[0031] In a third aspect, the present invention further provides an electronic device, including:
[0032] A processor;
[0033] A memory for storing processor-executable instructions;
[0034] Wherein, the processor is used to execute instructions to implement the above view data processing method.
[0035] In a fourth aspect, the present invention further provides a storage medium, when the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the above view data processing method.
[0036] It should be understood that the above general description and the following detailed description are only exemplary and explanatory, and do not limit the present disclosure.
[0037] Implementing the present disclosure has the following beneficial effects:
[0038] Construct a canvas array, where the canvas array includes at least three sub - canvas objects. The at least three sub - canvas objects include a first canvas object, a second canvas object, and at least one first display canvas object. The at least one first display canvas object is arranged in sequence. The first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object. Each sub - canvas object is used to draw a sub - view, and the sub - view is a sub - view in the item to be drawn; construct a cache array, and the cache array is used to cache the sub - views drawn by the at least three sub - canvas objects; cache a preset number of sub - views in the item to be drawn into the cache array. The item to be drawn includes at least three sub - views, and the preset number is the same as the number of sub - canvas objects; draw the sub - views cached in the cache array onto the canvas array in sequence. The sub - views drawn in the at least one first display canvas object are used for display in the display area, and the sub - views drawn in the first canvas object and the second canvas object are used for display after the display area is swiped and refreshed.
[0039] The present disclosure constructs a canvas array and a cache array, caches a preset number of sub - views in the item to be drawn into the cache array, and draws the sub - views cached in the cache array onto the canvas array in sequence, which can cache and draw the sub - views that need to be displayed currently and after the next swipe update, avoiding caching all the sub - views in the item to be drawn, saving cache space while meeting the display efficiency, and improving the fluency.
[0040] According to the following detailed description of the exemplary embodiments with reference to the accompanying drawings, other features and aspects of the present disclosure will become clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for use in the description of the embodiments or the prior art. Obviously, the following - described drawings are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings. The accompanying drawings here are incorporated into the specification and constitute a part of this specification, showing the embodiments in line with the present disclosure, and are used together with the specification to explain the principles of the present disclosure, and do not constitute an improper limitation of the present disclosure.
[0042] Figure 1 is a schematic diagram of an implementation environment shown according to an exemplary embodiment;
[0043] Figure 2 is a flowchart of a view data processing method shown according to an exemplary embodiment;
[0044] Figure 3 is a schematic diagram of a canvas array shown according to an exemplary embodiment;
[0045] Figure 4 It is a schematic diagram showing caching a preset number of sub - views in a project to be drawn into a cache array according to an exemplary embodiment;
[0046] Figure 5 It is a schematic diagram showing sequentially drawing the sub - views cached in the cache array onto a canvas array according to an exemplary embodiment;
[0047] Figure 6 It is a schematic diagram of a sub - display area according to an exemplary embodiment;
[0048] Figure 7 It is a schematic diagram showing copying each sub - view drawn by at least one first display canvas object to at least one sub - display area according to an exemplary embodiment;
[0049] Figure 8 It is a schematic diagram of a view data processing device according to an exemplary embodiment;
[0050] Figure 9 It is a block diagram of an electronic device for view data processing according to an exemplary embodiment. Detailed implementation manners
[0051] Next, the technical solutions in the embodiments of this specification will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of this specification. Obviously, the described embodiments are only a part of the embodiments of this specification, rather than all the embodiments. Based on the embodiments in this specification, all other embodiments obtained by those of ordinary skill in the art without creative efforts belong to the scope of protection of the present invention.
[0052] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above - mentioned accompanying drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present invention described here can be implemented in an order different from those illustrated or described here. In addition, the terms "including" and "having" and any variations thereof are intended to cover non - exclusive inclusion. For example, a process, method, system, product or server including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0053] Various exemplary embodiments, features, and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. Like reference numerals in the drawings denote functionally identical or similar elements. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise specified. The term "exemplary" as used herein means "serving as an example, embodiment, or illustration". Any embodiment described herein as "exemplary" is not necessarily to be construed as superior or better than other embodiments.
[0054] As used herein, the term "and / or" merely describes an associative relationship between associated objects and indicates that three relationships may exist. For example, A and / or B may represent: A alone, both A and B present simultaneously, or B alone. Additionally, the term "at least one" as used herein means any one of a plurality or any combination of at least two of a plurality. For example, including at least one of A, B, and C may represent including any one or more elements selected from the set consisting of A, B, and C.
[0055] In addition, to better illustrate the present disclosure, numerous specific details are given in the following detailed description. Those skilled in the art should understand that the present disclosure can be implemented without some of these specific details. In some instances, methods, means, elements, and circuits well known to those skilled in the art are not described in detail so as to highlight the gist of the present disclosure.
[0056] Please refer to Figure 1 , Figure 1 which is a schematic diagram of an application environment shown according to an exemplary embodiment. As Figure 1 shown, the application environment may include server 01 and terminal 02.
[0057] In an alternative embodiment, server 01 may be used to perform computational processing on the view data processing method. Specifically, server 01 may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, Content Delivery Network (CDN), and big data and artificial intelligence platforms.
[0058] In an alternative embodiment, the terminal 02 may perform computational processing in conjunction with the view data processing method of the server 01. Specifically, the terminal 02 may include, but is not limited to, electronic devices such as smartphones, desktop computers, tablet computers, laptop computers, smart speakers, digital assistants, augmented reality (AR) / virtual reality (VR) devices, and smart wearable devices. Optionally, the operating systems running on the electronic devices may include, but are not limited to, Android, IOS, Linux, Windows, Unix, and other systems.
[0059] For example, by the terminal 02, a canvas array is constructed. The canvas array includes at least three sub-canvas objects. The at least three sub-canvas objects include a first canvas object, a second canvas object, and at least one first display canvas object. The at least one first display canvas object is arranged in sequence. The first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object. Each sub-canvas object is used to draw a sub-view, and the sub-view is a sub-view in the items to be drawn stored in the server 01; a cache array is constructed, and the cache array is used to cache the sub-views drawn by the at least three sub-canvas objects; a preset number of sub-views in the items to be drawn stored in the server 01 are cached into the cache array. The items to be drawn include at least three sub-views, and the preset number is the same as the number of sub-canvas objects; the sub-views cached in the cache array are sequentially drawn onto the canvas array. The sub-views drawn in the at least one first display canvas object are used for display in the display area, and the sub-views drawn in the first canvas object and the second canvas object are used for display after the display area is swiped and refreshed.
[0060] In addition, it should be noted that Figure 1 What is shown is only an application environment provided by the present disclosure. In actual applications, other application environments may also be included.
[0061] In the embodiments of this specification, the above-mentioned server 01 and terminal 02 may be directly or indirectly connected through wired or wireless communication methods, and the present disclosure does not limit this.
[0062] Figure 2 It is a flowchart of a view data processing method shown according to an exemplary embodiment. The above method includes:
[0063] Step S201: Construct a canvas array, which includes at least three sub-canvas objects. The at least three sub-canvas objects include a first canvas object, a second canvas object, and at least one first display canvas object. The at least one first display canvas object is arranged in sequence. The first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object. Each sub-canvas object is used to draw a sub-view, and the sub-view is a sub-view in the item to be drawn.
[0064] In the embodiment of the present disclosure, the sub-canvas objects in the canvas array are arranged in sequence, and from left to right, they are the first canvas object, at least one first display canvas object, and the second canvas object in turn. As Figure 3 shown, the at least one first display canvas object is arranged in sequence, and is denoted as canvas_0, canvas_1, canvas_..., canvas_n from left to right in turn; the first canvas object can be the sub-canvas object adjacent to the left of the leftmost first display canvas object, and the first canvas object is denoted as left_canvas; the second canvas object can be the sub-canvas object adjacent to the right of the rightmost first display canvas object, and the second canvas object is denoted as right_canvas. Each of the above sub-canvas objects is used to draw a sub-view, and the sub-view is a sub-view in the item to be drawn.
[0065] In the embodiment of the present disclosure, the widths of the sub-canvas objects are the same, and the heights are the same. The widths of the sub-views in the item to be drawn are the same, and the heights are the same. The width of each sub-canvas object is equal to the width of each sub-view, and the height of each sub-canvas object is equal to the height of each sub-view.
[0066] Step S202: Construct a cache array, which is used to cache the sub-views drawn by at least three sub-canvas objects.
[0067] In the embodiment of the present disclosure, the cache array can cache the sub-views drawn by the above at least three sub-canvas objects. The sub-views cached in the cache array are arranged in sequence in the cache array according to the order of the sub-views.
[0068] In the embodiment of the present disclosure, the number of sub-views cached in the cache array is not greater than the number of sub-canvas objects.
[0069] Step S203: Cache a preset number of sub-views in the item to be drawn into the cache array. The item to be drawn includes at least three sub-views, and the preset number is the same as the number of sub-canvas objects.
[0070] In the embodiments of the present disclosure, the sub-views drawn by the sub-canvas objects need to be stored in a cache space. Since each sub-canvas object is used to draw a sub-view, the number of sub-views cached in the cache array can be the same as the number of sub-canvas objects. When the number of sub-canvas objects is n + 2, the preset number can be set to n + 2. Moreover, the preset number of sub-views cached in the cache array are consecutive sub-views. As Figure 4 shown, there are m sub-items item under the item to be drawn, which are sequentially denoted as item_0, item_1, item_..., item_m. Each sub-item item stores a sub-view, and the sub-views of the item to be drawn are sequentially stored under each sub-item item in order. The cache array reads adjacent preset numbers of sub-items and caches the sub-views saved therein into the cache array. The n + 2 sub-views that need to be cached in the cache array are sequentially denoted as left_view, child_view_0, child_view_1, child_view_..., child_view_n, right_view from left to right.
[0071] Step S204: Sequentially draw the sub-views cached in the cache array onto the canvas array. The sub-views drawn in at least one first display canvas object are used for display in the display area, and the sub-views drawn in the first canvas object and the second canvas object are used for display after the display area is slid and refreshed.
[0072] In the embodiments of the present disclosure, the sub-views cached in the cache array can be drawn onto the canvas array in order. As Figure 5 shown, the sub-view left_view is drawn onto the sub-canvas object left_canvas, the sub-view child_view_0 is drawn onto the sub-canvas object canvas_0, the sub-view child_view_1 is drawn onto the sub-canvas object canvas_1,..., and the sub-view right_view is drawn onto the sub-canvas object right_canvas.
[0073] In an alternative embodiment, the widths of the sub-canvas objects are equal, and the sliding length corresponding to each sliding and refreshing operation is equal to the width of the sub-canvas object.
[0074] In the embodiments of the present disclosure, the sliding and refreshing operation can be a left or right slide, and the sliding length corresponding to one sliding and refreshing operation is equal to the width of the sub-canvas object. That is to say, after one sliding and refreshing operation, the left sub-view or the right sub-view of the original display view can be displayed.
[0075] In an alternative embodiment, the widths of the sub-views in the item to be drawn are equal, and the method further includes:
[0076] Step S301: Obtain the width information corresponding to the sub-view.
[0077] In the embodiments of the present disclosure, the width information corresponding to the sub-view can be obtained by defining a width acquisition function.
[0078] Step S302: According to the width information, perform a division process on the display area to obtain at least one sub-display area, and the first display canvas object corresponds to the sub-display area one by one.
[0079] In the embodiments of the present disclosure, performing a division process on the display area according to the width information may be to perform a division in the length direction of the display area according to the width information corresponding to the sub-view to obtain at least one sub-display area. As Figure 6 shown, set the length of the display area to an integer multiple of the width information corresponding to the sub-view, and the divided sub-display areas are sequentially denoted as Area_0, Area_1, Area_..., Area_n from left to right.
[0080] Step S303: Copy the sub-views drawn by at least one first display canvas object to at least one sub-display area to implement the display of the sub-views drawn in at least one first display canvas object.
[0081] In the embodiments of the present disclosure, the schematic diagram of copying the sub-views drawn by at least one first display canvas object to at least one sub-display area is as Figure 7 shown, the sub-views drawn by each first display canvas object are displayed corresponding to the sub-display area one by one. The sub-views drawn by the first display canvas object canvas_0 are copied to the sub-display area Area_0, the sub-views drawn by the first display canvas object canvas_1 are copied to the sub-display area Area_1,..., and the sub-views drawn by the first display canvas object canvas_n are copied to the sub-display area Area_n.
[0082] Based on the above, in the embodiments of the present disclosure, by obtaining the width information corresponding to the sub-view, performing a division process on the display area according to the width information to obtain at least one sub-display area, the sub-views can be displayed separately, and by copying the sub-views drawn by at least one first display canvas object to at least one sub-display area, the display of the sub-views drawn in at least one first display canvas object can be implemented.
[0083] In an alternative embodiment, the method further includes:
[0084] Step S401: In response to a sliding refresh operation on the display area, determine the sliding direction information corresponding to the sliding refresh operation.
[0085] In the embodiments of the present disclosure, the swipe refresh operation may be a left or right swipe, and is used to display the sub-views on the left or right of the currently displayed sub-view.
[0086] Step S402: When the swipe direction information indicates that the swipe direction is the target swipe direction, translate at least three sub-canvas objects by the length of one sub-canvas object in the direction from the second canvas object to the first canvas object, so as to change the correspondence between at least one sub-display area and at least three sub-canvas objects. The target swipe direction is the direction from the first canvas object to the second canvas object.
[0087] In the embodiments of the present disclosure, taking the first canvas object on the left and the second canvas object on the right as an example, the target swipe direction is a right swipe. Therefore, the sub-canvas object canvas_0 is moved to the position corresponding to the original sub-canvas object left_canvas, the sub-canvas object canvas_1 is moved to the position corresponding to the original sub-canvas object canvas_0,..., the sub-canvas object canvas_n is moved to the position corresponding to the original sub-canvas object canvas_n - 1, and the sub-canvas object right_canvas is moved to the position corresponding to the original sub-canvas object canvas_n.
[0088] Step S403: Copy the sub-views drawn in the sub-canvas objects currently corresponding to at least one sub-display area to at least one sub-display area.
[0089] In the embodiments of the present disclosure, the sub-views in the translated sub-canvas objects are copied to at least one sub-display area according to their corresponding coordinates, completing one swipe refresh.
[0090] Based on the above, in the embodiments of the present disclosure, when the swipe direction information indicates that the swipe direction is the target swipe direction, translate at least three sub-canvas objects by the length of one sub-canvas object in the direction from the second canvas object to the first canvas object, so as to change the correspondence between at least one sub-display area and at least three sub-canvas objects. The target swipe direction is the direction from the first canvas object to the second canvas object, and copy the sub-views drawn in the sub-canvas objects currently corresponding to at least one sub-display area to at least one sub-display area, so that the swipe refresh of the display area can be completed without redrawing the sub-views in the canvas array.
[0091] In an alternative embodiment, each sub-view is configured with a corresponding view label, and the sub-views cached in the cache array are arranged in sequence according to the view labels corresponding to the respective sub-views. Specifically, the sub-item number corresponding to the sub-view in the item to be drawn can be used as its view label. After copying the sub-views drawn in the sub-canvas objects currently corresponding to at least one sub-display area to at least one sub-display area, the method further includes:
[0092] Step S501: Determine a first target sub - view and a second target sub - view according to the view index corresponding to the sub - view drawn in the second display canvas object. The first target sub - view is the sub - view in the first canvas object cached in the cache array, and the second target sub - view is the sub - view in the item to be drawn whose view label is adjacent to the sub - view in the second canvas object and is not cached in the cache array.
[0093] In the embodiments of the present disclosure, taking the above - mentioned right - hand slide as an example, the sub - view currently displayed in the display area is the sub - view with the largest view label cached in the cache array. Therefore, the sub - views in the item to be drawn whose view labels are greater than that of this sub - view need to be cached in the cache array, that is, the second target sub - view in the item to be drawn whose view label is adjacent to the sub - view in the second canvas object and is not cached in the cache array, so that when sliding to the right again, this sub - view can be displayed.
[0094] In the embodiments of the present disclosure, taking the above - mentioned right - hand slide as an example, the sub - view currently displayed in the display area is the sub - view near the right cached in the cache array, and the two sub - views closest to the left cached in the cache array are not displayed in the display area. And since only one of the currently non - displayed sub - views, the left - most sub - view, that is, the sub - view in the first canvas object, still will not be displayed if sliding to the left next time, therefore, it is necessary to delete the sub - view cached in the cache array to save the cache space it occupies.
[0095] Step S502: Delete the first target sub - view from the cache array.
[0096] Step S503: Cache the second target sub - view into the cache array.
[0097] In the embodiments of the present disclosure, after the first target sub - view is deleted, its position becomes vacant, and all the sub - views cached in the cache array move one sub - view position in the direction of the vacant position at the same time. The position where the second target sub - view is cached into the cache array is the vacant position next to the sub - view corresponding to its nearest view number.
[0098] Based on the above, in the embodiments of the present disclosure, by determining the first target sub - view and the second target sub - view according to the view index corresponding to the sub - view drawn in the second display canvas object, where the first target sub - view is the sub - view in the first canvas object cached in the cache array, and the second target sub - view is the sub - view in the item to be drawn whose view label is adjacent to the sub - view in the second canvas object and is not cached in the cache array, and deleting the first target sub - view from the cache array and caching the second target sub - view into the cache array, it is possible to recycle the sub - views that will not be displayed in the next refresh and supplement the sub - views that may be displayed in the next refresh, realizing the update of the cache array and preventing it from occupying too much cache space.
[0099] In an alternative embodiment, after caching the second target sub-view into the cache array, the method further includes:
[0100] Step S601: Construct a third canvas object, the position of the third canvas object being adjacent to the second canvas object.
[0101] In the embodiments of the present disclosure, taking the sliding direction as the direction from the first canvas object to the second canvas object as an example, since the sub-images drawn by the original second canvas object are displayed in the display area, the right side of the original second canvas object is currently empty. To prevent no sub-view from being drawn when sliding in the same direction again, a third canvas object is constructed beside the original second canvas object for drawing the sub-views that need to be drawn when sliding in the same direction again.
[0102] Step S602: Draw the second target sub-view cached in the cache array in the third canvas object.
[0103] In the embodiments of the present disclosure, the second target sub-view newly added to the cache array is drawn corresponding in the third canvas object. Therefore, the second target sub-view cached in the cache array is drawn in the third canvas object.
[0104] Based on the above, in the embodiments of the present disclosure, by constructing a third canvas object, making the position of the third canvas object adjacent to the second canvas object, and drawing the second target sub-view cached in the cache array in the third canvas object, it is possible to achieve that only one sub-view is redrawn after each sliding refresh for display during the next sliding refresh.
[0105] Figure 8 is a block diagram of a view data processing device shown according to an exemplary embodiment. Referring to Figure 8 , the device includes a first construction module 801, a second construction module 802, a cache module 803, and a drawing module 804, where
[0106] The first construction module 801 is configured to construct a canvas array, the canvas array including at least three sub-canvas objects, the at least three sub-canvas objects including a first canvas object, a second canvas object, and at least one first display canvas object. The at least one first display canvas object is arranged in sequence, and the first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object. Each sub-canvas object is used to draw a sub-view, and the sub-view is a sub-view in the item to be drawn;
[0107] The second construction module 802 is configured to construct a cache array for caching the sub-views drawn by the at least three sub-canvas objects;
[0108] The caching module 803 is configured to cache a preset number of sub-views in the item to be drawn into a cache array. The item to be drawn includes at least three sub-views, and the preset number is the same as the number of sub-canvas objects.
[0109] The drawing module 804 is configured to sequentially draw the sub-views cached in the cache array onto the canvas array. The sub-views drawn in at least one first display canvas object are used for display in the display area, and the sub-views drawn in the first canvas object and the second canvas object are used for display after the display area is slid and refreshed.
[0110] In an optional embodiment, the widths of the sub-views in the item to be drawn are equal, and the apparatus further includes:
[0111] The obtaining module is configured to obtain the width information corresponding to the sub-views.
[0112] The dividing module is configured to perform a dividing process on the display area according to the width information to obtain at least one sub-display area, and the first display canvas object corresponds to the sub-display area one by one.
[0113] The first copying module is configured to copy the sub-views drawn in at least one first display canvas object to at least one sub-display area to implement the display of the sub-views drawn in at least one first display canvas object.
[0114] In an optional embodiment, the apparatus further includes:
[0115] The sliding direction determining module is configured to determine the sliding direction information corresponding to the sliding and refreshing operation in response to a sliding and refreshing operation on the display area.
[0116] The translation module is configured to, when the sliding direction information indicates that the sliding direction is the target sliding direction, translate at least three sub-canvas objects in the direction from the second canvas object to the first canvas object by the length of one sub-canvas object, so as to change the correspondence between at least one sub-display area and at least three sub-canvas objects. The target sliding direction is the direction from the first canvas object to the second canvas object.
[0117] The second copying module is configured to copy the sub-views drawn in the sub-canvas object currently corresponding to at least one sub-display area to at least one sub-display area.
[0118] In an optional embodiment, each sub-view is configured with a corresponding view label, and the sub-views cached in the cache array are arranged in sequence according to the view labels corresponding to the sub-views. The apparatus further includes:
[0119] A target sub-view determination module, configured to determine a first target sub-view and a second target sub-view according to the view index corresponding to the sub-view drawn in the second display canvas object, where the first target sub-view is the sub-view in the first canvas object cached in the cache array, and the second target sub-view is the sub-view in the item to be drawn whose view label is adjacent to that of the sub-view in the second canvas object and is not cached in the cache array;
[0120] A deletion module, configured to delete the first target sub-view from the cache array;
[0121] A cache sub-module, configured to cache the second target sub-view into the cache array.
[0122] In an optional embodiment, the apparatus further includes:
[0123] A third construction module, configured to construct a third canvas object, where the position of the third canvas object is adjacent to that of the second canvas object;
[0124] A drawing sub-module, configured to draw the second target sub-view cached in the cache array in the third canvas object.
[0125] In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware such as a processing circuit or a memory, or a combination thereof. Similarly, a processor or multiple processors or a memory can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit including the function of the module or unit.
[0126] In an exemplary embodiment, an electronic device is further provided, including: a processor; a memory for storing executable instructions of the processor; wherein, the processor is used for the instructions to implement the view data processing method as in the embodiments of the present disclosure.
[0127] Figure 9 is a block diagram of an electronic device for view data processing shown according to an exemplary embodiment. The electronic device may be a terminal, and its internal structure diagram may be as shown in Figure 9As shown. The electronic device includes a processor, a memory, a network interface, a display screen, and an input device connected via a system bus. Among them, the processor of the electronic device is used to provide computing and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the electronic device is used to communicate with an external terminal via a network connection. When the computer program is executed by the processor, it implements a view data processing method. The display screen of the electronic device can be a liquid crystal display screen or an electronic ink display screen. The input device of the electronic device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the electronic device, or an external keyboard, a touchpad, or a mouse, etc.
[0128] Those skilled in the art can understand that Figure 9 the structure shown in is only a block diagram of some structures related to the solution of the present disclosure, and does not constitute a limitation on the electronic device to which the solution of the present disclosure is applied. The specific electronic device may include more or fewer components than those shown in the figure, or combine some components, or have a different component layout.
[0129] In an exemplary embodiment, a storage medium is further provided. When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device can execute the view data processing method in the embodiments of the present disclosure.
[0130] In an exemplary embodiment, a computer program product containing instructions is further provided. When it runs on a computer, the computer executes the view data processing method in the embodiments of the present disclosure.
[0131] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. This computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided by the present disclosure can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0132] After considering the specification and practicing the invention disclosed herein, those skilled in the art will readily conceive of other embodiments of the present disclosure. The present disclosure is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include known common general knowledge or conventional technical means in the technical field not disclosed by the present disclosure. The specification and embodiments are only to be regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the claims.
[0133] It should be understood that the present disclosure is not limited to the exact structures described above and shown in the drawings, and various modifications and changes can be made without departing from its scope. The scope of the present disclosure is only limited by the appended claims.
Claims
1. A method for processing view data, characterized in that, The method includes: Constructing a canvas array, the canvas array including at least three sub - canvas objects, the at least three sub - canvas objects including a first canvas object, a second canvas object, and at least one first display canvas object, the at least one first display canvas object being arranged in sequence, the first canvas object and the second canvas object being located on both sides of the at least one first display canvas object respectively, each of the sub - canvas objects being used to draw a sub - view, the sub - view being a sub - view in the item to be drawn; Constructing a cache array, the cache array being used to cache the sub - views drawn by the at least three sub - canvas objects; Caching a preset number of sub - views in the item to be drawn into the cache array, the item to be drawn including at least three sub - views, the preset number being the same as the number of the sub - canvas objects; Drawing the sub - views cached in the cache array onto the canvas array in sequence, the sub - views drawn in the at least one first display canvas object being used for display in the display area, and the sub - views drawn in the first canvas object and the second canvas object being used for display after the display area is slid and refreshed.
2. The view data processing method according to claim 1, characterized in that: The widths of the sub - canvas objects are equal, and the sliding length corresponding to each sliding and refreshing operation is equal to the width of the sub - canvas object.
3. The view data processing method according to claim 1, characterized in that: The number of sub - views cached in the cache array is not greater than the number of the sub - canvas objects.
4. The view data processing method according to claim 1, wherein The widths of the sub - views in the item to be drawn are equal, and the method further includes: Obtaining the width information corresponding to the sub - view; Performing a division process on the display area according to the width information to obtain at least one sub - display area, the first display canvas object corresponding to the sub - display area one by one; Copying the sub - views drawn in the at least one first display canvas object to the at least one sub - display area to implement the display of the sub - views drawn in the at least one first display canvas object.
5. The view data processing method according to claim 4, wherein The method further includes: Responding to a sliding and refreshing operation on the display area, determining the sliding direction information corresponding to the sliding and refreshing operation; When the sliding direction information indicates that the sliding direction is the target sliding direction, translating the at least three sub - canvas objects by the length of one sub - canvas object in the direction from the second canvas object to the first canvas object to change the corresponding relationship between the at least one sub - display area and the at least three sub - canvas objects, the target sliding direction being the direction from the first canvas object to the second canvas object; Copying the sub - views drawn in the sub - canvas object currently corresponding to the at least one sub - display area to the at least one sub - display area.
6. The view data processing method according to claim 5, wherein Each of the sub - views is configured with a corresponding view label, and the sub - views cached in the cache array are arranged in sequence according to the view labels corresponding to the sub - views. After copying the sub - views drawn in the sub - canvas object currently corresponding to the at least one sub - display area to the at least one sub - display area, the method further includes: Determine a first target sub - view and a second target sub - view according to the view index corresponding to the sub - view drawn in the second display canvas object, where the first target sub - view is the sub - view in the first canvas object cached in the cache array, and the second target sub - view is the sub - view in the item to be drawn whose view label is adjacent to that of the sub - view in the second canvas object and is not cached in the cache array; Delete the first target sub - view from the cache array; Cache the second target sub - view into the cache array.
7. The view data processing method according to claim 6, wherein After caching the second target sub - view into the cache array, the method further includes: Construct a third canvas object, where the position of the third canvas object is adjacent to that of the second canvas object; Draw the second target sub - view cached in the cache array in the third canvas object.
8. A view data processing device, characterized in that, The apparatus includes: A first construction module, configured to construct a canvas array, where the canvas array includes at least three sub - canvas objects, the at least three sub - canvas objects include a first canvas object, a second canvas object, and at least one first display canvas object, the at least one first display canvas object is arranged in sequence, the first canvas object and the second canvas object are respectively located on both sides of the at least one first display canvas object, and each sub - canvas object is used to draw a sub - view, and the sub - view is a sub - view in the item to be drawn; A second construction module, configured to construct a cache array, where the cache array is used to cache the sub - views drawn by the at least three sub - canvas objects; A caching module, configured to cache a preset number of sub - views in the item to be drawn into the cache array, the item to be drawn includes at least three sub - views, and the preset number is the same as the number of sub - canvas objects; A drawing module, configured to draw the sub - views cached in the cache array into the canvas array in sequence, the sub - views drawn in the at least one first display canvas object are used for display in the display area, and the sub - views drawn in the first canvas object and the second canvas object are used for display after the display area is slid and refreshed.
9. An electronic device, characterized in that, Includes: A processor; A memory for storing executable instructions of the processor; Wherein, the processor is used for the instructions to implement the view data processing method according to any one of claims 1 to 7.
10. A storage medium, characterized in that, When the instructions in the storage medium are executed by the processor of the electronic device, the electronic device is enabled to execute the view data processing method according to any one of claims 1 to 7.