OLD | NEW |
1 Tips & FAQ | 1 Tips & FAQ |
2 ========== | 2 ========== |
3 | 3 |
| 4 + [Gyp Options](#gypdefines) |
| 5 + [Bitmap Subsetting](#bitmap-subsetting) |
| 6 + [Capture a `.skp` file on a web page in Chromium](#skp-capture) |
| 7 + [How to add hardware acceleration in Skia](#hw-acceleration) |
| 8 + [Does Skia support Font hinting?](#font-hinting) |
| 9 + [Does Skia shape text (kerning)?](#kerning) |
| 10 |
| 11 * * * |
| 12 |
4 <span id="gypdefines"></span> | 13 <span id="gypdefines"></span> |
5 | 14 |
6 Gyp Options | 15 Gyp Options |
7 ----------- | 16 ----------- |
8 | 17 |
9 When running `sync-and-gyp`, the `GYP_DEFINES` environment variable can | 18 When running `sync-and-gyp`, the `GYP_DEFINES` environment variable can |
10 be used to change Skia’s compile-time settings, using a | 19 be used to change Skia’s compile-time settings, using a |
11 space-separated list of key=value pairs. For example, to disable both | 20 space-separated list of key=value pairs. For example, to disable both |
12 the Skia GPU backend and PDF backends, run it as follows: | 21 the Skia GPU backend and PDF backends, run it as follows: |
13 | 22 |
(...skipping 12 matching lines...) Expand all Loading... |
26 <!--?prettify lang=sh?--> | 35 <!--?prettify lang=sh?--> |
27 | 36 |
28 CC='clang' CXX='clang++' python bin/sync-and-gyp | 37 CC='clang' CXX='clang++' python bin/sync-and-gyp |
29 ninja -C out/Debug | 38 ninja -C out/Debug |
30 | 39 |
31 To build with clang and enable a compiler warning for unused parameters in C++ | 40 To build with clang and enable a compiler warning for unused parameters in C++ |
32 (but not C or assembly) code: | 41 (but not C or assembly) code: |
33 | 42 |
34 <!--?prettify lang=sh?--> | 43 <!--?prettify lang=sh?--> |
35 | 44 |
36 CXXFLAGS='-Wunused-parameter' | 45 CXXFLAGS='-Wunused-parameter' \ |
37 CC='clang' CXX='clang++' python bin/sync-and-gyp | 46 CC='clang' CXX='clang++' python bin/sync-and-gyp |
38 ninja -C out/Debug | 47 ninja -C out/Debug |
39 | 48 |
40 | 49 |
41 The `GYP_GENERATORS` environment variable can be used to set the | 50 The `GYP_GENERATORS` environment variable can be used to set the |
42 build systems that you want to use (as a comma-separated list). | 51 build systems that you want to use (as a comma-separated list). |
43 The default is `'ninja,msvs-ninja'` on Windows, `'ninja,xcode'` on | 52 The default is `'ninja,msvs-ninja'` on Windows, `'ninja,xcode'` on |
44 Mac OS X, and just `'ninja'` on Linux. For example, to generate | 53 Mac OS X, and just `'ninja'` on Linux. For example, to generate |
45 only Ninja files on Mac: | 54 only Ninja files on Mac: |
46 | 55 |
47 <!--?prettify lang=sh?--> | 56 <!--?prettify lang=sh?--> |
(...skipping 23 matching lines...) Expand all Loading... |
71 Taking a subset of a bitmap is effectively free - no pixels are copied or | 80 Taking a subset of a bitmap is effectively free - no pixels are copied or |
72 memory is allocated. This allows Skia to offer an API that typically operates | 81 memory is allocated. This allows Skia to offer an API that typically operates |
73 on entire bitmaps; clients who want to operate on a subset of a bitmap can use | 82 on entire bitmaps; clients who want to operate on a subset of a bitmap can use |
74 the following pattern, here being used to magnify a portion of an image with | 83 the following pattern, here being used to magnify a portion of an image with |
75 drawBitmapNine(): | 84 drawBitmapNine(): |
76 | 85 |
77 SkBitmap subset; | 86 SkBitmap subset; |
78 bitmap.extractSubset(&subset, rect); | 87 bitmap.extractSubset(&subset, rect); |
79 canvas->drawBitmapNine(subset, ...); | 88 canvas->drawBitmapNine(subset, ...); |
80 | 89 |
| 90 [An example](https://fiddle.skia.org/c/c91694020f0810994917b56c323e4559) |
| 91 |
81 * * * | 92 * * * |
82 | 93 |
83 <span id="skp-capture"></span> | 94 <span id="skp-capture"></span> |
84 | 95 |
85 Capture a `.skp` file on a web page in Chromium | 96 Capture a `.skp` file on a web page in Chromium |
86 ----------------------------------------------- | 97 ----------------------------------------------- |
87 | 98 |
88 1. Launch Chrome or Chromium with `--no-sandbox --enable-gpu-benchmarking` | 99 1. Launch Chrome or Chromium with `--no-sandbox --enable-gpu-benchmarking` |
89 2. Open the JS console (ctrl-shift-J) | 100 2. Open the JS console (ctrl-shift-J) |
90 3. Execute: `chrome.gpuBenchmarking.printToSkPicture('/tmp')` | 101 3. Execute: `chrome.gpuBenchmarking.printToSkPicture('/tmp')` |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 159 |
149 Does Skia shape text (kerning)? | 160 Does Skia shape text (kerning)? |
150 ------------------------------- | 161 ------------------------------- |
151 | 162 |
152 No. Skia provides interfaces to draw glyphs, but does not implement a | 163 No. Skia provides interfaces to draw glyphs, but does not implement a |
153 text shaper. Skia's client's often use | 164 text shaper. Skia's client's often use |
154 [HarfBuzz](http://www.freedesktop.org/wiki/Software/HarfBuzz/) to | 165 [HarfBuzz](http://www.freedesktop.org/wiki/Software/HarfBuzz/) to |
155 generate the glyphs and their positions, including kerning. | 166 generate the glyphs and their positions, including kerning. |
156 | 167 |
157 <div style="margin-bottom:99%"></div> | 168 <div style="margin-bottom:99%"></div> |
OLD | NEW |