| OLD | NEW |
| (Empty) |
| 1 // Copyright 2015 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 #include "cc/playback/largest_display_item.h" | |
| 6 | |
| 7 #include <stddef.h> | |
| 8 | |
| 9 #include <algorithm> | |
| 10 | |
| 11 #include "cc/playback/clip_display_item.h" | |
| 12 #include "cc/playback/clip_path_display_item.h" | |
| 13 #include "cc/playback/compositing_display_item.h" | |
| 14 #include "cc/playback/drawing_display_item.h" | |
| 15 #include "cc/playback/filter_display_item.h" | |
| 16 #include "cc/playback/float_clip_display_item.h" | |
| 17 #include "cc/playback/transform_display_item.h" | |
| 18 | |
| 19 #include "third_party/skia/include/core/SkPicture.h" | |
| 20 | |
| 21 namespace { | |
| 22 // Either FilterDisplayItem or TransformDisplayItem is largest. It depends on | |
| 23 // the platform. | |
| 24 constexpr size_t kLargestDisplayItemSize = | |
| 25 sizeof(cc::FilterDisplayItem) > sizeof(cc::TransformDisplayItem) | |
| 26 ? sizeof(cc::FilterDisplayItem) | |
| 27 : sizeof(cc::TransformDisplayItem); | |
| 28 } // namespace | |
| 29 | |
| 30 namespace cc { | |
| 31 | |
| 32 size_t LargestDisplayItemSize() { | |
| 33 // Use compile assert to make sure largest is actually larger than all other | |
| 34 // type of display_items. | |
| 35 static_assert(sizeof(ClipDisplayItem) <= kLargestDisplayItemSize, | |
| 36 "Largest Draw Quad size needs update. ClipDisplayItem" | |
| 37 " is currently largest."); | |
| 38 static_assert(sizeof(EndClipDisplayItem) <= kLargestDisplayItemSize, | |
| 39 "Largest Draw Quad size needs update. EndClipDisplayItem" | |
| 40 " is currently largest."); | |
| 41 static_assert(sizeof(ClipPathDisplayItem) <= kLargestDisplayItemSize, | |
| 42 "Largest Draw Quad size needs update. ClipPathDisplayItem" | |
| 43 " is currently largest."); | |
| 44 static_assert(sizeof(EndClipPathDisplayItem) <= kLargestDisplayItemSize, | |
| 45 "Largest Draw Quad size needs update. EndClipPathDisplayItem" | |
| 46 " is currently largest."); | |
| 47 static_assert(sizeof(CompositingDisplayItem) <= kLargestDisplayItemSize, | |
| 48 "Largest Draw Quad size needs update. CompositingDisplayItem" | |
| 49 " is currently largest."); | |
| 50 static_assert(sizeof(EndCompositingDisplayItem) <= kLargestDisplayItemSize, | |
| 51 "Largest Draw Quad size needs update. EndCompositingDisplayItem" | |
| 52 " is currently largest."); | |
| 53 static_assert(sizeof(DrawingDisplayItem) <= kLargestDisplayItemSize, | |
| 54 "Largest Draw Quad size needs update. DrawingDisplayItem" | |
| 55 " is currently largest."); | |
| 56 static_assert(sizeof(FilterDisplayItem) <= kLargestDisplayItemSize, | |
| 57 "Largest Draw Quad size needs update. FilterDisplayItem" | |
| 58 " is currently largest."); | |
| 59 static_assert(sizeof(EndFilterDisplayItem) <= kLargestDisplayItemSize, | |
| 60 "Largest Draw Quad size needs update. EndFilterDisplayItem" | |
| 61 " is currently largest."); | |
| 62 static_assert(sizeof(FloatClipDisplayItem) <= kLargestDisplayItemSize, | |
| 63 "Largest Draw Quad size needs update. FloatClipDisplayItem" | |
| 64 " is currently largest."); | |
| 65 static_assert(sizeof(EndFloatClipDisplayItem) <= kLargestDisplayItemSize, | |
| 66 "Largest Draw Quad size needs update. EndFloatClipDisplayItem" | |
| 67 " is currently largest."); | |
| 68 static_assert(sizeof(TransformDisplayItem) <= kLargestDisplayItemSize, | |
| 69 "Largest Draw Quad size needs update. TransformDisplayItem" | |
| 70 " is currently largest."); | |
| 71 static_assert(sizeof(EndTransformDisplayItem) <= kLargestDisplayItemSize, | |
| 72 "Largest Draw Quad size needs update. EndTransformDisplayItem" | |
| 73 " is currently largest."); | |
| 74 | |
| 75 return kLargestDisplayItemSize; | |
| 76 } | |
| 77 | |
| 78 } // namespace cc | |
| OLD | NEW |