DeferredDisplayList.h revision c3566d06421c8acc0aafb18f7e307e5725ce87e1
1/* 2 * Copyright (C) 2013 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#ifndef ANDROID_HWUI_DEFERRED_DISPLAY_LIST_H 18#define ANDROID_HWUI_DEFERRED_DISPLAY_LIST_H 19 20#include <utils/Errors.h> 21#include <utils/Vector.h> 22 23#include "Matrix.h" 24#include "Rect.h" 25 26namespace android { 27namespace uirenderer { 28 29class DrawOp; 30class DrawOpBatch; 31class OpenGLRenderer; 32class SkiaShader; 33 34class DeferredDisplayList { 35public: 36 DeferredDisplayList() { clear(); } 37 ~DeferredDisplayList() { clear(); } 38 39 enum OpBatchId { 40 kOpBatch_None = -1, // Don't batch 41 kOpBatch_Bitmap, 42 kOpBatch_Patch, 43 kOpBatch_AlphaVertices, 44 kOpBatch_Vertices, 45 kOpBatch_AlphaMaskTexture, 46 kOpBatch_Text, 47 kOpBatch_ColorText, 48 49 kOpBatch_Count, // Add other batch ids before this 50 }; 51 52 bool isEmpty() { return mBatches.isEmpty(); } 53 54 /** 55 * Plays back all of the draw ops recorded into batches to the renderer. 56 * Adjusts the state of the renderer as necessary, and restores it when complete 57 */ 58 status_t flush(OpenGLRenderer& renderer, Rect& dirty, int32_t flags, 59 uint32_t level); 60 61 /** 62 * Add a draw op into the DeferredDisplayList, reordering as needed (for performance) if 63 * disallowReorder is false, respecting draw order when overlaps occur 64 */ 65 void add(DrawOp* op, bool disallowReorder); 66 67private: 68 void clear(); 69 70 71 Vector<DrawOpBatch*> mBatches; 72 int mBatchIndices[kOpBatch_Count]; 73}; 74 75}; // namespace uirenderer 76}; // namespace android 77 78#endif // ANDROID_HWUI_DEFERRED_DISPLAY_LIST_H 79