Stan Iliev | 500a0c3 | 2016-10-26 10:30:09 -0400 | [diff] [blame] | 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 | |
| 21 | namespace android { |
Stan Iliev | 7bc3bc6 | 2017-05-24 13:28:36 -0400 | [diff] [blame] | 22 | |
| 23 | class Bitmap; |
| 24 | |
Stan Iliev | 500a0c3 | 2016-10-26 10:30:09 -0400 | [diff] [blame] | 25 | namespace uirenderer { |
| 26 | namespace skiapipeline { |
| 27 | |
| 28 | class SkiaOpenGLPipeline : public SkiaPipeline { |
| 29 | public: |
| 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, |
| 36 | const FrameBuilder::LightGeometry& lightGeometry, |
| 37 | LayerUpdateQueue* layerUpdateQueue, |
Romain Guy | 07ae505 | 2017-06-13 18:25:32 -0700 | [diff] [blame] | 38 | const Rect& contentDrawBounds, bool opaque, bool wideColorGamut, |
Stan Iliev | 500a0c3 | 2016-10-26 10:30:09 -0400 | [diff] [blame] | 39 | const BakedOpRenderer::LightInfo& lightInfo, |
| 40 | const std::vector< sp<RenderNode> >& renderNodes, |
| 41 | FrameInfoVisualizer* profiler) override; |
| 42 | bool swapBuffers(const renderthread::Frame& frame, bool drew, const SkRect& screenDirty, |
| 43 | FrameInfo* currentFrameInfo, bool* requireSwap) override; |
| 44 | bool copyLayerInto(DeferredLayerUpdater* layer, SkBitmap* bitmap) override; |
| 45 | DeferredLayerUpdater* createTextureLayer() override; |
Romain Guy | 26a2b97 | 2017-04-17 09:39:51 -0700 | [diff] [blame] | 46 | bool setSurface(Surface* window, renderthread::SwapBehavior swapBehavior, |
| 47 | renderthread::ColorMode colorMode) override; |
Stan Iliev | 500a0c3 | 2016-10-26 10:30:09 -0400 | [diff] [blame] | 48 | void onStop() override; |
| 49 | bool isSurfaceReady() override; |
| 50 | bool isContextReady() override; |
| 51 | |
| 52 | static void invokeFunctor(const renderthread::RenderThread& thread, Functor* functor); |
Stan Iliev | 7bc3bc6 | 2017-05-24 13:28:36 -0400 | [diff] [blame] | 53 | static sk_sp<Bitmap> allocateHardwareBitmap(renderthread::RenderThread& thread, |
| 54 | SkBitmap& skBitmap); |
Stan Iliev | 500a0c3 | 2016-10-26 10:30:09 -0400 | [diff] [blame] | 55 | |
| 56 | private: |
| 57 | renderthread::EglManager& mEglManager; |
| 58 | EGLSurface mEglSurface = EGL_NO_SURFACE; |
| 59 | bool mBufferPreserved = false; |
| 60 | }; |
| 61 | |
| 62 | } /* namespace skiapipeline */ |
| 63 | } /* namespace uirenderer */ |
| 64 | } /* namespace android */ |