Page rendering method and device, readable medium, electronic equipment and program product
By generating drawing commands through the main thread, generating texture data through the first rendering thread, and rendering the view through the second rendering thread, the data copying problem in the mixed rendering of native and non-native views in Android is solved, improving rendering performance and user experience.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIJING ZITIAO NETWORK TECH CO LTD
- Filing Date
- 2026-01-29
- Publication Date
- 2026-05-12
Smart Images

Figure CN122019039A_ABST
Abstract
Description
Technical Field
[0001] The technical solution relates to the field of computer technology, specifically to a page rendering method, apparatus, readable medium, electronic device, and program product. Background Technology
[0002] Mixed rendering of native and non-native views in Android is an important scenario in Android application development. To achieve mixed rendering, related technologies involve two data copies across the CPU (Central Processing Unit) and GPU (Graphics Processing Unit) memory between the rendering engine of the non-native view (the production end) and the Android rendering thread (the consumer end). This consumes a large amount of memory bandwidth and causes rendering latency. In high-resolution or dynamic interactive scenarios, it can easily lead to problems such as frame rate drops and UI stuttering, thus affecting the user's interactive experience. Summary of the Invention
[0003] This section is provided to provide a brief overview of the concepts, which will be described in detail in the subsequent Detailed Description section. This section is not intended to identify key or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0004] Firstly, a page rendering method is provided, the page rendering method comprising:
[0005] In response to the first frame synchronization signal triggered by the first page, the main thread generates a first drawing command and a first drawing command set corresponding to the first view when the first page includes a first view; wherein, the first drawing command set is used to generate the first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data; The first texture data is obtained by executing the first set of drawing commands through the first rendering thread; The first drawing command is executed by the second rendering thread, the first interface is called to obtain the first texture data, and the first view is rendered on the first page based on the first texture data.
[0006] Secondly, a page rendering apparatus is provided, the page rendering apparatus comprising: The generation module is used to respond to the first frame synchronization signal triggered by the first page, and generate a first drawing command and a first drawing command set corresponding to the first view through the main thread when the first page includes a first view; wherein, the first drawing command set is used to generate the first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data; The execution module is used to execute the first set of drawing commands through the first rendering thread to obtain the first texture data; The rendering module is used to execute the first drawing command through the second rendering thread, call the first interface to obtain the first texture data, and render the first view in the first page based on the first texture data.
[0007] Thirdly, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect.
[0008] Fourthly, an electronic device is provided, comprising: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method in the first aspect.
[0009] Fifthly, a computer program product is provided, comprising a computer program that, when executed by a processor, implements the steps of the method described in the first aspect.
[0010] The above technical solution, in response to the first frame synchronization signal triggered by the first page, generates a first drawing command and a set of first drawing commands corresponding to the first view through the main thread when the first page includes a first view. Then, the first rendering thread executes the set of first drawing commands to obtain first texture data. Finally, the second rendering thread executes the first drawing command, calls the first interface to obtain the first texture data, and renders the first view on the first page based on the first texture data. Specifically, the set of first drawing commands is used to generate the first texture data corresponding to the first view, and the first drawing command is bound to an executable object configured with the first interface, which is used to obtain the first texture data. Using this method, all drawing and texture sampling of the first view are completed on the first rendering thread through the executable object, effectively improving the rendering performance of the first view and achieving page rendering through a single cross-thread data copy. Taking a non-native view as an example, the off-screen drawing results are shared from the first rendering thread to the second rendering thread and finally rendered onto the screen. Page rendering is achieved through a single data copy between the first and second rendering threads, reducing memory bandwidth consumption and rendering latency. In high-resolution or dynamic interactive scenarios, it avoids frame rate drops and interface stuttering, thereby improving the user's interactive experience.
[0011] Other features and advantages of the technical solution will be described in detail in the following detailed implementation section. Attached Figure Description
[0012] The above and other features, advantages, and aspects of the technical solution will become more apparent when taken in conjunction with the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale. In the drawings: Figure 1 This is a schematic diagram illustrating an implementation environment according to an example.
[0013] Figure 2 This is a flowchart illustrating a page rendering method according to an example.
[0014] Figure 3 This is a schematic diagram illustrating the thread interaction of a page rendering method according to an example.
[0015] Figure 4 This is a schematic diagram illustrating a mixed-layout rendering method according to an example.
[0016] Figure 5 This is a schematic diagram illustrating thread interaction of another page rendering method as shown in an example.
[0017] Figure 6This is a schematic diagram of the structure of a page rendering device according to an example.
[0018] Figure 7 This is a schematic diagram of the structure of an electronic device as illustrated by an example. Detailed Implementation
[0019] The technical solution will now be described in more detail with reference to the accompanying drawings. Although certain scenarios are shown in the drawings, it should be understood that the technical solution can be implemented in various forms and should not be construed as limited to the scenarios described herein. Rather, these scenarios are provided to provide a more thorough and complete understanding of the technical solution. It should be understood that the accompanying drawings and the scenarios described are for illustrative purposes only and are not intended to limit the scope of protection of the technical solution.
[0020] It should be understood that the steps described in the method implementation may be performed in different orders and / or in parallel. Furthermore, the method implementation may include additional steps and / or omit the steps shown. The scope of the technical solution is not limited in this respect.
[0021] The term "comprising" and its variations as used herein can be open-ended, meaning "including but not limited to". The term "based on" can mean "at least partially based on". The term "one case" means "at least one case"; the term "another case" means "at least one additional case"; the term "some cases" means "at least some cases". Definitions of other terms will be given in the following description.
[0022] It should be noted that the concepts of "first" and "second" mentioned here are only used to distinguish different devices, modules or units, and are not used to limit the order of the functions performed by these devices, modules or units or their interdependencies.
[0023] It should be noted that the terms "one" and "more" used here are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0024] The names of messages or information exchanged between the multiple devices in the implementation are for illustrative purposes only and are not intended to limit the scope of these messages or information.
[0025] It is understandable that before using the technical solutions provided here, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in accordance with relevant laws and regulations, and their authorization should be obtained through appropriate means.
[0026] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose, based on the prompt message, whether to provide personal information to the software or hardware such as electronic devices, applications, servers, or storage media performing the operations described herein.
[0027] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0028] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of the technical solution. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the technical solution.
[0029] At the same time, it is understood that the data involved in the technical solution (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of relevant laws, regulations and related provisions.
[0030] In scenarios where native and non-native Android views are mixed, mixed rendering needs to ensure that the content of the non-native view is updated synchronously with the content of the native Android view. Solutions relying on the ImageReader (graphics rendering) component for mixed rendering incur two data copy overheads: the first is writing the GPU-rendered content of the non-native view to the ImageReader's Surface (an access interface for writing image data, on the CPU); the second is reading the Surface data as a Bitmap and then submitting it to the system. These two cross-CPU / GPU memory copies consume high bandwidth, leading to rendering latency.
[0031] This solution suffers from a significant performance bottleneck. Because the underlying system lacks direct access to the GPU's graphics buffer, applications must copy data entirely from GPU-managed dedicated memory to CPU-managed general-purpose memory for each frame, leading to the aforementioned copying issue. This is particularly problematic in high-resolution or dynamic interactive scenarios, easily causing frame rate drops and UI stuttering, ultimately impacting the user experience.
[0032] In view of this, the technical solution provides a page rendering method, apparatus, readable medium, electronic device, and program product to solve the above-mentioned technical problems.
[0033] The page rendering method provided by the technical solution can be executed by an electronic device, which can be provided as at least one of a terminal and a server. Figure 1 This is an exemplary schematic diagram illustrating an implementation environment; see [link / reference]. Figure 1 The implementation environment includes: terminal 101 and server 102.
[0034] For example, a target application is installed on terminal 101. The target application is used to display a page, and page rendering can be performed on the application interface of terminal 101. Server 102 is the backend server for the target application, used to provide backend services for the target application.
[0035] For example, in response to the frame synchronization signal triggered by the page on the application interface of terminal 101, the main thread can generate a first drawing command and a set of first drawing commands corresponding to the first view when the page includes a first view. Then, the first rendering thread executes the set of first drawing commands to obtain texture data, and the second rendering thread executes the first drawing command, calls the first interface to obtain the texture data, and renders the first view on the page based on the texture data.
[0036] Terminal 101 can be at least one of the following devices: smartphone, smartwatch, desktop computer, laptop, virtual reality terminal, augmented reality terminal, wireless terminal, and laptop computer. Terminal 101 has communication capabilities and can access wired or wireless networks. Terminal 101 can refer to one of multiple terminals, and those skilled in the art will understand that the number of such terminals can be more or less. Server 102 can be an independent physical server, a server cluster composed of multiple physical servers, or a distributed file system. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0037] For example, server 102 and terminal 101 are connected directly or indirectly via wired or wireless communication, without limitation.
[0038] Optionally, the number of servers 102 can be more or less, and there is no limitation thereto. Of course, servers 102 may also include other functional servers to provide more comprehensive and diversified services. Server 102 undertakes the main computing work, and terminal 101 undertakes the secondary computing work; or, server 102 undertakes the secondary computing work, and terminal 101 undertakes the main computing work; or, server 102 or terminal 101 can each undertake computing work independently, and there is no limitation thereto.
[0039] Figure 2 This is a flowchart illustrating a page rendering method as shown in the example. For example... Figure 2 As shown, the method may include the following steps: S201: In response to the first frame synchronization signal triggered by the first page, the main thread generates the first drawing command and the first drawing command set corresponding to the first view when the first page includes the first view; wherein, the first drawing command set is used to generate the first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data.
[0040] For example, the first page is the target application's page in the terminal. The main thread is the thread responsible for handling all tasks related to user interaction and interface rendering, such as the UI (User Interface) thread. The first frame synchronization signal can be a VSync (Vertical Synchronization) signal, which can be determined according to the actual business scenario. Any trigger signal that can coordinate the rendering process is acceptable; this technical solution does not impose any restrictions on this. The first view can be a non-native view, also known as a self-rendering view, that is, a view that is not drawn through the system's built-in rendering thread.
[0041] In one scenario, an executable object can be implemented using Functor (function object) technology. Functor is a type of drawing command supported by Android when recording drawing commands. An executable object can be understood as a rendering command package that can be invoked across languages and threads with a delay. The specific content can be determined based on the content that the view needs to render, and this technical solution does not impose any restrictions on this. The Android system uses a rendering engine to record internal drawing commands and perform subsequent rendering. The rendering engine also has a corresponding type, FunctorDrawable (a low-level component used to implement efficient custom drawing).
[0042] For example, the first set of drawing commands is the set of drawing commands corresponding to a non-native view, such as a self-rendering Displaylist. In the onDraw interface of a normal Android view, the developer actively performs reflection to call android.graphics.RecordingCanvas.drawWebViewFunctor (different Android versions require calling different interfaces). The developer can insert a Functor Op (first drawing command) into the set of drawing commands (system Displaylist) of the rendering page. The Functor Op can point to an executable object.
[0043] S202: The first set of drawing commands is executed through the first rendering thread to obtain the first texture data.
[0044] For example, the first rendering thread may be a GPU thread that renders a non-native view, such as a self-rendering GPU thread, which can obtain texture data for self-rendering by executing a first set of drawing commands.
[0045] S203: Execute the first drawing command through the second rendering thread, call the first interface to obtain the first texture data, and render the first view on the first page based on the first texture data.
[0046] For example, the second rendering thread can be the GPU thread that renders the native view, such as the system rendering GPU thread, like the Android Render thread mentioned above. By executing the Functor Op in the system Displaylist, it can submit the self-rendered content to the Android system. That is, data copying can be achieved through a single cross-thread interaction between GPUs. Subsequently, the content of the native Android view is synthesized and displayed synchronously.
[0047] By employing the above method, all drawing and texture sampling of the first view are completed on the first rendering thread through an executable object, effectively improving the rendering performance of the first view. Page rendering is achieved through a single cross-thread data copy. Taking a non-native first view as an example, the off-screen drawing results are shared from the first rendering thread to the second rendering thread for final rendering onto the screen. This single data copy between the first and second rendering threads reduces memory bandwidth consumption and rendering latency, avoiding frame rate drops and interface stuttering in high-resolution or dynamic interactive scenarios, thereby enhancing the user experience.
[0048] In one scenario, the page rendering method further includes: generating a second set of drawing commands corresponding to the second view via the main thread when the first page also includes a second view; the second set of drawing commands is used to generate third texture data corresponding to the second view, and the types of the first view and the second view are different; executing the second set of drawing commands via the second rendering thread to obtain the third texture data, and rendering the second view on the first page based on the third texture data.
[0049] For example, the second view can be a native Android view. (e.g.) Figure 3As shown, in response to the frame synchronization signal, the UI thread needs to go through steps such as Input, Animate, Measure, and Layout. For details, please refer to the rendering pipeline of page rendering, which will not be elaborated here. Then the Paint (recording drawing commands) step begins, such as the common Clip and Translate.
[0050] For example, if the page includes non-native views, a Functor Op (first drawing command) can be inserted into the system Displaylist. The system native views (second views) can then have their corresponding drawing commands recorded in the system Displaylist as normal. For instance, FunctorOps corresponding to non-native views can be inserted into the second set of drawing commands, or different views can be recorded in different Displaylists and then merged to obtain the system Displaylist. The specific configuration can be set according to requirements, and this technical solution does not impose any restrictions on this.
[0051] Therefore, based on Functor technology, the rendering of non-native views can be done without relying on the ImageReader component, and the drawing results can be submitted to the Android system to achieve mixed rendering of non-native views and system native views.
[0052] The first view and the second view mentioned above can be a non-native view and a system native view, respectively, or they can be two different types of views in other mixed layout scenarios. The specific view can be determined according to the actual business scenario, and this technical solution does not impose any restrictions on this.
[0053] In one scenario, the executable object is also configured with a second interface for triggering a second rendering thread. The page rendering method further includes: triggering the second interface after the main thread obtains a first drawing command and a second set of drawing commands; executing the first drawing command through the second rendering thread, including: executing the first drawing command through the second rendering thread in response to triggering the second interface; and executing the second set of drawing commands through the second rendering thread, including: executing the second set of drawing commands through the second rendering thread in response to triggering the second interface.
[0054] For example, such as Figure 3As shown, the executable object Functor provides both the onSync interface (the second interface) and the onDraw interface (the first interface) for the Android system to call. Through these two interfaces, the drawing result of the first view is submitted to the Android system. The onSync interface is called on the UI thread; when called by the system, it indicates that the current Displaylist or Render node information has been synchronized, and a new frame of GPU rendering is about to begin. The onDraw interface is called on the Android Render thread; when called, the system passes in the Clip region, Translate information, etc. The self-rendering engine needs to draw the content of the first view onto the framebuffer object bound to the current thread in this interface. The names of these interfaces can be set according to requirements; this technical solution does not impose any restrictions on them.
[0055] For example, such as Figure 3 As shown, after generating the second set of drawing commands, the UI thread triggers the second interface (Syncops) to start GPU rendering for the new frame. The Android Render thread responds to the triggering operation of the second interface by replaying (executing) the system Displaylist. In other words, taking native system views and non-native views as examples, the drawing commands corresponding to the native system views are directly replayed in the Android Render thread, while the content of non-native views is obtained by calling the onDraw interface when executing the Functor Op.
[0056] In other words, in a mixed rendering scenario of non-native views and system native views, all drawing commands for both non-native views and system native views need to be completed at once before the actual drawing begins. This avoids redundant calculations, resolves read / write conflicts, and ensures the stability of page rendering.
[0057] In one scenario, the page rendering method further includes: writing the first texture data and the third texture data into the second frame buffer object corresponding to the second rendering thread through the second rendering thread; and rendering the first view and the second view in the first page based on the second frame buffer object.
[0058] For example, such as Figure 3 As shown, in response to the trigger operation of the second interface, after replaying the system DisplayList, the second rendering thread needs to draw the rendered content into the frame buffer object bound to the current thread. The rendered content of the first view is drawn into the frame buffer object bound to the current thread through the onDraw interface, so that the content of different types of views can be composited and displayed on the screen simultaneously, effectively improving the efficiency of mixed rendering.
[0059] For example, a non-native view can be encapsulated based on Functor technology, as shown below. Figure 4 The following example illustrates a complex "sandwich" layout scenario, where part of the self-rendered content is above the native view and part is below the native view. In this scenario, two non-native views are created to render the visible content above and below the native view respectively.
[0060] In one scenario, the first rendering thread executes a first set of drawing commands to obtain first texture data, including: creating a first frame buffer object corresponding to the first view through the first rendering thread, executing the first set of drawing commands to obtain a first execution result, and writing the first execution result into the first frame buffer object; and performing texture sampling on the first frame buffer object through the first rendering thread to obtain the first texture data.
[0061] For example, in a "sandwich" mixed layout scenario, such as Figure 5 As shown, the main thread responds to the frame synchronization signal, which is not a native view. Figure 1 Native view and non-native view Figure 2 Each rendering pipeline starts sequentially, receiving the corresponding drawing commands. For non-native views, the first rendering thread needs to create the framebuffer object corresponding to the non-native view first, so that the non-native view can be rendered. Figure 1 For example, in non-native vision Figure 1 Playback of non-native view on the corresponding framebuffer object Figure 1 The corresponding drawing command is equivalent to writing the execution result (usually bitmap data) of the drawing command into the corresponding framebuffer object, and then performing texture sampling on it to obtain a non-native view. Figure 1 Corresponding texture data. Non-native view. Figure 2 The drawing operations in the first rendering thread are similar and will not be described in detail here.
[0062] Therefore, all drawing and texture sampling of non-native views are completed in the first rendering thread, and then submitted to the second rendering thread of the Android system. There is no need to upload to the Surface first and then upload to the second rendering thread. All operations are based on hardware acceleration, which has a significant performance advantage over using ImageReader and effectively improves rendering efficiency.
[0063] In one scenario, the page rendering method further includes: storing the first texture data into shared memory via a first rendering thread, and transmitting the first shared identifier corresponding to the first texture data to a second rendering thread. Calling a first interface to obtain the first texture data and rendering a first view on the first page based on the first texture data includes: calling the first interface via the second rendering thread based on the first shared identifier to obtain the first texture data from shared memory, and writing the first texture data into a second frame buffer object corresponding to the second rendering thread; rendering the first view on the first page based on the second frame buffer object.
[0064] For example, such as Figure 5 As shown, the first texture data is stored in shared memory, and then the shared identifier corresponding to this memory segment of the first texture data is transmitted to the second rendering thread. When the second rendering thread executes the system Displaylist, if it executes the aforementioned Functor Op (such as the first drawing command mentioned above), it calls the Functor's onDraw interface to obtain the texture data corresponding to the non-native view based on the aforementioned shared identifier.
[0065] For example, EGL Images can be used to share textures across threads. An EGL Image can be understood as a shared handle to shared memory, thereby enabling cross-thread sharing of texture data and generating additional texture copy overhead, improving rendering performance and reducing memory usage.
[0066] In one scenario, the executable object includes a derived object corresponding to a preset texture type. Writing the first texture data to the second frame buffer object corresponding to the second rendering thread includes: converting the first texture data according to the texture format corresponding to the preset texture type to obtain the second texture data; and writing the second texture data to the second frame buffer object by executing the derived object.
[0067] It should be noted that Android supports both OpenGL and Vulkan graphics APIs (Application Programming Interfaces) for content rendering.
[0068] For example, Functor can also be configured with two derived types: GLFunctorDrawable and VkFunctorDrawable, which are used to support OpenGL and Vulkan rendering respectively. The specific derived object and its name can be set according to requirements, and this technical solution does not impose any restrictions on this.
[0069] For example, such as Figure 5As shown, based on the above derived types, the texture of a non-native view can be resampled to the required type, and then the view can be rendered based on the resampled texture.
[0070] Combined with the aforementioned cross-thread sharing, data transfer across graphics APIs (such as OpenGL / Vulkan) can also be achieved, effectively improving the flexibility of page rendering.
[0071] For example, such as Figure 5 As shown, the rendered content corresponding to the native view and the non-native view is written to the frame buffer object corresponding to the second rendering thread, and then submitted to the system for final compositing and display. In this way, both the native view and the non-native view are finally composed and displayed by the Android system within the same Vsync cycle, which can ensure that the content of the native view and the non-native view are updated synchronously, without screen tearing or other abnormal phenomena, effectively improving the user's interactive experience.
[0072] Figure 6 This is a schematic diagram of the structure of a page rendering apparatus as illustrated by an example. Figure 6 As shown, the page rendering device 600 includes: The generation module 601 is used to respond to the first frame synchronization signal triggered by the first page, and generate a first drawing command and a first drawing command set corresponding to the first view through the main thread when the first page includes a first view; wherein, the first drawing command set is used to generate the first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data; Execution module 602 is used to execute the first set of drawing commands through the first rendering thread to obtain the first texture data; The rendering module 603 is used to execute the first drawing command through the second rendering thread, call the first interface to obtain the first texture data, and render the first view in the first page based on the first texture data.
[0073] Optionally, the execution module 602 is used to: The first frame buffer object corresponding to the first view is created by the first rendering thread, the first set of drawing commands is executed to obtain the first execution result, and the first execution result is written into the first frame buffer object. The first texture data is obtained by performing texture sampling on the first framebuffer object through the first rendering thread.
[0074] Optionally, the page rendering apparatus 600 further includes: The sharing module is used to store the first texture data into shared memory through the first rendering thread, and transmit the first shared identifier corresponding to the first texture data to the second rendering thread; The rendering module 603 is used for: The second rendering thread calls the first interface based on the first shared identifier to obtain the first texture data from the shared memory and writes the first texture data into the second frame buffer object corresponding to the second rendering thread. The first view is rendered on the first page based on the second framebuffer object.
[0075] Optionally, the executable object includes a derived object corresponding to a preset texture type, and the rendering module 503 is used for: The first texture data is converted according to the texture format corresponding to the preset texture type to obtain the second texture data; The second texture data is written to the second framebuffer object by executing the derived object.
[0076] Optionally, the page rendering apparatus 600 further includes: A generation submodule is used to generate a second drawing command set corresponding to the second view when the first page also includes a second view, through the main thread. The second drawing command set is used to generate third texture data corresponding to the second view. The first view and the second view are of different types. An execution submodule is used to execute the second set of drawing commands through the second rendering thread to obtain the third texture data, and to render the second view in the first page based on the third texture data.
[0077] Optionally, the page rendering apparatus 600 further includes a writing module for: The first texture data and the third texture data are written into the second frame buffer object corresponding to the second rendering thread through the second rendering thread; The first view and the second view are rendered on the first page based on the second framebuffer object.
[0078] Optionally, the executable object is further configured with a second interface for triggering the second rendering thread, and the page rendering device 600 further includes: The triggering module is used to trigger the second interface after the main thread obtains the first drawing command and the second set of drawing commands; The rendering module 603 is used for: In response to triggering the second interface, the first drawing command is executed through the second rendering thread; The execution submodule is used for: In response to triggering the second interface, the second set of drawing commands is executed through the second rendering thread.
[0079] Regarding the page rendering device 600 mentioned above, the method logic executed by each functional module has been explained in detail in the section on methods, and will not be repeated here.
[0080] Based on the same concept, a computer-readable medium is also provided, on which a computer program is stored, which, when executed by a processing device, implements the steps of any of the above-described page rendering methods.
[0081] Based on the same concept, an electronic device is also provided, which may include: A storage device on which computer programs are stored; A processing device for executing a computer program stored in a storage device to implement the steps of any of the above-described page rendering methods.
[0082] Based on the same concept, a computer program product is also provided, including a computer program that, when executed by a processor, implements the steps of any of the above-described page rendering methods.
[0083] The following is for reference. Figure 7 The diagram illustrates a structural schematic of an electronic device 700 suitable for implementing the above-described technical solution. The terminal device may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Tablet Personal Computers), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs (Televisions), desktop computers, etc. Figure 7 The electronic device shown is merely an example and should not be construed as limiting its functionality or scope of use.
[0084] like Figure 7As shown, the electronic device 700 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage device 708 into a random access memory (RAM) 703. The RAM 703 also stores various programs and data required for the operation of the electronic device 700. The processing unit 701, the ROM 702, and the RAM 703 are interconnected via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.
[0085] Typically, the following devices can be connected to the input / output interface 705: input devices 706 including, for example, a touchscreen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; output devices 707 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 708 including, for example, magnetic tape, hard disk, etc.; and communication devices 709. Communication device 709 allows electronic device 700 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 7 An electronic device 700 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0086] In particular, depending on certain circumstances, the processes described in the flowchart above can be implemented as computer software programs. For example, a computer program product is provided, comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowchart. This computer program can be downloaded and installed from a network via communication device 709, or installed from storage device 708, or installed from read-only memory 702. When the computer program is executed by processing device 701, it performs the functions defined in the above-described methods.
[0087] It should be noted that the aforementioned computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium may be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM, or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In one case, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In another case, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (Radio Frequency), etc., or any suitable combination thereof.
[0088] In some implementations, communication can be conducted using any currently known or future-developed network protocol, such as HTTP (Hypertext Transfer Protocol), and can be interconnected with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (LANs), wide area networks (WANs), the internet (e.g., the Internet), and end-to-end networks (e.g., ad-hoc end-to-end networks), as well as any currently known or future-developed networks.
[0089] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0090] The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the electronic device causes the following: In response to a first frame synchronization signal triggered by a first page, the electronic device generates a first drawing command and a first drawing command set corresponding to the first view via a main thread, provided that the first page includes a first view; wherein the first drawing command set is used to generate first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data; the electronic device executes the first drawing command set via a first rendering thread to obtain the first texture data; the electronic device executes the first drawing command via a second rendering thread, calls the first interface to obtain the first texture data, and renders the first view on the first page based on the first texture data.
[0091] Computer program code for performing the above operations can be written in one or more programming languages or a combination thereof. These programming languages include, but are not limited to, object-oriented programming languages, as well as conventional procedural programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0092] The flowcharts and block diagrams in the accompanying figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products under various scenarios. In this respect, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the figures. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0093] The modules mentioned above can be implemented in software or hardware. In some cases, the name of a module does not necessarily limit the functionality of that module.
[0094] The functions described above can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field-Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application-Specific Standard Parts (ASSPs), Systems on Chips (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0095] In this context, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0096] The above description is merely illustrative and explains the technical principles employed. Those skilled in the art should understand that the scope of the technical solution is not limited to specific combinations of the above-described technical features, but also includes other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above concept. For example, technical solutions formed by substituting the above-described features with (but not limited to) technical features provided herein that have similar functions.
[0097] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. Multitasking and parallel processing may be advantageous in certain environments. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limitations on the scope of the technical solution. Certain features described in the context of a single example can also be implemented in combination in a single example. Conversely, various features described in the context of a single example can also be implemented individually or in any suitable sub-combination in multiple examples.
[0098] Although the technical solution has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims. Regarding the aforementioned apparatus, the specific manner in which each module performs its operation has already been described in detail in the section concerning the method, and will not be elaborated upon here.
Claims
1. A page rendering method, the page rendering method comprising: In response to the first frame synchronization signal triggered by the first page, the main thread generates a first drawing command and a first drawing command set corresponding to the first view when the first page includes a first view; wherein, the first drawing command set is used to generate the first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data; The first texture data is obtained by executing the first set of drawing commands through the first rendering thread; The first drawing command is executed by the second rendering thread, the first interface is called to obtain the first texture data, and the first view is rendered on the first page based on the first texture data.
2. The page rendering method according to claim 1, wherein obtaining the first texture data by executing the first set of drawing commands through the first rendering thread includes: The first frame buffer object corresponding to the first view is created by the first rendering thread, the first set of drawing commands is executed to obtain the first execution result, and the first execution result is written into the first frame buffer object. The first texture data is obtained by performing texture sampling on the first framebuffer object through the first rendering thread.
3. The page rendering method according to claim 1, further comprising: The first rendering thread stores the first texture data into shared memory and transmits the first shared identifier corresponding to the first texture data to the second rendering thread. The step of calling the first interface to obtain the first texture data and rendering the first view on the first page based on the first texture data includes: The second rendering thread calls the first interface based on the first shared identifier to obtain the first texture data from the shared memory and writes the first texture data into the second frame buffer object corresponding to the second rendering thread. The first view is rendered on the first page based on the second framebuffer object.
4. The page rendering method according to claim 3, wherein the executable object includes a derived object corresponding to a preset texture type, and the step of writing the first texture data into the second frame buffer object corresponding to the second rendering thread includes: The first texture data is converted according to the texture format corresponding to the preset texture type to obtain the second texture data; The second texture data is written to the second framebuffer object by executing the derived object.
5. The page rendering method according to any one of claims 1-4, further comprising: In the case where the first page also includes a second view, the main thread generates a second set of drawing commands corresponding to the second view. The second set of drawing commands is used to generate third texture data corresponding to the second view. The first view and the second view are of different types. The second rendering thread executes the second set of drawing commands to obtain the third texture data, and renders the second view on the first page based on the third texture data.
6. The page rendering method according to claim 5, further comprising: The first texture data and the third texture data are written into the second frame buffer object corresponding to the second rendering thread through the second rendering thread; The first view and the second view are rendered on the first page based on the second framebuffer object.
7. The page rendering method according to claim 5, wherein the executable object is further configured with a second interface, the second interface being used to trigger the second rendering thread, and the page rendering method further includes: After obtaining the first drawing command and the second set of drawing commands, the main thread triggers the second interface. The execution of the first drawing command via the second rendering thread includes: In response to triggering the second interface, the first drawing command is executed through the second rendering thread; The execution of the second set of drawing commands through the second rendering thread includes: In response to triggering the second interface, the second set of drawing commands is executed through the second rendering thread.
8. A page rendering apparatus, the page rendering apparatus comprising: The generation module is used to respond to the first frame synchronization signal triggered by the first page, and generate a first drawing command and a first drawing command set corresponding to the first view through the main thread when the first page includes a first view; wherein, the first drawing command set is used to generate the first texture data corresponding to the first view, the first drawing command is bound to an executable object, the executable object is configured with a first interface, and the first interface is used to obtain the first texture data; The execution module is used to execute the first set of drawing commands through the first rendering thread to obtain the first texture data; The rendering module is used to execute the first drawing command through the second rendering thread, call the first interface to obtain the first texture data, and render the first view in the first page based on the first texture data.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When executed by a processing device, the computer program performs the steps of the method according to any one of claims 1-7.
10. An electronic device, characterized in that, include: A storage device on which computer programs are stored; A processing device for executing the computer program in the storage device to implement the steps of the method according to any one of claims 1-7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.