1 Skia Update 2 3 Skia : Access 4 - https://skia.org 5 - https://skia.googlesource.com/skia 6 7 Skia : Overview 8 - portable graphics engine 9 - 2D transformations + perspective 10 - primitives: text, geometry, images 11 - effects: shaders, filters, antialiasing, blending 12 13 Skia : Porting 14 - C++ and some SIMD assembly 15 - Fonts : CoreText, FreeType, GDI, DirectWrite 16 - Threads : wrappers for native apis 17 - Memory : wrappers for [new, malloc, discardable] 18 19 Skia : Backends 20 - Surface 21 -- raster : ARGB, RGB16, A8 in software 22 -- gpu : transcribe to OpenGL 23 - Document 24 -- transcribe to PDF or XPS 25 - Record and Playback 26 -- Picture 27 -- Pipe 28 29 Skia : Clients 30 - Blink : under the GraphicsContext hood 31 - Chrome : ui/gfx and compositor 32 - Android : framework 33 - third parties : e.g. Mozilla 34 35 Skia In Blink 36 37 Skia In Blink : Fonts 38 - SkTypeface and SkFontMgr : platform agnostic 39 - Runtime switch between GDI and DirectWrite 40 - SkTextBlob to encapsulate runs of text 41 - Push LCD decision-making out of Blink 42 43 Skia In Blink : Record-Time-Rasterization 44 - What? : direct rendering during Paint pass 45 -- Image scaling, filters 46 -- SVG patterns, masks 47 - Problematic in modern Blink 48 -- CTM not always known/knowable 49 -- Rendering backend not always known (gpu or cpu) 50 -- Rasterization takes (too much) time 51 52 Skia In Blink : RTR response 53 - SkImageFilter w/ CPU and GPU implementations 54 - Bitmap scaling : bilerp, mipmaps, fancy 55 - SkPicture for caching SVG 56 - SkPicture + saveLayer() for masks 57 -- PathOps for resolving complex paths 58 - SkPictureShader for device-independent patterns 59 60 Skia In Blink : Recording 61 - GraphicsContext (now) backed by SkPicture 62 -- draw commands are recorded for later playback 63 -- all parameters must be copied or (safely) ref'd 64 -- may record more than is currently visible 65 - Resulting picture may be replayed multiple times 66 -- from different thread(s) 67 68 Skia In Blink : Recording response 69 - New implementation 70 - Optimized for recording speed 71 -- shallow copies whenever possible 72 -- rearchitect all Skia effects to be immutable 73 - Reentrant-safe for playback in multiple threads 74 -- also affected effect subclasses 75 76 Skia In Blink : Playback 77 - Separate pass for optimizations (optional) 78 -- peep-holes rewrites 79 -- compute bounding-box hierarchy for faster tiling 80 -- can be done outside of Blink thread 81 - GPU optimizations 82 -- layer "hoisting" 83 -- distance fields : fonts and concave paths 84 85 Skia In Blink : multi-picture-draw 86 - mpd(canvas[], picture[], matrix[], paint[]) 87 - Requires independent canvas objects 88 -- all other parameters can be shared 89 -- draw order is unspecified 90 - Examples 91 -- 1 picture drawing to multiple tiles (canvases) 92 -- multiple pictures each drawing to its own layer 93 94 Skia In Blink : MPD optimizations* 95 - GPU 96 -- "layer hoisting" to reduce rendertarget switching 97 -- layer atlasing (also applies to imagefilters) 98 -- pre-uploading of textures 99 -- atlas yuv (from jpeg) to convert on gpu 100 - CPU 101 -- parallel execution using thread pool 102 -- pre-decoding of images based on visibility 103 104 Skia : Roadmap 105 106 Skia : Roadmap - performance 107 - GPU 108 -- extended OpenGL features (e.g. geometry shaders) 109 -- reordering for increased batching 110 -- support for new low-level OpenGL APIs 111 - CPU 112 -- SIMD applied to floats 113 -- smarter culling in pictures 114 115 Skia : Roadmap - API 116 - Cross process support 117 - Direct support for sRGB 118 - Robust file format 119 - Support PDF viewing 120 - Stable C ABI 121 -- bindings for JS, Go, Python, Lua 122 123 Demo 124