1cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel/* 2cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * Copyright (C) 2016 The Android Open Source Project 3cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * 4cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * Licensed under the Apache License, Version 2.0 (the "License"); 5cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * you may not use this file except in compliance with the License. 6cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * You may obtain a copy of the License at 7cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * 8cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * http://www.apache.org/licenses/LICENSE-2.0 9cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * 10cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * Unless required by applicable law or agreed to in writing, software 11cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * distributed under the License is distributed on an "AS IS" BASIS, 12cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * See the License for the specific language governing permissions and 14cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel * limitations under the License. 15cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel */ 16cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 17cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel#pragma once 18cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 19cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel#include <stdint.h> 20cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 21cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielstruct SkRect; 22cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danieltypedef void *EGLSurface; 23cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 24cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielnamespace android { 25cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielnamespace uirenderer { 26cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielnamespace renderthread { 27cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 28cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielclass Frame { 29cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielpublic: 30cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel Frame(int32_t width, int32_t height, int32_t bufferAge) 31cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel : mWidth(width) 32cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel , mHeight(height) 33cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel , mBufferAge(bufferAge) { } 34cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 35cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel int32_t width() const { return mWidth; } 36cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel int32_t height() const { return mHeight; } 37cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 38cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel // See: https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt 39cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel // for what this means 40cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel int32_t bufferAge() const { return mBufferAge; } 41cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 42cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Danielprivate: 43cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel Frame() {} 44cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel friend class EglManager; 45cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 46cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel int32_t mWidth; 47cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel int32_t mHeight; 48cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel int32_t mBufferAge; 49cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 50cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel EGLSurface mSurface; 51cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 52cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel // Maps from 0,0 in top-left to 0,0 in bottom-left 53cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel // If out is not an int32_t[4] you're going to have a bad time 54cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel void map(const SkRect& in, int32_t* out) const; 55cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel}; 56cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 57cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel} /* namespace renderthread */ 58cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel} /* namespace uirenderer */ 59cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel} /* namespace android */ 60cd55852fcd840f7f4c4d7a0a7253a2995c77afa2Greg Daniel 61