1 // Copyright 2020 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef COMPONENTS_VIZ_COMMON_QUADS_QUAD_LIST_H_
6 #define COMPONENTS_VIZ_COMMON_QUADS_QUAD_LIST_H_
7 
8 #include <stddef.h>
9 
10 #include "cc/base/list_container.h"
11 #include "components/viz/common/quads/draw_quad.h"
12 
13 namespace viz {
14 
15 // A list of DrawQuad objects, sorted internally in front-to-back order. To
16 // add a new quad drawn behind another quad, it must be placed after the other
17 // quad.
18 class VIZ_COMMON_EXPORT QuadList : public cc::ListContainer<DrawQuad> {
19  public:
20   QuadList();
21   explicit QuadList(size_t default_size_to_reserve);
22 
23   using BackToFrontIterator = QuadList::ReverseIterator;
24   using ConstBackToFrontIterator = QuadList::ConstReverseIterator;
25 
BackToFrontBegin()26   inline BackToFrontIterator BackToFrontBegin() { return rbegin(); }
BackToFrontEnd()27   inline BackToFrontIterator BackToFrontEnd() { return rend(); }
BackToFrontBegin()28   inline ConstBackToFrontIterator BackToFrontBegin() const { return rbegin(); }
BackToFrontEnd()29   inline ConstBackToFrontIterator BackToFrontEnd() const { return rend(); }
30 
31   Iterator InsertCopyBeforeDrawQuad(Iterator at, size_t count);
32 };
33 
34 }  // namespace viz
35 
36 #endif  // COMPONENTS_VIZ_COMMON_QUADS_QUAD_LIST_H_
37