分类:
2009-03-18 15:56:40
2D的图形引擎使用的是SGL,来自于Skia的一部份。Skia是google的开源项目。Chrome浏览器就是使用的skia进行渲染。
Skia大概80000行C++代码,有以下特点:
· Optimised software-based rasteriser (module )[优化的软件光光栅]
· Optional GL-based acceleration of certain graphics operations including shader support and textures (module )[某些图形操作可选基于GL的加速器,这些操作包括阴影和纹理]
· Animation capabilities (module )[动画支持]
· Some built-in SVG support (module ()[一些内建SVG支持]
· Built-in image decoders: PNG, JPEG, GIF, BMP, WBMP, ICO (modules images/)[内建图像解码器]
· Text capabilities (no built-in support for complex scripts) [文本支持]
· Some awareness of higher-level UI toolkit constructs (platform windows, platform events): Mac, Unix (sic. X11, incomplete), Windows, wxwidgets[一些知名的上层UI构建工具 (视窗平台,事件平台) ,Windows and X widgets,最早命名为 wxWindows,是一个开放原始码且跨平台的物件工具集]
· Performace features[执行特点]
§ Copy-on-write for images and certain other data types[图像和其他某些类型的写时拷贝]
§ Extensive use of the stack, both internally and for consumers to avoid needless allocations and memory fragmentation[有系统的使用stack, 不管是内部或者 用户,都会避免不必要的内存分配和碎片]
§ Thread-safety to enable parallelisation[线程安全并能并行处理]
· The library is portable and has (optional) : [可移植的库]
· Fonts: Android / , FreeType, Windows (GDI) [字体]
· Threading: pthread, Windows[线程]
· XML: expat, tinyxml
· Android shared memory (ashmem) for inter-process image data references[为内部处理图像数据提供共享内存]
通过上面的描述可以定位到模块的功能。下面基本上就可以看具体的实现了。主要的有两个部分:sgl和gl模块。