blob: d266faa4f7c956c842c4c6ae08931ad94988aa0a [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
40private:
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 */