summaryrefslogtreecommitdiffstats
path: root/cc/playback/largest_display_item.cc
blob: 7c761141c30a0597cf97b017309718583d48dc14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "cc/playback/largest_display_item.h"

#include <stddef.h>

#include <algorithm>

#include "cc/playback/clip_display_item.h"
#include "cc/playback/clip_path_display_item.h"
#include "cc/playback/compositing_display_item.h"
#include "cc/playback/drawing_display_item.h"
#include "cc/playback/filter_display_item.h"
#include "cc/playback/float_clip_display_item.h"
#include "cc/playback/transform_display_item.h"

#include "third_party/skia/include/core/SkPicture.h"

namespace {
const size_t kLargestDisplayItemSize = sizeof(cc::TransformDisplayItem);
}  // namespace

namespace cc {

size_t LargestDisplayItemSize() {
  // Use compile assert to make sure largest is actually larger than all other
  // type of display_items.
  static_assert(sizeof(ClipDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. ClipDisplayItem"
                " is currently largest.");
  static_assert(sizeof(EndClipDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. EndClipDisplayItem"
                " is currently largest.");
  static_assert(sizeof(ClipPathDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. ClipPathDisplayItem"
                " is currently largest.");
  static_assert(sizeof(EndClipPathDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. EndClipPathDisplayItem"
                " is currently largest.");
  static_assert(sizeof(CompositingDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. CompositingDisplayItem"
                " is currently largest.");
  static_assert(sizeof(EndCompositingDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. EndCompositingDisplayItem"
                " is currently largest.");
  static_assert(sizeof(DrawingDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. DrawingDisplayItem"
                " is currently largest.");
  static_assert(sizeof(FilterDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. FilterDisplayItem"
                " is currently largest.");
  static_assert(sizeof(EndFilterDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. EndFilterDisplayItem"
                " is currently largest.");
  static_assert(sizeof(FloatClipDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. FloatClipDisplayItem"
                " is currently largest.");
  static_assert(sizeof(EndFloatClipDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. EndFloatClipDisplayItem"
                " is currently largest.");
  static_assert(sizeof(TransformDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. TransformDisplayItem"
                " is currently largest.");
  static_assert(sizeof(EndTransformDisplayItem) <= kLargestDisplayItemSize,
                "Largest Draw Quad size needs update. EndTransformDisplayItem"
                " is currently largest.");

  return kLargestDisplayItemSize;
}

}  // namespace cc