blob: c47ee114263f0c2f463a598723192e87af048d77 [file] [log] [blame]
Stan Iliev11606ff2018-09-17 14:01:16 -04001/*
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
Stan Iliev11606ff2018-09-17 14:01:16 -040021#include <ui/GraphicBuffer.h>
John Reck283bb462018-12-13 16:40:14 -080022#include <utils/RefBase.h>
Stan Iliev11606ff2018-09-17 14:01:16 -040023
24namespace android {
25namespace uirenderer {
26
27namespace skiapipeline {
28
29/**
30 * This drawable wraps a Vulkan functor enabling it to be recorded into a list
31 * of Skia drawing commands.
32 */
Chris Blume5f1ac2b2018-11-05 16:10:39 -080033class VkInteropFunctorDrawable : public FunctorDrawable {
Stan Iliev11606ff2018-09-17 14:01:16 -040034public:
John Reck283bb462018-12-13 16:40:14 -080035 using FunctorDrawable::FunctorDrawable;
36
Chris Blume5f1ac2b2018-11-05 16:10:39 -080037 virtual ~VkInteropFunctorDrawable();
Stan Iliev11606ff2018-09-17 14:01:16 -040038
Stan Iliev11606ff2018-09-17 14:01:16 -040039 static void vkInvokeFunctor(Functor* functor);
40
John Reck283bb462018-12-13 16:40:14 -080041 void syncFunctor(const WebViewSyncData& data) const override;
42
Stan Iliev11606ff2018-09-17 14:01:16 -040043protected:
44 virtual void onDraw(SkCanvas* canvas) override;
45
46private:
Stan Iliev11606ff2018-09-17 14:01:16 -040047 // Variables below describe/store temporary offscreen buffer used for Vulkan pipeline.
48 sp<GraphicBuffer> mFrameBuffer;
49 SkImageInfo mFBInfo;
50};
51
Chris Blume7b8a8082018-11-30 15:51:58 -080052} // namespace skiapipeline
53} // namespace uirenderer
54} // namespace android