1 /*
2 * Copyright (C) 2020 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
17 #pragma once
18
19 #include <inttypes.h>
20
21 namespace android::uirenderer {
22
23 enum class CanvasOpType : int8_t {
24 // State ops
25 // TODO: Eliminate the end ops by having the start include the end-at position
26 Save,
27 SaveLayer,
28 SaveBehind,
29 Restore,
30 BeginZ,
31 EndZ,
32
33 // Clip ops
34 ClipRect,
35 ClipPath,
36
37 // Drawing ops
38 DRAW_OP_BEGIN,
39 DrawColor = DRAW_OP_BEGIN,
40 DrawRect,
41 DrawRegion,
42 DrawRoundRect,
43 DrawRoundRectProperty,
44 DrawDoubleRoundRect,
45 DrawCircleProperty,
46 DrawRippleDrawable,
47 DrawCircle,
48 DrawOval,
49 DrawArc,
50 DrawPaint,
51 DrawPoint,
52 DrawPoints,
53 DrawPath,
54 DrawLine,
55 DrawLines,
56 DrawVertices,
57 DrawImage,
58 DrawImageRect,
59 // DrawImageLattice also used to draw 9 patches
60 DrawImageLattice,
61 DrawPicture,
62 DrawLayer,
63 DrawRenderNode,
64 DRAW_OP_END = DrawRenderNode,
65
66 // TODO: Rest
67
68 COUNT // must be last
69 };
70
IsDrawOp(CanvasOpType t)71 static constexpr bool IsDrawOp(CanvasOpType t) {
72 return CanvasOpType::DRAW_OP_BEGIN <= t && t <= CanvasOpType::DRAW_OP_END;
73 }
74
75 } // namespace android::uirenderer