Debian Codegraph @

libs/hwui/pipeline/skia/ReorderBarrierDrawables.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2016 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 "RenderNodeDrawable.h"
20 #include "SkiaUtils.h"
21
22 #include <SkCanvas.h>
23 #include <SkDrawable.h>
24 #include <ui/FatVector.h>
25
26 namespace android {
27 namespace uirenderer {
28 namespace skiapipeline {
29
30 class SkiaDisplayList;
31 class EndReorderBarrierDrawable;
32
33 /**
34 * StartReorderBarrierDrawable and EndReorderBarrierDrawable work together to define
35 * a sub-list in a display list that need to be drawn out-of-order sorted instead by render
36 * node Z index.
37 * StartReorderBarrierDrawable will sort the entire range and it will draw
38 * render nodes in the range with negative Z index.
39 */
40 class StartReorderBarrierDrawable : public SkDrawable {
41 public:
42 explicit StartReorderBarrierDrawable(SkiaDisplayList* data);
43
44 protected:
45 virtual SkRect onGetBounds() override { return SkRectMakeLargest(); }
46 virtual void onDraw(SkCanvas* canvas) override;
47
48 private:
49 int mEndChildIndex;
50 int mBeginChildIndex;
51 FatVector<RenderNodeDrawable*, 16> mChildren;
52 SkiaDisplayList* mDisplayList;
53
54 friend class EndReorderBarrierDrawable;
55 };
56
57 /**
58 * See StartReorderBarrierDrawable.
59 * EndReorderBarrierDrawable relies on StartReorderBarrierDrawable to host and sort the render
60 * nodes by Z index. When EndReorderBarrierDrawable is drawn it will draw all render nodes in the
61 * range with positive Z index. It is also responsible for drawing shadows for the nodes
62 * corresponding to their z-index.
63 */
64 class EndReorderBarrierDrawable : public SkDrawable {
65 public:
66 explicit EndReorderBarrierDrawable(StartReorderBarrierDrawable* startBarrier);
67
68 protected:
69 virtual SkRect onGetBounds() override { return SkRectMakeLargest(); }
70 virtual void onDraw(SkCanvas* canvas) override;
71
72 private:
73 void drawShadow(SkCanvas* canvas, RenderNodeDrawable* caster);
74 StartReorderBarrierDrawable* mStartBarrier;
75 };
76
77 } // namespace skiapipeline
78 } // namespace uirenderer
79 } // namespace android