blob: 03cf95d797d4f0428e9016b284d2c1e1ed1f7b07 [file] [log] [blame]
Greg Danielcd558522016-11-17 13:31:40 -05001/*
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
21struct SkRect;
John Reck1bcacfd2017-11-03 10:12:19 -070022typedef void* EGLSurface;
Greg Danielcd558522016-11-17 13:31:40 -050023
24namespace android {
25namespace uirenderer {
26namespace renderthread {
27
28class Frame {
29public:
30 Frame(int32_t width, int32_t height, int32_t bufferAge)
John Reck1bcacfd2017-11-03 10:12:19 -070031 : mWidth(width), mHeight(height), mBufferAge(bufferAge) {}
Greg Danielcd558522016-11-17 13:31:40 -050032
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
John Reckec100972018-04-05 16:41:41 -070040 void setPresentTime(int64_t presentTime) { mPresentTime = presentTime; }
41
Greg Danielcd558522016-11-17 13:31:40 -050042private:
43 Frame() {}
44 friend class EglManager;
45
46 int32_t mWidth;
47 int32_t mHeight;
48 int32_t mBufferAge;
John Reckec100972018-04-05 16:41:41 -070049 int64_t mPresentTime;
Greg Danielcd558522016-11-17 13:31:40 -050050
51 EGLSurface mSurface;
52
53 // Maps from 0,0 in top-left to 0,0 in bottom-left
54 // If out is not an int32_t[4] you're going to have a bad time
55 void map(const SkRect& in, int32_t* out) const;
56};
57
58} /* namespace renderthread */
59} /* namespace uirenderer */
60} /* namespace android */