Handwriting erasing method and display equipment
By setting frame buffer and temporary buffer in the memory of the display device, and acquiring read and write locks under single-frame buffer for data copying, the problem of eraser tearing under single-frame buffer is solved, and efficient handwriting erasing display is achieved.
Patent Information
- Application Number
- CN202310632149.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-30
- Publication Date
- 2024-12-03
AI Technical Summary
When the display device is insufficient memory, it is impossible to use dual-frame buffer to solve the eraser tearing problem. How to avoid eraser tearing under single-frame buffer has become the focus of research.
By setting a frame buffer and temporary buffer in memory, the processor uses temporary buffer to store the handwriting and eraser drawn by the handwriting canvas, and after obtaining the target signal, it acquires the temporary buffer's read and write lock. Locking the temporary buffer can only be read or The write operation, based on the locked state of the temporary buffer, copies the content stored in the temporary buffer to the frame buffer, so that the display screen displays the frame buffered handwriting and eraser.
It realizes the problem of avoiding eraser tearing under single-frame buffer, ensuring that the content in the frame buffer displayed on the display screen does not have eraser tearing, and improving the display efficiency of the handwriting erasing process.
Smart Images

Figure CN119065865A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of display technology, and in particular, to a handwriting erasing method and a display device. Background Art
[0002] In the scenario where the display device uses the electronic whiteboard function, when erasing the drawn handwriting, a double frame buffer method is used to avoid the tearing of the eraser, that is, there are a foreground frame buffer and a background frame buffer located in the system memory or the video memory in the display device. When the handwriting canvas generates a dirty area due to the eraser erasing, the image processor (Graphics Processing Unit, GPU) in the display device writes the dirty area into the background frame buffer according to the frame rate, so that the background frame buffer stores the image frame representing the dirty area. When the GPU refreshes the image frame currently located in the foreground frame buffer to the display screen, the display screen generates a vertical synchronization signal (Vsync) or a vertical blanking signal (Vblank). After the GPU obtains the Vsync / Vblank, the foreground frame buffer is changed to the background frame buffer, and the background frame buffer is changed to the foreground frame buffer. Subsequently, the GPU refreshes the image frame representing the dirty area in the switched foreground buffer to the display screen to realize the display of the eraser erasing process.
[0003] However, when the display device memory is insufficient and double-frame buffering cannot be provided, the above-mentioned double-buffering method for solving the eraser tearing problem cannot be implemented. Therefore, how to avoid the eraser tearing problem in the case of single-frame buffering becomes the focus of research. Summary of the invention
[0004] The present application provides a handwriting erasing method and a display device, which are used to solve the technical problem of avoiding eraser tearing by using a single frame buffer.
[0005] In a first aspect, an embodiment of the present application provides a display device, the display device comprising:
[0006] a display screen configured to display handwriting;
[0007] A memory, comprising a frame buffer and a temporary buffer; the temporary buffer is configured to store the handwriting and eraser drawn in the handwriting canvas, and the frame buffer is configured to store the handwriting and eraser stored in the temporary buffer;
[0008] A processor electrically connected to the display screen is configured to:
[0009] In the handwriting erasing mode, when the target signal is received, if the read-write lock can be obtained, the handwriting data and the eraser stored in the temporary buffer are copied to the frame buffer, and the read-write lock is released after the copy operation is completed; if the read-write lock cannot be obtained, the copy operation is not performed; the display screen is controlled to display the data in the frame buffer; wherein the read-write lock is used to allow only read operations or write operations to be performed during the locking period of the temporary buffer;
[0010] When not in the handwriting erasure mode, when a target signal is received, there is no need to acquire the read-write lock of the temporary buffer.
[0011] In the above technical scheme, a frame buffer and a temporary buffer are set in the memory, and the processor uses the temporary buffer to store the handwriting and eraser drawn on the handwriting canvas, and after obtaining the target signal, when the temporary buffer is not performing read and write operations, the processor obtains the read-write lock of the temporary buffer, locks the temporary buffer so that only read or write operations can be performed, and based on the locked state of the temporary buffer, the content stored in the temporary buffer is copied to the frame buffer, so that the display screen can display the handwriting and eraser in the frame buffer. Since the content drawn in the handwriting canvas will not be written into the temporary buffer during the copying process, the content of the temporary buffer remains unchanged, and there is no problem of eraser tearing in the content in the frame buffer displayed on the display screen, thereby achieving the problem of eraser tearing using a single frame buffer.
[0012] In a feasible implementation manner, the target signal includes a vertical blanking signal, and the vertical blanking signal is used to enable the processor to request to obtain the read-write lock of the temporary buffer.
[0013] If the read-write lock is not released, the read-write lock cannot be acquired;
[0014] If the read-write lock has been released, the read-write lock can be acquired.
[0015] In a feasible implementation manner, if the read-write lock has been released, the read-write lock can be acquired, specifically including:
[0016] The processor creates the read-write lock by calling a synchronization thread. If the read-write lock has not been created by other processes and the read-write lock has been released, the synchronization thread can acquire the read-write lock and copy the handwriting data and eraser stored in the temporary buffer to the frame buffer.
[0017] In a feasible implementation manner, if the read-write lock is not released, the read-write lock cannot be acquired, specifically including:
[0018] The processor creates the read-write lock by calling a synchronization thread. When the read-write lock is created by other processes to perform write operations on the stored data in the temporary buffer, the synchronization thread cannot obtain the read-write lock and cannot copy the handwriting data and eraser stored in the temporary buffer to the frame buffer.
[0019] In the above technical solution, when the processor calls the synchronization thread to synchronize the data stored in the temporary buffer to the frame buffer, since the read-write lock cannot be created repeatedly, the synchronization thread determines whether other threads occupy the read-write lock by creating a read-write lock, and reads the content in the read-write lock when the read-write lock has been released by other threads and is not occupied, so as to ensure that the temporary buffer can only perform read or write operations when it is called, and prevent the read and write operations from modifying the buffer contents at the same time, causing the eraser tearing problem.
[0020] In a feasible implementation manner, before controlling the display screen to display the data in the frame buffer, the processor is further configured to:
[0021] A vertical synchronization signal is acquired, where the vertical synchronization signal is used to enable the processor to control the display screen to display the data in the frame buffer.
[0022] In the above technical solution, the processor uses the interval between the vertical blanking signal generated after the current frame is displayed and the vertical synchronization signal received for the next frame display, when there is no need to display the picture, to copy the contents in the temporary cache to the frame buffer, thereby ensuring that the update of the handwriting data and eraser does not affect the normal display process of the handwriting on the display device.
[0023] In a feasible implementation manner, in the handwriting erasure mode, before receiving the target signal, the processor is further configured to:
[0024] According to the user's erasing operation, the read-write lock of the temporary buffer is obtained, and the dirty area data of the erased handwriting in the handwriting canvas and the eraser with adjusted position are written into the temporary buffer. After the writing operation is completed, the read-write lock of the temporary buffer is released.
[0025] In the above technical solution, when the processor writes the dirty area of the handwriting canvas that erases the handwriting and the eraser with adjusted position into the temporary buffer, it will also acquire the read-write lock of the temporary buffer to lock the temporary buffer so that only write operations can be performed during this process, thereby preventing the frame buffer from reading the contents in the temporary buffer during this process, causing eraser tearing.
[0026] In a second aspect, an embodiment of the present application provides a handwriting erasing method, the method being applied to the display device involved in the first aspect, the method comprising:
[0027] In the handwriting erasing mode, when the target signal is received, if the read-write lock can be obtained, the handwriting data and the eraser stored in the temporary buffer are copied to the frame buffer, and the read-write lock is released after the copy operation is completed; if the read-write lock cannot be obtained, the copy operation is not performed; the display screen is controlled to display the data in the frame buffer; wherein the read-write lock is used to allow only read operations or write operations to be performed during the locking period of the temporary buffer;
[0028] When not in the handwriting erasure mode, when a target signal is received, there is no need to acquire the read-write lock of the temporary buffer.
[0029] The embodiment of the present application provides a handwriting erasing method and a display device, the display device includes: a display screen, a memory and a processor electrically connected to the display screen, a frame buffer and a temporary buffer are set in the memory, the processor uses the temporary buffer to store the handwriting and eraser drawn on the handwriting canvas, and after obtaining the target signal, when the temporary buffer is not performing a read or write operation, obtains the read-write lock of the temporary buffer, locks the temporary buffer so that only a read or write operation can be performed, and based on the locked state of the temporary buffer, copies the content stored in the temporary buffer to the frame buffer, so that the display screen displays the handwriting and eraser in the frame buffer. Since the temporary buffer will not write the content drawn in the handwriting canvas during the copying process, the content of the temporary buffer remains unchanged, and the content in the frame buffer displayed on the display screen does not have the problem of eraser tearing, thereby achieving the problem of eraser tearing using a single frame buffer. BRIEF DESCRIPTION OF THE DRAWINGS
[0030] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0031] Figure 1 A schematic diagram of the hardware configuration of a display device provided by the present application according to an exemplary embodiment;
[0032] Figure 2 A schematic diagram of an eraser tearing according to an exemplary embodiment of the present application;
[0033] Figure 3 A schematic diagram of a flow chart of a handwriting erasing method provided by the present application according to an exemplary embodiment;
[0034] Figure 4 A schematic diagram of a handwriting erasing process provided by the present application according to an exemplary embodiment;
[0035] Figure 5 A schematic diagram of a flow chart of a handwriting erasing method provided by the present application according to another exemplary embodiment;
[0036] Figure 6This is a schematic structural diagram of a handwriting erasing device provided in accordance with an exemplary embodiment of the present application.
[0037] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0038] In order to make the purpose, implementation mode and advantages of the present application clearer, the exemplary implementation mode of the present application will be clearly and completely described below in conjunction with the drawings in the exemplary embodiments of the present application. Obviously, the described exemplary embodiments are only part of the embodiments of the present application, rather than all the embodiments.
[0039] It should be noted that the brief description of terms in this application is only for the convenience of understanding the embodiments described below, and is not intended to limit the embodiments of this application. Unless otherwise specified, these terms should be understood according to their common and usual meanings.
[0040] In addition, the terms "include" and "have" and any variations thereof are intended to cover but not exclude inclusion, for example, a product or device comprising a list of components is not necessarily limited to those components expressly listed but may include other components not expressly listed or inherent to such products or devices.
[0041] The following is an explanation of some of the terms involved in this application:
[0042] Frame rate: The rate at which the graphics processing unit (GPU) generates image frames, which can also be considered as the speed of data processing.
[0043] Screen refresh rate (Refresh Rate): refers to the frequency at which the GPU refreshes the screen, that is, the frequency at which the GPU scans the frame buffer to display the image frames stored in the frame buffer to the screen.
[0044] Vertical synchronization graphics technology: a technology that forces the frame rate to be synchronized with the screen refresh rate of the display, which can handle the problem of screen tearing. When vertical synchronization graphics technology is turned on, the GPU will wait for the Vsync signal of the display to be sent before rendering a new image frame and updating the buffer to keep the frame rate consistent with the screen refresh rate. Vblank is an indication signal generated after the display screen scans and displays a frame of image in a screen refresh cycle, which is used to instruct the GPU to scan and display the next frame of image from the beginning. Therefore, the GPU can also implement vertical synchronization graphics technology by monitoring Vblank. That is, the GPU can achieve vertical synchronization graphics technology to avoid screen tearing by monitoring Vsync or Vblank.
[0045] Frame Buffer: A frame buffer is a direct image of the screen, also known as a bit map or raster. Each storage unit of the frame buffer corresponds to a pixel on the screen, and the entire frame buffer corresponds to a frame of the image. The frame buffer can be located in the system memory of the display device or in the video memory.
[0046] Dirty area: the area that has been edited or updated after the topological relationship of the handwriting is established. In the process of handwriting erasure, the area formed after the handwriting is erased with an eraser.
[0047] An electronic whiteboard is an application program. A display device equipped with the electronic whiteboard can obtain handwriting drawn by a user and display the handwriting. The handwriting can also be erased by an eraser or other erasing tool.
[0048] Figure 1 is a schematic diagram of a hardware configuration structure of a display device 100, such as Figure 1 As shown, in some embodiments, the display device 100 may include a controller 110, a display screen 120, a communicator 130, an input / output interface 140 (eg Figure 1 ), and at least one of the memory 150 .
[0049] like Figure 1 As shown, the controller 110 includes at least one of a random access memory 111 (Random Access Memory, RAM), a read-only memory 112 (Read-Only Memory, ROM), a central processing unit 113 (Central Processing Unit, CPU), a GPU 114, and a communication bus 115 (Bus). The communication bus 115 connects various components.
[0050] In some embodiments, GPU 114 is configured to perform image and graphics related computing tasks in a display device.
[0051] In some embodiments, RAM 111 is configured to store temporary data for an operating system or other running programs.
[0052] In some embodiments, ROM 112 is configured to store various system startup instructions. In some embodiments, ROM 112 is configured to store a basic input / output system, called a Basic Input / Output System (BIOS). It is configured to complete the power-on self-test of the system, the initialization of each functional module in the system, the basic input / output driver of the system, and the booting operating system.
[0053] In some embodiments, when receiving the power-on signal, the display device 100 starts to power on, and the CPU 113 runs the system startup instruction in the ROM 112, and copies the temporary data of the operating system stored in the memory to the RAM 111, so as to start or run the operating system. When the operating system is started, the CPU 113 copies the temporary data of various application programs in the memory to the RAM 111. Then, various application programs are started or run.
[0054] In some embodiments, the CPU 113 is configured to execute operating system and application instructions stored in the memory 140. And according to various interactive instructions received from the outside, various applications, data and content are executed to finally display images and play various audio and video content. For example, an electronic whiteboard application is run, touch data is received, and the touch data is drawn and displayed on the display screen 120 through the electronic whiteboard application.
[0055] In some exemplary embodiments, the CPU 113 may include multiple processors. The multiple processors may include a main processor and one or more sub-processors. The main processor is configured to perform some operations of the display device 100 in the pre-power-on mode and / or display the screen in the normal mode. The one or more sub-processors are configured to perform an operation in the standby mode and the like.
[0056] The display screen 120 may be configured to display images and / or handwriting. In some embodiments, the display screen 120 may include a display screen component configured to present images. In some embodiments, depending on the type of the display screen 120, a drive component configured to drive the display may also be included. In some embodiments, the display screen 120 is a projection display screen, and may also include a projection device and a projection screen.
[0057] In some embodiments, the display panel of the display screen 120 can adopt a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light emitting diode (QLED), etc.
[0058] The user may input a user command in a graphical user interface (GUI) displayed on the display screen 120, and the user input interface receives the user input command through the GUI. Alternatively, the user may input a user command by inputting a specific sound or gesture, and the user input interface recognizes the sound or gesture through a sensor to receive the user input command.
[0059] In some embodiments, the communicator 130 is a component configured to communicate with an external device or an external server according to various communication protocol types. For example, the communicator may include at least one of a Wifi chip, a Bluetooth communication protocol chip, a wired Ethernet communication protocol chip, and other network communication protocol chips or a near field communication protocol chip, and an infrared receiver. In some embodiments, the display device 100 may establish control signal and data signal transmission and reception between the communicator 130 and the external device or content providing device.
[0060] In some embodiments, Figure 1 As shown, the input / output interface 140 is configured to perform data transmission between the controller 110 and other external devices or other controllers, such as receiving video signal data and audio signal data, or command instruction data from external devices.
[0061] In some embodiments, the memory 140 may include storing various software modules configured to drive the display device 100, such as at least one of a basic module, a detection module, a communication module, a display control module, a browser module, and various service modules.
[0062] At present, the handwriting of the display device is only in the erasing process, which can be realized by a frame buffer. Exemplary, in the handwriting writing mode, the CPU of the display device writes the handwriting drawn by the user into the handwriting canvas, and then, the GPU of the display device copies the handwriting drawn into the frame buffer according to the frame rate, and subsequently, the GPU refreshes the handwriting drawn to the display screen for display according to the screen refresh frequency. When the handwriting drawn needs to be erased, the display device enters the handwriting erasing mode. At this time, the CPU first draws an eraser in the handwriting canvas according to the user's instructions (such as characterizing the eraser size shape parameters, and the instructions of the handwriting erasing position), and then, the GPU copies the eraser into the frame buffer where the handwriting drawn is located, and erases the handwriting accordingly, so as to display the handwriting and eraser after the update (i.e. after erasing) in the next screen refresh cycle, and realize the display of the eraser erasing process and the handwriting erasing result.
[0063] In the above process, since the erase position will constantly change, the CPU needs to constantly erase the eraser at the historical erase position in the handwriting canvas according to the user's instructions, and draw the eraser corresponding to the new erase position, and update it to the frame buffer through the GPU to realize the eraser erasing process and the display of handwriting erasure results. Since the eraser needs to be erased and redrawn continuously, there is a large writing delay and the display speed is slow.
[0064] In addition, screen refresh refers to the GPU scanning the image frames stored in the frame buffer line by line to refresh the image stored in the buffer to the display screen. Since there is a time difference in the scanning process from the first line to the last line, in the above scenario, it may happen that the GPU is updating the dirty areas in the handwriting canvas to the frame buffer according to the frame rate while scanning the image frames stored in the frame buffer through the display driver according to the screen refresh frequency. If the frame rate is inconsistent with the screen refresh frequency, for example, the frame rate is greater than the screen refresh frequency, after the GPU refreshes a part of the current image frame stored in the frame buffer, the image frame stored in the frame buffer is changed due to the GPU's write action and becomes the image of the next frame. At this time, the image frame refreshed by the GPU to the display screen will display part of the content of two image frames at the same time.
[0065] During the handwriting erasing process, since the eraser will constantly change its position by erasing and redrawing, the erasers in the two frames of images will be displaced. Therefore, the problem of eraser tearing will occur when the above method is used for processing.
[0066] For example, Figure 2 A schematic diagram of an eraser tearing, such as Figure 2 As shown, the upper half of the image displayed on the display screen ( Figure 2 The current frame shown) and the lower half ( Figure 2The next frame shown in the figure does not belong to the same image frame, that is, the problem of the above-mentioned eraser tearing occurs. Because the eraser is often large in size (usually about 5 cm), it is long for the eraser to refresh the screen, so in this time period, the possibility of writing the image frame simultaneously is greater, and the probability of reading and writing increases, so the problem of tearing occurs more easily.
[0067] In order to solve the above-mentioned eraser tearing problem, the prior art uses a double frame buffering method to avoid the eraser tearing phenomenon. That is, there are a foreground frame buffer and a background frame buffer in the display device, and the foreground frame buffer and the background frame buffer are located in the memory block in the display device system memory or the video memory.
[0068] When the handwriting canvas generates a dirty area due to eraser erasure, the graphics processor (Graphics Processing Unit, GPU) in the display device writes the dirty area into the background frame buffer according to the frame rate, so that the background frame buffer stores the image frame representing the dirty area. After the GPU refreshes the image frame currently in the foreground frame buffer to the display screen for display, the display screen generates a vertical synchronization signal (Vsync) or a vertical blanking signal (Vblank). After the GPU obtains the Vsync / Vblank, the foreground frame buffer is changed to the background frame buffer, and the background frame buffer is changed to the foreground frame buffer. Subsequently, the GPU refreshes the image frame representing the dirty area in the switched foreground buffer to the display screen to realize the display of the eraser erasing process.
[0069] However, when the display device memory is insufficient and double-frame buffering cannot be provided, the above-mentioned double-buffering method for solving the eraser tearing problem cannot be implemented. Therefore, how to avoid the eraser tearing problem in the case of single-frame buffering becomes the focus of research.
[0070] In order to solve the above problems, the present application provides a display device, which sets a frame buffer and a temporary buffer in a memory. The processor uses the temporary buffer to store the handwriting and eraser drawn on the handwriting canvas, and after obtaining the target signal, when the temporary buffer is not performing read and write operations, obtains the read-write lock of the temporary buffer, locks the temporary buffer so that only read or write operations can be performed, and based on the locked state of the temporary buffer, copies the content stored in the temporary buffer to the frame buffer so that the display screen displays the handwriting and eraser in the frame buffer. Since the temporary buffer will not write the content drawn in the handwriting canvas during the copying process, the content of the temporary buffer remains unchanged, and the content in the frame buffer displayed on the display screen does not have the problem of eraser tearing, thereby achieving the problem of eraser tearing solved by using a single frame buffer.
[0071] The following is an introduction to the structure of the display device:
[0072] The display device includes a display screen, a memory and a processor.
[0073] The display screen is configured to display handwriting.
[0074] There are two buffer structures in the memory: a frame buffer and a temporary buffer. Both the frame buffer and the temporary buffer are storage spaces allocated in the memory.
[0075] The frame buffer is a fixed storage space allocated for the electronic whiteboard application, and is only used to store handwriting data and eraser data generated during the use of the electronic whiteboard application. More specifically, the frame buffer is configured to store handwriting and eraser data stored in the temporary buffer.
[0076] The temporary buffer is a storage space temporarily allocated by the electronic device during the use of the electronic whiteboard. It is used to store the dirty area erased by handwriting and eraser data when the electronic device is in the handwriting erasure mode. It can be called by other applications when it is not in the handwriting erasure mode without storing the dirty area erased by handwriting and eraser data.
[0077] The pixel size of the frame buffer and the pixel size of the temporary buffer are both the pixel size of the display screen, and are used to store the handwriting data and / or eraser existing in various areas of the display screen.
[0078] The following uses the processor in the display device as the execution body to explain the process of erasing handwriting when the display device is used in the electronic whiteboard scenario.
[0079] Figure 3 FIG. 1 is a flow chart of a handwriting erasing method provided by the present application according to an exemplary embodiment. Figure 3 As shown, including:
[0080] S100, determining whether to enter the handwriting erasing mode.
[0081] When the electronic device receives a handwriting mode selection instruction, it does not enter the handwriting erasing mode, but enters step S105; wherein the handwriting selection instruction is an instruction generated by the processor when the user clicks or touches an icon related to a "brush" on the display screen.
[0082] When the electronic device receives the handwriting erasing mode selection instruction and enters the handwriting erasing mode, it enters step S101. The handwriting erasing mode is an instruction generated by the processor when the user clicks or touches an icon related to an "eraser" on the display screen.
[0083] S101. In handwriting erasing mode, when a target signal is received, it is determined whether a temporary buffered read-write lock can be acquired.
[0084] The target signal includes a vertical blanking signal Vblank, which is a signal generated by the display screen according to the screen refresh rate, indicating that the display driver has completed the sequential frame buffer scanning. In one embodiment, when the screen refresh rate is 60Hz, the processor obtains the vertical blanking signal Vblank at intervals of 1 / 60 seconds.
[0085] In the handwriting erasing mode, the processor monitors the target signal. When the target signal is received, the content stored in the temporary buffer needs to be read out and the data is copied to the frame buffer.
[0086] More specifically, the processor copies the data in the temporary buffer to the frame buffer by calling the synchronization thread of the electronic whiteboard application.
[0087] In order to ensure that the data stored in the temporary buffer does not change during the process of reading the data stored in the temporary buffer, it is necessary to obtain a read-write lock of the temporary buffer before reading the data in the temporary buffer.
[0088] The read-write lock is configured to lock the read or write function of the temporary buffer, that is, during the acquisition of the read-write lock, the processor can only perform one operation on the temporary buffer, so as to prevent the display screen corresponding to the read data from being torn due to data writing during the process of reading the data stored in the temporary buffer.
[0089] More specifically, the synchronization thread obtains the temporarily buffered read-write lock by creating a read-write lock. Due to the characteristic that the read-write lock cannot be created repeatedly, the synchronization thread needs to determine whether the temporarily buffered read-write lock can be obtained.
[0090] If the read-write lock of the temporary buffer can be acquired, it means that no other thread operates on the temporary buffer, and the content in the temporary buffer can be read. The processor enters step S102 to perform subsequent operations.
[0091] If the read-write lock of the temporary buffer cannot be obtained, it means that other threads are performing write operations on the temporary buffer. For example, the drawing thread copies the handwriting data and eraser in the handwriting canvas into the temporary buffer and performs write operations on the temporary buffer. Before performing the write operation, the drawing thread will obtain the read-write lock to lock the write function of the temporary buffer. Since other threads have obtained the read-write lock by creating a read-write lock, the read-write lock is occupied, and the synchronization thread cannot obtain the read-write lock again, and cannot read the contents of the temporary buffer. The processor enters step S103 for subsequent operations.
[0092] S102, copying the handwriting data and eraser stored in the temporary buffer to the frame buffer, and releasing the read-write lock after completing the copy operation.
[0093] When the read-write lock of the temporary buffer is available, the read function of the temporary buffer is locked, and the handwriting data stored in the temporary buffer and the drawn eraser are copied to the frame buffer.
[0094] The handwriting data stored in the temporary buffer is obtained by copying from the handwriting canvas. That is, the handwriting canvas responds to the user's erasing operation, erases the handwriting corresponding to the erasing operation in the handwriting canvas, and determines the dirty area according to the handwriting erasing area position and area range. After the erasing operation is completed, the dirty area and the eraser in the handwriting canvas are copied to the temporary buffer.
[0095] After the temporary buffer obtains the data of the dirty area and the eraser data, after obtaining the target signal, it obtains the read-write lock, copies the dirty area in the temporary buffer to the frame buffer, and updates the data at the corresponding area of the dirty area in the frame buffer.
[0096] It is worth noting that after completing the above copy operation, the read-write lock needs to be released so that other threads can call other functions of the temporary buffer.
[0097] After this step is completed, proceed to step S104.
[0098] S103: No copy operation is performed.
[0099] If the read-write lock on the temporary buffer cannot be acquired, the opportunity to synchronize the frame buffer with the temporary buffer will be skipped, leaving the contents stored in the frame buffer unchanged.
[0100] After this step is completed, proceed to step S104.
[0101] S104, controlling the display screen to display the data in the frame buffer.
[0102] More specifically, when the processor receives the vertical synchronization signal Vsync, it controls the display screen to display the frame buffer.
[0103] Among them, when this step is the step entered after the completion of step S102, the processor can display the changes of the handwriting data and the changes of the eraser after the vertical synchronization signal Vsync is obtained this time.
[0104] If this step is entered after step S103 is completed, the processor cannot display the change of handwriting data and eraser after the vertical synchronization signal Vsync is obtained this time. However, before the subsequent vertical synchronization signal comes, after obtaining the target signal, when the read-write lock can be obtained, the handwriting data and eraser that need to be written into the temporary buffer this time can be written into the temporary buffer. Since the interval time of each vertical synchronization signal is short, the human eye is not easy to detect the writing delay of the time interval.
[0105] S105: When the target signal is received, there is no need to acquire the read-write lock of the temporary buffer.
[0106] When the electronic device is not in the handwriting erase mode, there is no need to use a temporary buffer to store the contents of the handwriting canvas. There is no need to obtain the read-write lock of the temporary buffer and lock the read operation of the temporary buffer when the target signal is obtained, and copy the contents stored in the temporary buffer to the frame buffer.
[0107] In the above technical solution, the processor uses the interval between the vertical blanking signal generated after the current frame is displayed and the vertical synchronization signal received for the next frame display, when there is no need to display the picture, to copy the content in the temporary cache to the frame buffer, and write the handwriting content and eraser into the temporary buffer during the remaining period. By separating the read operation and the write operation of the temporary buffer, it is ensured that the content in the frame buffer displayed on the display screen does not have the problem of eraser tearing, thereby realizing the solution to the eraser tearing problem by using a single frame buffer.
[0108] The following is an explanation of the handwriting erasure process. Figure 4 The present application provides a schematic diagram of a handwriting erasure process according to an exemplary embodiment.
[0109] like Figure 4 As shown, it includes three frame periods T. At the start time of the first frame period, the vertical synchronization signal Vsync is obtained, and the processor displays the first handwriting data 150 stored in the frame buffer.
[0110] In the period between the vertical synchronization signal Vsync and the vertical blanking signal Vblank of the first frame cycle, the handwriting erasing mode is entered, and in response to the user's erasing operation, the handwriting is erased in the handwriting canvas and the eraser is drawn. After the drawing operation is completed, the drawing thread obtains the read-write lock of the temporary buffer, writes the dirty area data of the erased handwriting in the handwriting canvas and the eraser after the position adjustment into the temporary buffer, and releases the read-write lock of the temporary buffer after the writing operation is completed.
[0111] When the contents of the handwriting canvas are copied into the temporary buffer, the temporary buffer cannot be read due to the setting of the read-write lock.
[0112] In the first frame cycle, after obtaining the vertical blanking signal Vblank, the synchronization thread obtains the read-write lock, writes the dirty area data of the erased handwriting in the temporary buffer and the eraser with adjusted position into the frame buffer, and the handwriting data stored in the frame buffer is adjusted to the second handwriting data 151.
[0113] After completing the above reading operation on the temporary buffer, the synchronization thread releases the read-write lock.
[0114] When entering the second frame period, the vertical synchronization signal Vsync of the first frame period is obtained, and the processor displays the second handwriting data 151 stored in the frame buffer.
[0115] In the period between the vertical synchronization signal Vsync and the vertical blanking signal Vblank of the second frame period, in response to the user's erasing operation, the corresponding handwriting is erased in the handwriting canvas, and the eraser with the changed position is drawn. After the drawing operation is completed, the drawing thread obtains the read-write lock of the temporary buffer, writes the dirty area data of the erased handwriting in the handwriting canvas and the eraser with the adjusted position into the temporary buffer, and releases the read-write lock of the temporary buffer after the writing operation is completed.
[0116] Since the writing process to the temporary buffer has not been completed in the second frame period, the vertical blanking signal Vblank of the second frame period is obtained, and the synchronization thread cannot obtain the read-write lock, so it cannot read the temporary buffer and complete the update of the content in the frame buffer. The handwriting data stored in the frame buffer is still the second handwriting data 151.
[0117] When entering the second frame period, the vertical synchronization signal Vsync of the first frame period is obtained, and the processor displays the second handwriting data 151 stored in the frame buffer.
[0118] In the third frame cycle, when the vertical blanking signal Vblank is obtained, the synchronization thread obtains the read-write lock, writes the dirty area data of the erased handwriting in the temporary buffer updated in the previous frame cycle and the eraser with adjusted position into the frame buffer, and the handwriting data stored in the frame buffer is adjusted to the third handwriting data 152.
[0119] Since the update of handwriting data is delayed by only one frame period, the human eye cannot distinguish the delay when the screen refresh rate is high. In addition, during the above data update process, due to the setting of the read-write lock, there will be no simultaneous reading and writing in the temporary buffer, so that during the update of the frame buffer content, the eraser data and the dirty area data will not change, and eraser tearing will not occur, thereby solving the eraser tearing problem using a single frame buffer.
[0120] In addition, since only the data in the dirty area is updated when the handwriting data is updated in the frame buffer and the temporary buffer, the speed of data update is increased, thereby improving the display efficiency of the handwriting erasing process.
[0121] The following is an explanation of the process of a display device running an electronic whiteboard application.
[0122] Figure 5 FIG. 1 is a flow chart of a handwriting erasing method provided by the present application according to another exemplary embodiment. Figure 5 As shown, the method includes:
[0123] S200: Start the electronic whiteboard application.
[0124] S201, initialize the frame buffer and temporary buffer.
[0125] When the processor starts the electronic whiteboard application, the frame buffer and temporary buffer need to be initialized first.
[0126] S202: Determine whether the entry mode is a handwriting writing mode or a handwriting erasing mode.
[0127] If a handwriting mode selection instruction is obtained, the handwriting writing mode is entered, wherein the handwriting writing selection instruction is an instruction generated by the processor when the user clicks or touches an icon related to a "brush" on the display screen.
[0128] If a handwriting erasing mode selection instruction is obtained, the handwriting erasing mode is entered, wherein the handwriting erasing mode is an instruction generated by the processor when the user clicks or touches an icon related to an "eraser" on the display screen.
[0129] If it is the handwriting writing mode, go to step S203; if it is the handwriting erasing mode, go to step S202.
[0130] S203, drawing the handwriting on the handwriting canvas.
[0131] In response to the user's drawing operation, the handwriting is drawn in the handwriting canvas according to the touch data corresponding to the drawing operation.
[0132] S204, updating the dirty area in the handwriting canvas to the frame buffer.
[0133] After the brush canvas finishes drawing the newly added brush strokes, the dirty area containing the newly added brush strokes is updated to the frame buffer.
[0134] S205, receiving a vertical synchronization signal, and controlling the display to display a frame buffer.
[0135] S206: Is it finished?
[0136] If it is finished, the process proceeds to step S207 to stop using the electronic whiteboard application; if it is not finished, the process proceeds to step S202 to determine whether to continue drawing the handwriting or to erase the handwriting.
[0137] S207, end.
[0138] S208. According to the erasing operation of the user, the handwriting at the corresponding position in the handwriting canvas is erased, and an eraser is drawn.
[0139] S209, obtaining a read-write lock of a temporary buffer, and writing the dirty area data of the erased handwriting in the handwriting canvas and the eraser after position adjustment into the temporary buffer.
[0140] S210: After the write operation is completed, the temporary buffered read-write lock is released.
[0141] Among them, step S208 to step S210 are steps performed by the drawing thread when there is a dirty area in the current frame cycle, and the process of updating the data of the dirty area and the eraser stored in the handwriting canvas to the frame buffer is completed step by step in sequence.
[0142] If there is no dirty area in the current frame period, steps S208 to S210 are not performed. After determining in step S202 that the handwriting erasing mode is in progress, the process directly jumps to step S211.
[0143] S211 . When a vertical blanking signal is received, determine whether a read-write lock of a temporary buffer can be acquired.
[0144] Among them, step S211 is a step triggered after the vertical blanking signal is obtained during the process of the synchronization thread monitoring the vertical blanking signal. The synchronization thread and the drawing thread are two different threads.
[0145] When the current frame includes steps S208 to S210, step S211 may be located between any step of steps S208 to S210, or after step S210.
[0146] When step S211 is between any step from step S208 to step S210, the read-write lock of the temporary buffer cannot be acquired, and the process proceeds to step S202 to enter the next frame cycle.
[0147] When step S211 is after step S210, the process proceeds to step S212 to update the content of the frame buffer.
[0148] S212, acquiring a read-write lock, copying the handwriting data and eraser stored in the temporary buffer to the frame buffer, and releasing the read-write lock after the copy operation is completed.
[0149] S213, receiving a vertical synchronization signal, and controlling the display to display data in the frame buffer.
[0150] S214: Is it finished?
[0151] If it is finished, the process proceeds to step S215 to stop using the electronic whiteboard application; if it is not finished, the process proceeds to step S202 to determine whether to continue drawing the handwriting or to erase the handwriting.
[0152] S215, end.
[0153] Figure 6 This is a schematic diagram of the structure of a handwriting erasing device provided by the present application according to an exemplary embodiment. Figure 6As shown, the device includes: an erasing module 11 and a display module 12.
[0154] The erasing module 11 is configured to acquire the read-write lock of the temporary buffer when receiving the target signal in the handwriting erasing mode, and if the read-write lock can be acquired, copy the handwriting data and the eraser stored in the temporary buffer to the frame buffer, and release the read-write lock after the copy operation is completed, and if the read-write lock cannot be acquired, do not perform the copy operation. The read-write lock is used to allow only read operations or write operations to be performed during the temporary buffer lock period.
[0155] The erasing module 11 is also configured not to be in the handwriting erasing mode, and when receiving the target signal, it is not necessary to acquire the read-write lock of the temporary buffer.
[0156] The display module 12 is configured to display the data in the frame buffer.
[0157] Optionally, the target signal includes a vertical blanking signal, and the vertical blanking signal is used to enable the processor to request to obtain a read-write lock of the temporary buffer.
[0158] If the read-write lock is not released, the read-write lock cannot be acquired;
[0159] If the read-write lock has been released, the read-write lock can be acquired.
[0160] Optionally, the erasing module 11 is also configured to create a read-write lock by calling a synchronization thread. If the read-write lock has not been created by other processes and the read-write lock has been released, the synchronization thread can acquire the read-write lock and copy the handwriting data and eraser stored in the temporary buffer to the frame buffer.
[0161] Optionally, the erasing module 11 is also configured to create a read-write lock by calling a synchronization thread. When the read-write lock is created by other processes to perform write operations on the temporarily buffered storage data, the synchronization thread cannot obtain the read-write lock and cannot copy the handwriting data and eraser stored in the temporary buffer to the frame buffer.
[0162] Optionally, the erasing module 11 is further configured to control the display screen to display the frame buffer when a vertical synchronization signal is received.
[0163] Optionally, the erasing module 11 is also configured to obtain a read-write lock of a temporary buffer according to an erasing operation by the user, write the dirty area data of the erased handwriting in the handwriting canvas and the eraser with adjusted position into the temporary buffer, and release the read-write lock of the temporary buffer after the writing operation is completed.
[0164] Optionally, the erasing module 11 is further configured to erase the handwriting corresponding to the dirty area in the temporary buffer by using the position information and area range information of the dirty area during the process of writing the dirty area data into the temporary buffer.
[0165] Optionally, the erasing module 11 is further configured to start the electronic whiteboard application and initialize the temporary buffer and the frame buffer;
[0166] If a handwriting mode selection instruction is obtained, the handwriting mode is entered to write the dirty area data of the handwriting drawn in the handwriting canvas into the frame buffer according to the user's writing operation, and the data in the frame buffer is displayed on the display screen;
[0167] If the handwriting erasing mode selection command is obtained, the handwriting erasing mode is entered.
[0168] The present application also provides a computer-readable storage medium, which may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, and other media that can store program codes. Specifically, the computer-readable storage medium stores computer execution instructions, which are used to indicate the method in the above embodiment.
[0169] The present application also provides a computer program product, which includes an execution instruction, which is stored in a readable storage medium. At least one erasing module of the display device can read the execution instruction from the readable storage medium, and at least one erasing module executes the execution instruction so that the display device implements the handwriting erasing method provided by the various embodiments described above.
[0170] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0171] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A display device, characterized in that: The display device comprises: a display screen configured to display handwriting; A memory, comprising a frame buffer and a temporary buffer; the temporary buffer is configured to store the handwriting and eraser drawn in the handwriting canvas, and the frame buffer is configured to store the handwriting and eraser stored in the temporary buffer; A processor electrically connected to the display screen is configured to: In the handwriting erasing mode, when the target signal is received, if the read-write lock can be obtained, the handwriting data and the eraser stored in the temporary buffer are copied to the frame buffer, and the read-write lock is released after the copy operation is completed; if the read-write lock cannot be obtained, the copy operation is not performed; the display screen is controlled to display the data in the frame buffer; wherein the read-write lock is used to allow only read operations or write operations to be performed during the locking period of the temporary buffer; When not in the handwriting erasure mode, when a target signal is received, there is no need to acquire the read-write lock of the temporary buffer.
2. The display device according to claim 1, characterized in that The target signal includes a vertical blanking signal, and the vertical blanking signal is used to make the processor request to obtain the read-write lock of the temporary buffer. If the read-write lock is not released, the read-write lock cannot be acquired; If the read-write lock has been released, the read-write lock can be acquired.
3. The display device according to claim 2, characterized in that If the read-write lock has been released, the read-write lock can be acquired, specifically including: The processor creates the read-write lock by calling a synchronization thread. If the read-write lock has not been created by other processes and the read-write lock has been released, the synchronization thread can acquire the read-write lock and copy the handwriting data and eraser stored in the temporary buffer to the frame buffer.
4. The display device according to claim 2, characterized in that If the read-write lock is not released, the read-write lock cannot be acquired, specifically including: The processor creates the read-write lock by calling a synchronization thread. When the read-write lock is created by other processes to perform write operations on the stored data in the temporary buffer, the synchronization thread cannot obtain the read-write lock and cannot copy the handwriting data and eraser stored in the temporary buffer to the frame buffer.
5. The display device according to claim 1, characterized in that Before controlling the display screen to display the data in the frame buffer, the processor is further configured to: A vertical synchronization signal is acquired, where the vertical synchronization signal is used to enable the processor to control the display screen to display the data in the frame buffer.
6. The display device according to any one of claims 1 to 5, characterized in that: In the handwriting erasing mode, before receiving the target signal, the processor is further configured to: According to the user's erasing operation, the read-write lock of the temporary buffer is obtained, and the dirty area data of the erased handwriting in the handwriting canvas and the eraser with adjusted position are written into the temporary buffer. After the writing operation is completed, the read-write lock of the temporary buffer is released.
7. The display device according to claim 6, characterized in that The dirty area data includes location information and area range information of the dirty area; Before acquiring the read-write lock of the temporary buffer and writing the dirty area data of the erased handwriting in the handwriting canvas and the eraser after position adjustment into the temporary buffer, the processor is further configured to: According to the erasing operation of the user, the handwriting corresponding to the erasing operation in the handwriting canvas is erased, and the dirty area is determined according to the handwriting erasing area position and area range.
8. The display device according to claim 1, characterized in that The display device also includes a handwriting writing mode. Before the display device enters the handwriting erasing mode, the processor is further configured to: Starting the electronic whiteboard application and initializing the temporary buffer and the frame buffer; If a handwriting writing mode selection instruction is obtained, the handwriting writing mode is entered, so as to write the dirty area data of the handwriting drawn in the handwriting canvas into the frame buffer according to the writing operation of the user, and display the data in the frame buffer on the display screen; If the handwriting erasing mode selection command is obtained, the handwriting erasing mode is entered.
9. The display device according to claim 1, characterized in that The pixel size of the frame buffer and the pixel size of the temporary buffer are both the pixel size of the display screen.
10. A handwriting erasing method, characterized in that: The method is applied to the display device according to any one of claims 1 to 9, and the method comprises: In the handwriting erasing mode, when the target signal is received, if the read-write lock can be obtained, the handwriting data and the eraser stored in the temporary buffer are copied to the frame buffer, and the read-write lock is released after the copy operation is completed; if the read-write lock cannot be obtained, the copy operation is not performed; the display screen is controlled to display the data in the frame buffer; wherein the read-write lock is used to allow only read operations or write operations to be performed during the locking period of the temporary buffer; When not in the handwriting erasure mode, when a target signal is received, there is no need to acquire the read-write lock of the temporary buffer.
