Simulated overlapping surface implementation method based on the MPU interface LCD module
Technical field
The present invention relates to a kind of LCD MODULE covering surfaces (Overlay Surface) implementation method, especially relate to a kind of software simulation covering surfaces implementation method based on MPU interface LCD module (LCM).
Background technology
Covering surfaces also is known as overlapped surfaces or overlayer usually, is the surface of the specific hardware supported of a kind of needs.By the covering surfaces technology, can realize transparent and special efficacy convergent-divergent, and allow to have the first type surface of different pixel formats and covering surfaces and combine and need not to carry out the conversion of pixel format.Covering surfaces is normally used for showing real-time video, video record, or static bitmap is on first type surface, and do not need to carry out the content that Blit operates on the first type surface or changes first type surface with any method.Common covering surfaces that is to say that fully by hardware supported lcd controller must have this function.But at present, a lot of integrated lcd controllers of embedded type CPU are not supported covering surfaces.When displaying video, just must will the picture displayed data copy on the video memory like this, could realize showing by memory copying.If the pixel format of video source and first type surface are inequality, then also must carry out format conversion, and this is an action more consuming time.Therefore, the inefficiency in the time of can causing displaying video is play discontinuous.
Summary of the invention
The object of the present invention is to provide a kind of simulated overlapping surface implementation method based on the MPU interface LCD module, can make on the LCD lcd controller that in the embedded type CPU integrated system, does not have hardware covering surfaces function, realize the covering surfaces function, reached the display effect of covering surfaces.
For achieving the above object, a kind of simulated overlapping surface implementation method based on the MPU interface LCD module of the present invention may further comprise the steps:
When A, beginning whole screen is considered as an original rectangular;
B, past original rectangular are inserted an energy by the rectangle that original rectangular comprised, and original rectangular is divided into a plurality of rectangles;
In C, the rectangle that in step B, forms, all be not that 0 rectangle is the Rule of judgment of effective rectangle, find out all effective rectangles according to the height and width of rectangle;
D, from the combination of effective rectangle, find the one or more rectangles that meet display condition, with the coordinate figure of rectangle coordinate register in the LCD MODULE is set, then the rectangle corresponding display content is flushed on the LCD MODULE, on display screen, produce one by first type surface and the synthetic image of covering surfaces;
The present invention is not when needing to show covering surfaces, and the rectangle deletion with inserting among the step B reverts to original rectangular.
Rectangle partition process among the B of step described in the present invention is: two limits up and down that will insert rectangle prolong, up to be inserted into rectangle about two limits intersect, divide the new rectangle of coming out thus.
Each effective rectangle comprises following attribute described in the present invention:
A. the chain list index is used for own chain is gone into visual or not visible chained list;
B. the regional therewith surperficial pointer that is associated;
C. parents' regional indicator;
D. pixel format;
E. store data type.Be divided into continuously, be used for the pilot brush New Policy with discontinuous;
F. video memory address;
G. the dirty sign of video memory is used to represent whether displaying contents has changed.
The concrete steps of finding out all effective rectangles among the C of step described in the present invention are:
1, obtains the wide and high of each new rectangle;
2, from new rectangle, take out one;
3, judging whether the wide or high of new rectangle is 0, promptly is to judge whether this rectangle is invalid rectangle;
If 4 invalid rectangles are abandoned;
If 5 effective rectangles are then preserved this rectangle;
6, from new rectangle, take out the next one again;
7, repeat 3,4,5,6 three steps are up to handling all rectangles;
8, finish above step, will obtain rectangular set.
Display condition of the present invention is that the attribute set when refreshing with request of one of attribute of selected effective rectangle is identical.
Step display described in the present invention is:
1) from the rectangular set that generates, takes out a rectangle;
2) judge whether the rectangle corresponding display content changes, the dirty true time that is masked as of the video memory in the rectangle attribute is represented to have changed, for fictitious time is represented not change; Judge promptly whether this rectangle needs to refresh;
3) if do not need to refresh, then abandon;
4) if need refresh, then the coordinate figure with this rectangle is provided with coordinate register relevant in the LCD MODULE, refreshes scope to select it, and then the video data of rectangle correspondence is flushed to LCD MODULE;
5) in the rectangular set that from the rectangle partiting step, generates, take out next rectangle;
6) repeating step 2~5, up to having refreshed all rectangles.
Because the present invention has utilized MPU interface LCD module LCM, by to showing that rectangle carries out simple process, just realized the function of covering surfaces, making does not have the embedded type CPU of hardware covering surfaces function, and the function of covering surfaces also can be provided.Because on the basis of covering surfaces, for showing real-time video, video record, or the such operation on first type surface of static bitmap, the content that need not to carry out memory copying and revise first type surface is so can significantly improve display speed.And support the YUV pixel format for some, but the embedded type CPU of support hardware covering surfaces not, because covering surfaces can support pixel format and first type surface inequality, so can also save the very long switching time that yuv format is converted to rgb format, display speed improves a lot especially.
Description of drawings
The present invention is further illustrated below in conjunction with specific embodiment.
Fig. 1 is an original rectangular;
Fig. 2 is the division figure when inserting a rectangle;
Fig. 3 is the figure that is used to analyze partiting step.
Embodiment
As Fig. 1, Fig. 2 and shown in Figure 3, insert an energy by the rectangle that original rectangular comprised toward original rectangular, original rectangular is divided into a plurality of rectangles; Two limits up and down that to insert rectangle prolong, up to be inserted into rectangle about two limits intersect, divide the new rectangle of coming out thus.Have 1~5 (rectangle that comprises insertion), hypothesis always generates 5 new rectangles earlier, and these 5 rectangles are judged, and is specific as follows:
1) calculates the wide and high of 5 new rectangles;
2) from 5 new rectangles, take out one;
3) judging whether the wide or high of new rectangle is 0, promptly is to judge whether this rectangle is invalid rectangle;
4) if invalid rectangle abandon;
5) if effective rectangle is then preserved this rectangle;
6) from 5 new rectangles, take out the next one.
7) repeat 4,5,6,7 three steps are up to handling all rectangles;
8) finish above step, will obtain rectangular set.
In effective rectangular set that step 8) obtains, each effective rectangle comprises following attribute:
A. the chain list index is used for own chain is gone into visual or not visible chained list;
B. the regional therewith surperficial pointer that is associated;
C. parents' regional indicator;
D. pixel format;
E. store data type.Be divided into continuously, be used for the pilot brush New Policy with discontinuous;
F. video memory address;
G. the dirty sign of video memory is used to represent whether displaying contents has changed.
As shown in Figure 3, original rectangular has been divided into 5 new rectangles.
Because video data is deposited by row, is the data continuity that guarantees that as far as possible each is regional, two horizontal sides up and down of the rectangle put into are extended, intersect with two limits about former rectangle.
Suppose each rectangle upper left corner coordinate and lower right corner coordinate representation, (x, represent by form y) with P for point coordinate.Original rectangular represents that with T the rectangle of putting into represents that with K other alphabetical implication is as follows:
l:left
r:right
t:top
b:bottom
It is as shown in table 1 then can to obtain each newly-generated rectangle:
Table 1
The rectangle sequence number |
Upper left corner coordinate P (x, y) |
Lower right corner coordinate P (x, y) |
Wide | High | |
0 |
Tl,Tt |
Tr,Kt-1 |
Tr-Tl+1 |
Kt-Tt |
1 |
Tl,Kt |
Kl-1,Kb |
Kl-Tl |
Kb-Kt+1 |
2 |
Kl,Kt |
Kr,Kb |
Kr-Kl+1 |
Kb-Kt+1 |
3 |
Kr+1,Kt |
Tr,Kb |
Tr-Kr |
Kb-Kt+1 |
4 |
Tl,Kb+1 |
Tr,Tb |
Tr-Tl+1 |
Tb-Kb |
The sequence number of rectangle is by from left to right, from top to bottom tactic.When some rectangles wide or high is 0, represent that this rectangle is invalid.By this Rule of judgment, just can obtain effective rectangular set and merge preservation.Effective rectangular set in this example be 0,1,2,3,4}, wherein sequence number is that the surface of 2 rectangle correspondence is a covering surfaces, the surface of all the other rectangle correspondences is a first type surface.
From effective rectangle combination, find the one or more rectangles that meet display condition (attribute of setting when one of attribute that is rectangle refreshes with request is identical), with the coordinate figure of rectangle coordinate register in the LCD MODULE is set, then the rectangle corresponding display content is flushed on the LCD MODULE, on display screen, produce one by first type surface and the synthetic image of covering surfaces;
Concrete step is:
1, in the rectangular set that from the rectangle partiting step, generates, takes out a rectangle;
2, judge whether the rectangle corresponding display content changes, judge promptly whether this rectangle needs to refresh;
3, if do not need to refresh, then abandon;
4, if need refresh, then the coordinate figure with this rectangle is provided with coordinate register relevant among the LCM, refreshes scope to select it, and then the video data of rectangle correspondence is flushed to LCM;
5, in the rectangular set that from the rectangle partiting step, generates, take out next rectangle;
6, repeating step 2~5, up to having refreshed all rectangles.
After displaying contents changes, need refresh, the dirty true time that is masked as of the video memory in the rectangle attribute is represented to have changed, for fictitious time is represented not change.Corresponding tables 1, if the displaying contents of first type surface has changed, then only need refresh rectangle 0,1,3,4}; If the displaying contents of covering surfaces has changed, then only need refresh rectangle { 2}.When refreshing, the relevant coordinate register of LCM is set, refreshes scope to select it, and then the video data of rectangle correspondence is flushed to LCM with the coordinate figure that refreshes rectangle.
If when not needing to show covering surfaces, the rectangle deletion with inserting reverts to original rectangular.