diff options
author | Stan Iliev <stani@google.com> | 2018-09-17 14:01:16 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-09-18 18:01:48 -0400 |
commit | 11606ffa364a5f99b892c550c750e482133a9f45 (patch) | |
tree | f3bce8f291aba7abe69b1e7264ad023a195bf5f1 /libs/hwui/pipeline/skia/FunctorDrawable.h | |
parent | 6c109c76c99a0d8f3437b4530f6e5281bb45f00d (diff) |
Implement WebView support for Vulkan using temporary buffer
Draw WebView in an offscreen GL buffer, then import and draw the
buffer with Vulkan.
Bug: 115610873
Test: Passed WebView CTS tests that are part of UiRendering.
Change-Id: Ida137fe9b8652d2a936ec2798b909be7e77b3462
Diffstat (limited to 'libs/hwui/pipeline/skia/FunctorDrawable.h')
-rw-r--r-- | libs/hwui/pipeline/skia/FunctorDrawable.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/libs/hwui/pipeline/skia/FunctorDrawable.h b/libs/hwui/pipeline/skia/FunctorDrawable.h new file mode 100644 index 000000000000..162d13762e1a --- /dev/null +++ b/libs/hwui/pipeline/skia/FunctorDrawable.h @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "GlFunctorLifecycleListener.h" + +#include <SkCanvas.h> +#include <SkDrawable.h> + +#include <utils/Functor.h> + +namespace android { +namespace uirenderer { + +namespace skiapipeline { + +/** + * This drawable wraps a functor enabling it to be recorded into a list + * of Skia drawing commands. + */ +class FunctorDrawable : public SkDrawable { +public: + FunctorDrawable(Functor* functor, GlFunctorLifecycleListener* listener, SkCanvas* canvas) + : mFunctor(functor), mListener(listener), mBounds(canvas->getLocalClipBounds()) {} + virtual ~FunctorDrawable() {} + + virtual void syncFunctor() const = 0; + +protected: + virtual SkRect onGetBounds() override { return mBounds; } + + Functor* mFunctor; + sp<GlFunctorLifecycleListener> mListener; + const SkRect mBounds; +}; + +}; // namespace skiapipeline +}; // namespace uirenderer +}; // namespace android |