Debian Codegraph @

libs/hwui/pipeline/skia/VkFunctorDrawable.h

raw symbols SCIP
1 /*
2 * Copyright (C) 2018 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 "FunctorDrawable.h"
20
21 #include <SkImageInfo.h>
22 #include <utils/RefBase.h>
23
24 namespace android {
25 namespace uirenderer {
26 namespace skiapipeline {
27
28 /**
29 * This draw handler will be returned by VkFunctorDrawable's onSnapGpuDrawHandler. It allows us to
30 * issue Vulkan commands while the command buffer is being flushed.
31 */
32 class VkFunctorDrawHandler : public FunctorDrawable::GpuDrawHandler {
33 public:
34 VkFunctorDrawHandler(sp<WebViewFunctor::Handle> functor_handle, const SkMatrix& matrix,
35 const SkIRect& clip, const SkImageInfo& image_info);
36 ~VkFunctorDrawHandler() override;
37
38 void draw(const GrBackendDrawableInfo& info) override;
39
40 private:
41 typedef GpuDrawHandler INHERITED;
42 sp<WebViewFunctor::Handle> mFunctorHandle;
43 const SkMatrix mMatrix;
44 const SkIRect mClip;
45 const SkImageInfo mImageInfo;
46
47 bool mDrawn = false;
48 };
49
50 /**
51 * This drawable wraps a Vulkan functor enabling it to be recorded into a list of Skia drawing
52 * commands.
53 */
54 class VkFunctorDrawable : public FunctorDrawable {
55 public:
56 using FunctorDrawable::FunctorDrawable;
57
58 ~VkFunctorDrawable() override;
59
60 protected:
61 // SkDrawable functions:
62 void onDraw(SkCanvas* canvas) override;
63 std::unique_ptr<FunctorDrawable::GpuDrawHandler> onSnapGpuDrawHandler(
64 GrBackendApi backendApi, const SkMatrix& matrix, const SkIRect& clip,
65 const SkImageInfo& image_info) override;
66 };
67
68 } // namespace skiapipeline
69 } // namespace uirenderer
70 } // namespace android