Nicolas Capens | 80d6f17 | 2016-05-13 19:30:12 -0400 | [diff] [blame] | 1 | // 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 Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 15 | #ifndef sw_FrameBufferAndroid_hpp |
| 16 | #define sw_FrameBufferAndroid_hpp |
| 17 | |
| 18 | #include "Main/FrameBuffer.hpp" |
| 19 | #include "Common/Debug.hpp" |
| 20 | |
Nicolas Capens | 9cb01cf | 2017-08-04 09:36:32 -0400 | [diff] [blame] | 21 | struct ANativeWindow; |
| 22 | struct ANativeWindowBuffer; |
Greg Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 23 | |
| 24 | namespace sw |
| 25 | { |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 26 | class FrameBufferAndroid : public FrameBuffer |
| 27 | { |
| 28 | public: |
Nicolas Capens | 241f789 | 2015-12-30 23:40:45 -0500 | [diff] [blame] | 29 | FrameBufferAndroid(ANativeWindow *window, int width, int height); |
Greg Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 30 | |
Nicolas Capens | 6016a14 | 2017-05-29 17:20:36 -0400 | [diff] [blame] | 31 | ~FrameBufferAndroid() override; |
Greg Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 32 | |
Ben Clayton | 414b72d | 2019-08-27 10:53:37 +0100 | [diff] [blame] | 33 | void flip(sw::Surface *source) override {blit(source, nullptr, nullptr);} |
Nicolas Capens | 241f789 | 2015-12-30 23:40:45 -0500 | [diff] [blame] | 34 | void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override; |
Nicolas Capens | e63db96 | 2015-12-11 17:24:40 -0500 | [diff] [blame] | 35 | |
| 36 | void *lock() override; |
Nicolas Capens | 22bc79c | 2015-11-30 13:24:24 -0500 | [diff] [blame] | 37 | void unlock() override; |
Greg Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 38 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 39 | bool setSwapRectangle(int l, int t, int w, int h); |
Greg Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 40 | |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 41 | private: |
Nicolas Capens | 241f789 | 2015-12-30 23:40:45 -0500 | [diff] [blame] | 42 | ANativeWindow *nativeWindow; |
| 43 | ANativeWindowBuffer *buffer; |
Nicolas Capens | 0bac285 | 2016-05-07 06:09:58 -0400 | [diff] [blame] | 44 | }; |
Greg Hartman | 8b5b512 | 2015-03-20 13:05:34 -0700 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | #endif // sw_FrameBufferAndroid |