SkiaVulkanPipeline.h revision 500a0c30d4dcd012218c3e44a62926a1c34a259f
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 "SkiaPipeline.h" 20#include <SkSurface.h> 21 22namespace sk_app { 23class WindowContext; 24} 25 26namespace android { 27namespace uirenderer { 28namespace skiapipeline { 29 30class SkiaVulkanPipeline : public SkiaPipeline { 31public: 32 SkiaVulkanPipeline(renderthread::RenderThread& thread) : SkiaPipeline(thread) {} 33 virtual ~SkiaVulkanPipeline() {} 34 35 renderthread::MakeCurrentResult makeCurrent() override; 36 renderthread::Frame getFrame() override; 37 bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty, 38 const FrameBuilder::LightGeometry& lightGeometry, 39 LayerUpdateQueue* layerUpdateQueue, 40 const Rect& contentDrawBounds, bool opaque, 41 const BakedOpRenderer::LightInfo& lightInfo, 42 const std::vector< sp<RenderNode> >& renderNodes, 43 FrameInfoVisualizer* profiler) override; 44 bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, 45 FrameInfo* currentFrameInfo, bool* requireSwap) override; 46 bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override; 47 DeferredLayerUpdater* createTextureLayer() override; 48 bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior) override; 49 void onStop() override; 50 bool isSurfaceReady() override; 51 bool isContextReady() override; 52 53 static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor); 54 55private: 56 sk_app::WindowContext* mWindowContext = nullptr; 57 sk_sp<SkSurface> mBackbuffer; 58}; 59 60} /* namespace skiapipeline */ 61} /* namespace uirenderer */ 62} /* namespace android */ 63