1# CanvasKit Changelog 2All notable changes to this project will be documented in this file. 3 4The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 5and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). 6 7## [Unreleased] 8 9### Changed 10 - `MakeSkVertices` uses a builder to save a copy. 11 12## [0.6.0] - 2019-05-06 13 14### Added 15 - `SkSurface.grContext` now exposed. `GrContext` has new methods for monitoring/setting 16 the cache limits; tweaking these may lead to better performance in some cases. 17 `getResourceCacheLimitBytes`, `setResourceCacheLimitBytes`, `getResourceCacheUsageBytes` 18 - `SkCanvas.drawAtlas` for efficiently drawing multiple sprites from a sprite sheet with 19 a set of transforms, color blends, etc. 20 - `SkColorBuilder`, `RSXFormBuilder`, `SkRectBuilder` which increase performance by 21 reducing the amount of malloc/free calls per frame, given that the array size is fixed. 22 - Basic `SkPicture` support. `SkSurface.captureFrameAsSkPicture` is a helper function to 23 capture an `SkPicture`, which can be dumped to disk (for debugging) with 24 `SkPicture.DEBUGONLY_saveAsFile`. 25 - `SkImage.readPixels`, which returns a TypedArray of pixel values (safe to use 26 anywhere, doesn't need a delete()). 27 28### Changed 29 - Better `GrGLCaps` support for WebGL - this shouldn't have any impacts on APIs or 30 correctness, except by perhaps fixing a few bugs in various surface types. 31 - Use unsigned ints for SkColor on the JS side - this shouldn't have any impacts 32 unless clients have pre-computed colors, in which case, they will need to re-compute them. 33 - [breaking] Moved `CanvasKit.MakeImageShader` to `SkImage.makeShader` - removed clampUnpremul 34 as argument. 35 36## [0.5.1] - 2019-03-21 37 38### Added 39 - `SkPathMeasure`, `RSXFormBuilder`, `SkFont.getWidths`, `SkTextBlob.MakeFromRSXform` 40 which were needed to add the helper function `SkTextBlob.MakeOnPath`. 41 - `SkSurface.requestAnimationFrame` - wrapper around window.requestAnimationFrame that 42 takes care of the setup/tear down required to use CanvasKit optimally. The callback 43 has an `SkCanvas` as the first parameter - callers should draw on that. 44 45### Changed 46 - Location in Skia Git repo now `modules/canvaskit` (was `experimental/canvaskit`) 47 48### Fixed 49 - Extern bug in `CanvasKit.SkMatrix.invert` 50 - Fallback to CPU now properly refreshes the canvas to get access to the 51 CanvasRenderingContext2D. 52 - Compile flags for better WebGL1 support for some graphics cards. 53 - Antialias bug on large oval paths <https://crbug.com/skia/8873> 54 55### Deprecated 56 - `SkCanvas.flush` will be removed soon - client should only call `SkSurface.flush` 57 58 59## [0.5.0] - 2019-03-08 60 61### Added 62 - isVolitile option to `CanvasKit.MakeSkVertices`. The previous (and current default) behavior 63 was for this to be true; some applications may go faster if set to false. 64 - `SkCanvas.saveLayer(rect, paint)` 65 - `SkCanvas.restoreToCount(int)` which can be used with the output of .save() and .saveLayer(). 66 - Optional particles library from modules/particles. `See CanvasKit.MakeParticles(json)`; 67 - More public APIs for working with Surfaces/Contexts `GetWebGLContext`, 68 `MakeGrContext`, `MakeOnScreenGLSurface`, `MakeRenderTarget`. 69 - `SkSurface.getSurface()` and `SkCanvas.getSurface()` for making compatible surfaces (typically 70 used as a workspace and then "saved" with `surface.makeImageSnapshot()`) 71 72### Breaking 73 - `CanvasKit.MakeWebGLCanvasSurface` no longer takes a webgl context as a first arg, only a 74 canvas or an id of a canvas. If users want to manage their own GL contexts, they should build 75 the `SkSurface` themselves with `GetWebGLContext` -> `MakeGrContext` -> 76 `MakeOnScreenGLSurface`. 77 78## [0.4.1] - 2019-03-01 79 80### Added 81 - Optional arguments to `MakeManagedAnimation` for supplying external assets (like images, fonts). 82 83## [0.4.0] - 2019-02-25 84 85### Added 86 - `SkPath.addRoundRect`, `SkPath.reset`, `SkPath.rewind` exposed. 87 - `SkCanvas.drawArc`, `SkCanvas.drawLine`, `SkCanvas.drawOval`, `SkCanvas.drawRoundRect` exposed. 88 - Can import/export a SkPath to an array of commands. See `CanvasKit.MakePathFromCmds` and 89 `SkPath.toCmds`. 90 - `SkCanvas.drawTextBlob()` and `SkCanvas.SkTextBlob.MakeFromText()` to draw text to a canvas. 91 - `CanvasKit.TextEncoding` enum. For use with `SkTextBlob`. 92 - Text shaping with `ShapedText` object and `SkCanvas.drawText`. At compile time, one can choose 93 between using Harfbuzz/ICU (default) or a primitive one ("primitive_shaper") which just does 94 line breaking. Using Harfbuzz/ICU substantially increases code size (4.3 MB to 6.4 MB). 95 96### Changed 97 - `SkCanvas.drawText()` now requires an `SkFont` object for raw strings. 98 99 100### Removed 101 - `SkPaint.setTextSize()`, `SkPaint.getTextSize()`, `SkPaint.setTypeface()` 102 which should be replaced by using `SkFont`. 103 - Deprecated `CanvasKitInit().then()` interface (see 0.3.1 notes) 104 105 106### Fixed 107 - Potential bug in `ready()` if already loaded. 108 109## [0.3.1] - 2019-01-04 110### Added 111 - `SkFont` now exposed. 112 - `MakeCanvasSurface` can now take a canvas element directly. 113 - `MakeWebGLCanvasSurface` can now take a WebGL context as an integer and use it directly. 114 115### Changed 116 - `CanvasKitInit(...).then()` is no longer the recommended way to initialize things. 117It will be removed in 0.4.0. Use `CanvasKitInit(...).ready()`, which returns a real Promise. 118 119### Removed 120- `SkPaint.measureText` - use `SkFont.measureText` instead. 121 122## [0.3.0] - 2018-12-18 123 124### Added 125- Add Canvas2D JS layer. This mirrors the HTML Canvas API. This may be omitted at compile time 126 it by adding `no_canvas` to the `compile.sh` invocation. 127- `CanvasKit.FontMgr.DefaultRef()` and `fontmgr.MakeTypefaceFromData` to load fonts. 128- Exposed `SkPath.setVolatile`. Some animations see performance improvements by setting 129their paths' volatility to true. 130 131### Fixed 132- `SkPath.addRect` now correctly draws counter-clockwise vs clockwise. 133 134### Changed 135- `CanvasKit.MakeImageShader` no longer takes encoded bytes, but an `SkImage`, created from 136 `CanvasKit.MakeImageFromEncoded`. Additionally, the optional parameters `clampIfUnpremul` 137 and `localMatrix` have been exposed. 138- `SkPath.arcTo` now takes `startAngle`, `sweepAngle`, `forceMoveTo` as additional parameters. 139- `SkPath.stroke` has a new option `precision` It defaults to 1.0. 140- CanvasKit comes with one font (NotoMono) instead of the Skia TestTypeface. Clients are encouraged 141 to use the new `fontmgr.MakeTypefaceFromData` for more font variety. 142 143### Removed 144- `CanvasKit.initFonts()` - no longer needed. 145 146 147## [0.2.1] - 2018-11-20 148Beginning of Changelog history 149