摘要 |
A method and a device for reducing the waste of the central process unit (CPU) resource during the filling process of a vector graphic, and the method includes: parsing the vector graphic to obtain a series of polygons; mapping the polygons into a new drawing coordinate whose unit is 1/2n pixel using a transform parameter and a transform matrix, while updating an original drawing window into the new drawing coordinate at the same time, wherein the transform parameter is A, A=2n/K, n is a shift parameter, the unit of the vertex coordinate of the polygon is 1/K pixel, and n, K are valued for natural numbers; obtaining the portions of the polygons located in the new drawing window in the new drawing coordinate; transforming the portions of the polygons located in the new drawing window in the new drawing coordinate into a group of scan segments; and shifting the original code of the coordinate of the scan segments to right by n bit, and rendering the pixels of the shifted scan segments. In the embodiment of the present invention, when the pixels covered by the scanning line are rendered, and the division operations are replaced with the manner of shifting the coordinate values, and the generated polygon cutting error is transferred to the calculating process before the rendering, the division operation is reduced in the precondition of ensuring the result is correct, so that the occupation of the CPU resource is reduced. |