• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17import {
18  ActiveBuffer,
19  EMPTY_COLOR,
20  EMPTY_RECT,
21  EMPTY_RECTF,
22  EMPTY_TRANSFORM,
23  Layer,
24  LayerProperties,
25} from 'trace/flickerlib/common';
26
27class LayerBuilder {
28  setFlags(value: number): LayerBuilder {
29    this.flags = value;
30    return this;
31  }
32
33  build(): Layer {
34    const properties = new LayerProperties(
35      null /* visibleRegion */,
36      new ActiveBuffer(0, 0, 0, 0),
37      this.flags,
38      EMPTY_RECTF /* bounds */,
39      EMPTY_COLOR,
40      false /* isOpaque */,
41      0 /* shadowRadius */,
42      0 /* cornerRadius */,
43      'type' /* type */,
44      EMPTY_RECTF /* screenBounds */,
45      EMPTY_TRANSFORM /* transform */,
46      EMPTY_RECTF /* sourceBounds */,
47      0 /* effectiveScalingMode */,
48      EMPTY_TRANSFORM /* bufferTransform */,
49      0 /* hwcCompositionType */,
50      EMPTY_RECTF /* hwcCrop */,
51      EMPTY_RECT /* hwcFrame */,
52      0 /* backgroundBlurRadius */,
53      EMPTY_RECT /* crop */,
54      false /* isRelativeOf */,
55      -1 /* zOrderRelativeOfId */,
56      0 /* stackId */,
57      EMPTY_TRANSFORM /* requestedTransform */,
58      EMPTY_COLOR /* requestedColor */,
59      EMPTY_RECTF /* cornerRadiusCrop */,
60      EMPTY_TRANSFORM /* inputTransform */,
61      null /* inputRegion */
62    );
63
64    return new Layer(
65      'name' /* name */,
66      0 /* id */,
67      -1 /*parentId */,
68      0 /* z */,
69      0 /* currFrame */,
70      properties
71    );
72  }
73
74  private flags = 0;
75}
76
77export {LayerBuilder};
78