| Greg Daniel | cd55852 | 2016-11-17 13:31:40 -0500 | [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 <stdint.h> | 
|  | 20 |  | 
|  | 21 | struct SkRect; | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 22 | typedef void* EGLSurface; | 
| Greg Daniel | cd55852 | 2016-11-17 13:31:40 -0500 | [diff] [blame] | 23 |  | 
|  | 24 | namespace android { | 
|  | 25 | namespace uirenderer { | 
|  | 26 | namespace renderthread { | 
|  | 27 |  | 
|  | 28 | class Frame { | 
|  | 29 | public: | 
|  | 30 | Frame(int32_t width, int32_t height, int32_t bufferAge) | 
| John Reck | 1bcacfd | 2017-11-03 10:12:19 -0700 | [diff] [blame] | 31 | : mWidth(width), mHeight(height), mBufferAge(bufferAge) {} | 
| Greg Daniel | cd55852 | 2016-11-17 13:31:40 -0500 | [diff] [blame] | 32 |  | 
|  | 33 | int32_t width() const { return mWidth; } | 
|  | 34 | int32_t height() const { return mHeight; } | 
|  | 35 |  | 
|  | 36 | // See: https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt | 
|  | 37 | // for what this means | 
|  | 38 | int32_t bufferAge() const { return mBufferAge; } | 
|  | 39 |  | 
|  | 40 | private: | 
|  | 41 | Frame() {} | 
|  | 42 | friend class EglManager; | 
|  | 43 |  | 
|  | 44 | int32_t mWidth; | 
|  | 45 | int32_t mHeight; | 
|  | 46 | int32_t mBufferAge; | 
|  | 47 |  | 
|  | 48 | EGLSurface mSurface; | 
|  | 49 |  | 
|  | 50 | // Maps from 0,0 in top-left to 0,0 in bottom-left | 
|  | 51 | // If out is not an int32_t[4] you're going to have a bad time | 
|  | 52 | void map(const SkRect& in, int32_t* out) const; | 
|  | 53 | }; | 
|  | 54 |  | 
|  | 55 | } /* namespace renderthread */ | 
|  | 56 | } /* namespace uirenderer */ | 
|  | 57 | } /* namespace android */ |