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