introduction to skia. a modern 2d graphics library (elce 2014)

49
A modern 2D graphics library Introduction to Eduardo Lima Mitev [email protected] October 14th, 2014

Upload: igalia

Post on 04-Dec-2014

184 views

Category:

Technology


2 download

DESCRIPTION

By Eduardo Lima. While user experiences are increasingly moving to 3D, rendering of 2D content remains at the core of how we interact with computer applications today. Skia is an open-source project maintained by Google whose goal is to bring the best 2D graphics library to a variety of targets, from mobile to desktop and embedded. Skia is used in highly popular projects like Mozilla Firefox, the Chromium browser and Android. This talk will introduce Skia to developers and users, giving an overview of its design, architecture and features. It will also discuss briefly how hardware acceleration improves performance of Skia in the context of new devices, form-factors and the industry shift to mobile; with focus set on Linux and Android platforms.

TRANSCRIPT

Page 1: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

A modern 2D graphics library

Introduction to

Eduardo Lima [email protected]

October 14th, 2014

Page 2: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

What is Skia?

Page 3: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

A library for drawing 2D Text, Geometries and Images

What is Skia?

Page 4: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Focus on accurate, high qualityand high performance rendering

What is Skia?

Page 5: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Cross-platform: Linux, Android,ChromeOS, Mac, Windows, ...

What is Skia?

and hardware architectures too:x86, x86_64, ARMv7, AArch64, MIPS, ...

Page 6: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Open source, licensed underthe New BSD free software license

What is Skia?

Page 7: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Figure 1. Skia in the software stack

Skia in a typical software stack

Page 8: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Originally developed by Skia, Inc,acquired by Google in 2005,then released as open source

History

Page 9: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Sponsored and managed by Google ever since

History

Page 10: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Cairo, QPainter (Qt), Direct2D, Cocoa Drawing

Similar projects

Page 11: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Why should I care?Lets hold on this one for a while...

Page 12: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Who uses Skia?

Page 13: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Who uses Skia?

Android Chromium Chrome Firefox Firefox OS

Page 14: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Combined user-base could be above 1.5 billion

Who uses Skia?

Page 15: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

How Skia works?

Page 16: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

(Figure 2. High level architecture)

How Skia works?

Page 17: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

● Raster● OpenGL (ES)● PDF● XPS● Picture

Skia backends

Page 18: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

API overview

Page 19: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

SkCanvas: main drawing API(drawRect, drawText, drawLine, drawPath, etc)

API overview

Page 20: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

SkPaint: encapsulates styling of draw calls (color, path style, blending mode, font, etc)

API overview

Page 21: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

SkDevice: abstracts the backend (SkBitmapDevice, SkGpuDevice, SkPDFDevice, etc)

API overview

Page 22: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

SkPicture, SkPicturePlayback: records and replay draw operations

API overview

Page 23: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Main features

Page 24: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Linear transforms and perspective(3x3 matrices)

Main features

Page 25: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Shaders, xfermodes, mask filters, path effects

Main features

Page 26: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Antialiasing, transparency, filters

Main features

Page 27: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Deferred drawing (SkDeferredCanvas, SkPicture)

Main features

Page 28: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Subpixel text rendering

Main features

Page 29: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Ganesh: the OpenGL(ES) backend

Page 30: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Backend where most of the work is currently focused

Ganesh: the OpenGL(ES) backend

Page 31: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Accelerates 2D Canvas in Chromium/Chrome and Firefox

Ganesh: the OpenGL(ES) backend

Page 32: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Expected to accelerate full web content rendering in the future

Ganesh: the OpenGL(ES) backend

Page 33: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Some features:

Ganesh: the OpenGL(ES) backend

● Accelerate and combine effects with on-demand shaders

● Batching and merging of draw operations● Geometry shaders● Accelerated path rendering if available

(NV_path_rendering)

Page 34: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Performance

Page 35: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Performance

Great tools available:● Benchmarks in Skia repository under /bench● Skia-telemetry● skiaperf.com

● Chromium/Chrome’s about:tracing can also help

Page 36: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Performance

Lack of public benchmarks against similar libraries

Page 37: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

The future of Skia

Page 38: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Roadmap

Backend work:● Enhance PDF for Android and Chrome● Many GPU backend changes

Page 39: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Roadmap

Platform support:● C++11 enablement● GLSL ES 3.0

Page 40: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Roadmap

APIs and New Features:● Shareable pictures across process boundaries● sRGB support, in partnership with Chrome

Page 41: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Roadmap

Dev and Test Infrastructure:● New correctness testing framework● More frequent recapturing of web archives for

buildbot and cluster telemetry testing

Page 42: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Contributing to Skia

Page 43: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Three well defined roles:developer, contributor, committer

Contributing to Skia

Page 44: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Report bugs to the issue tracker

Contributing to Skia

Page 45: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Test: try Skia in your platform/hardware. Feed back!

Contributing to Skia

Page 46: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Contribute code: fix bugs, implement features in the roadmap

Contributing to Skia

beginners, look for issues tagged GoodFirstBug

Page 47: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Benchmark: compare Skia perf against other libraries in your platform/hardware; publish results!

Contributing to Skia

Page 48: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

https://sites.google.com/site/skiadocs/

For references and more info:

Page 49: Introduction to Skia. A Modern 2D Graphics Library (ELCE 2014)

Q & A

Thank you!