• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5part of engine;
6
7class SkPictureRecorder implements ui.PictureRecorder {
8  @override
9  ui.Rect cullRect;
10
11  js.JsObject _recorder;
12
13  @override
14  RecordingCanvas beginRecording(ui.Rect bounds) {
15    cullRect = bounds;
16    _recorder = js.JsObject(canvasKit['SkPictureRecorder']);
17    final js.JsObject skRect = js.JsObject(canvasKit['LTRBRect'],
18        <double>[bounds.left, bounds.top, bounds.right, bounds.bottom]);
19    final js.JsObject skCanvas =
20        _recorder.callMethod('beginRecording', <js.JsObject>[skRect]);
21    return SkRecordingCanvas(skCanvas);
22  }
23
24  @override
25  ui.Picture endRecording() {
26    js.JsObject skPicture = _recorder.callMethod('finishRecordingAsPicture');
27    _recorder.callMethod('delete');
28    return SkPicture(skPicture, cullRect);
29  }
30
31  @override
32  bool get isRecording => false;
33}
34