• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Tips & FAQ
2==========
3
4Tips and Tricks
5---------------
6
7### Bitmap Subsetting
8
9Taking a subset of a bitmap is effectively free - no pixels are copied or
10memory is allocated. This allows Skia to offer an API that typically operates
11on entire bitmaps; clients who want to operate on a subset of a bitmap can use
12the following pattern, here being used to magnify a portion of an image with
13drawBitmapNine():
14
15    SkBitmap subset;
16    bitmap.extractSubset(&subset, rect);
17    canvas->drawBitmapNine(subset, ...);
18
19FAQ
20---
21
22### Does Skia support HW acceleration?
23
24
25There are two ways Skia can take advantage of HW.
26
271. Subclass SkCanvas
28
29Since all drawing calls go through SkCanvas, those calls can be redirected to
30a different graphics API. SkGLCanvas has been written to direct its drawing
31calls to OpenGL. See src/gl/
32
332. Custom bottleneck routines
34
35There are sets of bottleneck routines inside the blits of Skia that can be
36replace on a platform in order to take advantage of specific CPU features. One
37such example is the NEON SIMD instructions on ARM v7 devices. See src/opts/
38
39### Does Skia support Font hinting?
40
41Skia has a built-in font cache, but it does not know how to actual render font
42files like TrueType? into its cache. For that it relies on the platform to
43supply an instance of SkScalerContext?. This is Skia's abstract interface for
44communicating with a font scaler engine. In src/ports you can see support
45files for FreeType?, Mac OS X, and Windows GDI font engines. Other font
46engines can easily be supported in a like manner.
47
48
49