Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: site/user/tips.md

Issue 1443653002: Documentation: Further cleanup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-11-16 (Monday) 10:36:02 EST Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « site/user/quick/desktop.md ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 Tips & FAQ 1 Tips & FAQ
2 ========== 2 ==========
3 3
4 Tips and Tricks 4 <span id="gypdefines"></span>
5 --------------- 5
6 Gyp Options
7 -----------
8
9 When running `sync-and-gyp`, the `GYP_DEFINES` environment variable can
10 be used to change Skia’s compile-time settings, using a
11 space-separated list of key=value pairs. For example, to disable both
12 the Skia GPU backend and PDF backends, run it as follows:
13
14 <!--?prettify lang=sh?-->
15
16 GYP_DEFINES='skia_gpu=0 skia_pdf=0' python bin/sync-and-gyp
17 ninja -C out/Debug
18
19 Note: Setting enviroment variables in the Windows CMD.EXE shell [uses a
20 different syntax](/user/quick/windows#env).
21
22 You can also set environment variables such as `CC`, `CXX`,
23 `CFLAGS`, or `CPPFLAGS` to control how Skia is compiled. For
24 example:
25
26 <!--?prettify lang=sh?-->
27
28 CC='clang' CXX='clang++' python bin/sync-and-gyp
29 ninja -C out/Debug
30
31 The `GYP_GENERATORS` environment variable can be used to set the
32 build systems that you want to use (as a comma-separated list).
33 The default is `'ninja,msvs-ninja'` on Windows, `'ninja,xcode'` on
34 Mac OS X, and just `'ninja'` on Linux. For example, to generate
35 only Ninja files on Mac:
36
37 <!--?prettify lang=sh?-->
38
39 GYP_GENERATORS='ninja' python bin/sync-and-gyp
40 ninja -C out/Debug
41
42 Finally, the `SKIA_OUT` environment variable can be used to set
43 the path for the build directory. The default is `out` inside the
44 top-level Skia source directory. For example to test Skia with
45 two different compilers:
46
47 <!--?prettify lang=sh?-->
48
49 CC='clang' CXX='clang++' SKIA_OUT=~/build/skia_clang python bin/sync-and-gyp
50 CC='gcc' CXX='g++' SKIA_OUT=~/build/skia_gcc python bin/sync-and-gyp
51 ninja -C ~/build/skia_clang/Debug
52 ninja -C ~/build/skia_gcc/Debug
53
54 * * *
6 55
7 <span id="bitmap-subsetting"></span> 56 <span id="bitmap-subsetting"></span>
8 57
9 ### Bitmap Subsetting 58 Bitmap Subsetting
59 -----------------
10 60
11 Taking a subset of a bitmap is effectively free - no pixels are copied or 61 Taking a subset of a bitmap is effectively free - no pixels are copied or
12 memory is allocated. This allows Skia to offer an API that typically operates 62 memory is allocated. This allows Skia to offer an API that typically operates
13 on entire bitmaps; clients who want to operate on a subset of a bitmap can use 63 on entire bitmaps; clients who want to operate on a subset of a bitmap can use
14 the following pattern, here being used to magnify a portion of an image with 64 the following pattern, here being used to magnify a portion of an image with
15 drawBitmapNine(): 65 drawBitmapNine():
16 66
17 SkBitmap subset; 67 SkBitmap subset;
18 bitmap.extractSubset(&subset, rect); 68 bitmap.extractSubset(&subset, rect);
19 canvas->drawBitmapNine(subset, ...); 69 canvas->drawBitmapNine(subset, ...);
20 70
21 * * * 71 * * *
22 72
23 <span id="skp-capture"></span> 73 <span id="skp-capture"></span>
24 74
25 ### Capturing a `.skp` file on a web page in Chromium. 75 Capture a `.skp` file on a web page in Chromium
26 76 -----------------------------------------------
27 77
28 1. Launch Chrome or Chromium with `--no-sandbox --enable-gpu-benchmarking` 78 1. Launch Chrome or Chromium with `--no-sandbox --enable-gpu-benchmarking`
29 2. Open the JS console (ctrl-shift-J) 79 2. Open the JS console (ctrl-shift-J)
30 3. Execute: `chrome.gpuBenchmarking.printToSkPicture('/tmp')` 80 3. Execute: `chrome.gpuBenchmarking.printToSkPicture('/tmp')`
31 This returns "undefined" on success. 81 This returns "undefined" on success.
32 82
33 Open the resulting file in the Skia Debugger, rasterize it with `dm`, 83 Open the resulting file in the Skia Debugger, rasterize it with `dm`,
34 or use Skia's `SampleApp` to view it: 84 or use Skia's `SampleApp` to view it:
35 85
36 <!--?prettify lang=sh?--> 86 <!--?prettify lang=sh?-->
37 87
38 bin/sync-and-gyp 88 bin/sync-and-gyp
39 ninja -C out/Release debugger dm SampleApp 89 ninja -C out/Release debugger dm SampleApp
40 out/Release/debugger /tmp/layer_0.skp & 90 out/Release/debugger /tmp/layer_0.skp &
41 91
42 out/Release/dm --src skp --skps /tmp/layer_0.skp -w /tmp \ 92 out/Release/dm --src skp --skps /tmp/layer_0.skp -w /tmp \
43 --config 8888 gpu pdf --verbose 93 --config 8888 gpu pdf --verbose
44 ls -l /tmp/*/skp/layer_0.skp.* 94 ls -l /tmp/*/skp/layer_0.skp.*
45 95
46 out/Release/SampleApp --picture /tmp/layer_0.skp 96 out/Release/SampleApp --picture /tmp/layer_0.skp
47 97
48 * * * 98 * * *
49 99
50 FAQ
51 ---
52
53 <span id="hw-acceleration"></span> 100 <span id="hw-acceleration"></span>
54 101
55 ### Does Skia support HW acceleration? 102 How to add hardware acceleration in Skia
103 ----------------------------------------
56 104
57 There are two ways Skia can take advantage of HW. 105 There are two ways Skia takes advantage of specific hardware.
58 106
59 1. Subclass SkCanvas 107 1. Subclass SkCanvas
60 108
61 Since all drawing calls go through SkCanvas, those calls can be redirected to 109 Since all drawing calls go through SkCanvas, those calls can be
62 a different graphics API. SkGLCanvas has been written to direct its drawing 110 redirected to a different graphics API. SkGLCanvas has been
63 calls to OpenGL. See src/gl/ 111 written to direct its drawing calls to OpenGL. See src/gl/
64 112
65 2. Custom bottleneck routines 113 2. Custom bottleneck routines
66 114
67 There are sets of bottleneck routines inside the blits of Skia that can be 115 There are sets of bottleneck routines inside the blits of Skia
68 replace on a platform in order to take advantage of specific CPU features. One 116 that can be replace on a platform in order to take advantage of
69 such example is the NEON SIMD instructions on ARM v7 devices. See src/opts/ 117 specific CPU features. One such example is the NEON SIMD
118 instructions on ARM v7 devices. See src/opts/
70 119
71 * * * 120 * * *
72 121
73 <span id="font-hinting"></span> 122 <span id="font-hinting"></span>
74 123
75 ### Does Skia support Font hinting? 124 Does Skia support Font hinting?
125 -------------------------------
76 126
77 Skia has a built-in font cache, but it does not know how to actual render font 127 Skia has a built-in font cache, but it does not know how to actual render font
78 files like TrueType? into its cache. For that it relies on the platform to 128 files like TrueType? into its cache. For that it relies on the platform to
79 supply an instance of SkScalerContext?. This is Skia's abstract interface for 129 supply an instance of SkScalerContext?. This is Skia's abstract interface for
80 communicating with a font scaler engine. In src/ports you can see support 130 communicating with a font scaler engine. In src/ports you can see support
81 files for FreeType?, Mac OS X, and Windows GDI font engines. Other font 131 files for FreeType?, Mac OS X, and Windows GDI font engines. Other font
82 engines can easily be supported in a like manner. 132 engines can easily be supported in a like manner.
83 133
84 134
OLDNEW
« no previous file with comments | « site/user/quick/desktop.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698