blob: 2e9924c183b271c996303fa40246a4938769fd4c [file] [log] [blame]
Nicolas Capens80d6f172016-05-13 19:30:12 -04001// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
Greg Hartman8b5b5122015-03-20 13:05:34 -070015#ifndef sw_FrameBufferAndroid_hpp
16#define sw_FrameBufferAndroid_hpp
17
18#include "Main/FrameBuffer.hpp"
19#include "Common/Debug.hpp"
20
Nicolas Capens9cb01cf2017-08-04 09:36:32 -040021struct ANativeWindow;
22struct ANativeWindowBuffer;
Greg Hartman8b5b5122015-03-20 13:05:34 -070023
24namespace sw
25{
Nicolas Capens0bac2852016-05-07 06:09:58 -040026 class FrameBufferAndroid : public FrameBuffer
27 {
28 public:
Nicolas Capens241f7892015-12-30 23:40:45 -050029 FrameBufferAndroid(ANativeWindow *window, int width, int height);
Greg Hartman8b5b5122015-03-20 13:05:34 -070030
Nicolas Capens6016a142017-05-29 17:20:36 -040031 ~FrameBufferAndroid() override;
Greg Hartman8b5b5122015-03-20 13:05:34 -070032
Ben Clayton414b72d2019-08-27 10:53:37 +010033 void flip(sw::Surface *source) override {blit(source, nullptr, nullptr);}
Nicolas Capens241f7892015-12-30 23:40:45 -050034 void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
Nicolas Capense63db962015-12-11 17:24:40 -050035
36 void *lock() override;
Nicolas Capens22bc79c2015-11-30 13:24:24 -050037 void unlock() override;
Greg Hartman8b5b5122015-03-20 13:05:34 -070038
Nicolas Capens0bac2852016-05-07 06:09:58 -040039 bool setSwapRectangle(int l, int t, int w, int h);
Greg Hartman8b5b5122015-03-20 13:05:34 -070040
Nicolas Capens0bac2852016-05-07 06:09:58 -040041 private:
Nicolas Capens241f7892015-12-30 23:40:45 -050042 ANativeWindow *nativeWindow;
43 ANativeWindowBuffer *buffer;
Nicolas Capens0bac2852016-05-07 06:09:58 -040044 };
Greg Hartman8b5b5122015-03-20 13:05:34 -070045}
46
47#endif // sw_FrameBufferAndroid