blob: fbdf3139dabd13fd9619f2fe00fd37badf0304ea [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 {
Stan Iliev7bc3bc62017-05-24 13:28:36 -040022
23class Bitmap;
24
Stan Iliev500a0c32016-10-26 10:30:09 -040025namespace uirenderer {
26namespace skiapipeline {
27
28class SkiaOpenGLPipeline : public SkiaPipeline {
29public:
30 SkiaOpenGLPipeline(renderthread::RenderThread& thread);
31 virtual ~SkiaOpenGLPipeline() {}
32
33 renderthread::MakeCurrentResult makeCurrent() override;
34 renderthread::Frame getFrame() override;
35 bool draw(const renderthread::Frame& frame, const SkRect& screenDirty, const SkRect& dirty,
John Reckd9d7f122018-05-03 14:40:56 -070036 const LightGeometry& lightGeometry, LayerUpdateQueue* layerUpdateQueue,
Peiyong Lin1f6aa122018-09-10 16:28:08 -070037 const Rect& contentDrawBounds, bool opaque, const LightInfo& lightInfo,
John Reck1bcacfd2017-11-03 10:12:19 -070038 const std::vector<sp<RenderNode> >& renderNodes,
39 FrameInfoVisualizer* profiler) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040040 bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty,
John Reck1bcacfd2017-11-03 10:12:19 -070041 FrameInfo* currentFrameInfo, bool* requireSwap) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040042 DeferredLayerUpdater* createTextureLayer() override;
Romain Guy26a2b972017-04-17 09:39:51 -070043 bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior,
John Reck1bcacfd2017-11-03 10:12:19 -070044 renderthread::ColorMode colorMode) override;
Stan Iliev500a0c32016-10-26 10:30:09 -040045 void onStop() override;
46 bool isSurfaceReady() override;
47 bool isContextReady() override;
Peiyong Lin1f6aa122018-09-10 16:28:08 -070048 SkColorType getSurfaceColorType() const override;
49 sk_sp<SkColorSpace> getSurfaceColorSpace() override;
Stan Iliev500a0c32016-10-26 10:30:09 -040050
51 static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor);
John Reckb90d4cb2018-04-19 17:05:35 -070052
Stan Iliev500a0c32016-10-26 10:30:09 -040053private:
54 renderthread::EglManager& mEglManager;
55 EGLSurface mEglSurface = EGL_NO_SURFACE;
56 bool mBufferPreserved = false;
57};
58
59} /* namespace skiapipeline */
60} /* namespace uirenderer */
61} /* namespace android */