blob: caf9467598779dc168ba46304af7f8f22fd64e7c [file] [log] [blame]
Stan Iliev500a0c32016-10-26 10:30:09 -04001/*
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
21namespace android {
22namespace uirenderer {
23namespace skiapipeline {
24
25class SkiaOpenGLPipeline : public SkiaPipeline {
26public:
27 SkiaOpenGLPipeline(renderthread::RenderThread& thread);
28 virtual ~SkiaOpenGLPipeline() {}
29
30 renderthread::MakeCurrentResult makeCurrent() override;
31 renderthread::Frame getFrame() override;
32 bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
33 const FrameBuilder::LightGeometry& lightGeometry,
34 LayerUpdateQueue* layerUpdateQueue,
35 const Rect& contentDrawBounds, bool opaque,
36 const BakedOpRenderer::LightInfo& lightInfo,
37 const std::vector< sp<RenderNode> >& renderNodes,
38 FrameInfoVisualizer* profiler) override;
39 bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty,
40 FrameInfo* currentFrameInfo, bool* requireSwap) override;
41 bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override;
42 DeferredLayerUpdater* createTextureLayer() override;
Romain Guy26a2b972017-04-17 09:39:51 -070043 bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior,
44 renderthread::ColorMode colorMode) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040045 void onStop() override;
46 bool isSurfaceReady() override;
47 bool isContextReady() override;
48
49 static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
Stan Iliev500a0c32016-10-26 10:30:09 -040050
51private:
52 renderthread::EglManager& mEglManager;
53 EGLSurface mEglSurface = EGL_NO_SURFACE;
54 bool mBufferPreserved = false;
55};
56
57} /* namespace skiapipeline */
58} /* namespace uirenderer */
59} /* namespace android */