SkiaOpenGLPipeline.h revision 500a0c30d4dcd012218c3e44a62926a1c34a259f
1500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev/*
2500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Copyright (C) 2016 The Android Open Source Project
3500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *
4500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Licensed under the Apache License, Version 2.0 (the "License");
5500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * you may not use this file except in compliance with the License.
6500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * You may obtain a copy of the License at
7500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *
8500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *      http://www.apache.org/licenses/LICENSE-2.0
9500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev *
10500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * Unless required by applicable law or agreed to in writing, software
11500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * distributed under the License is distributed on an "AS IS" BASIS,
12500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * See the License for the specific language governing permissions and
14500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev * limitations under the License.
15500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev */
16500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
17500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#pragma once
18500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
19500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev#include "SkiaPipeline.h"
20500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
21500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace android {
22500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace uirenderer {
23500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievnamespace skiapipeline {
24500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
25500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievclass SkiaOpenGLPipeline : public SkiaPipeline {
26500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievpublic:
27500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    SkiaOpenGLPipeline(renderthread::RenderThread& thread);
28500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    virtual ~SkiaOpenGLPipeline() {}
29500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
30500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    renderthread::MakeCurrentResult makeCurrent() override;
31500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    renderthread::Frame getFrame() override;
32500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
33500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const FrameBuilder::LightGeometry& lightGeometry,
34500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            LayerUpdateQueue* layerUpdateQueue,
35500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const Rect& contentDrawBounds, bool opaque,
36500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const BakedOpRenderer::LightInfo& lightInfo,
37500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            const std::vector< sp<RenderNode> >& renderNodes,
38500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            FrameInfoVisualizer* profiler) override;
39500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty,
40500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev            FrameInfo* currentFrameInfo, bool* requireSwap) override;
41500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override;
42500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    DeferredLayerUpdater* createTextureLayer() override;
43500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior) override;
44500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    void onStop() override;
45500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool isSurfaceReady() override;
46500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool isContextReady() override;
47500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
48500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
49500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
50500a0c30d4dcd012218c3e44a62926a1c34a259fStan Ilievprivate:
51500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    renderthread::EglManager& mEglManager;
52500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    EGLSurface mEglSurface = EGL_NO_SURFACE;
53500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev    bool mBufferPreserved = false;
54500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev};
55500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev
56500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace skiapipeline */
57500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace uirenderer */
58500a0c30d4dcd012218c3e44a62926a1c34a259fStan Iliev} /* namespace android */
59