summaryrefslogtreecommitdiffstats
path: root/cc/resources/priority_calculator.h
blob: 6ab54bdc933a880f28195a2e9f3662d835dfe44a (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
// Copyright 2010 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.

#ifndef CC_RESOURCES_PRIORITY_CALCULATOR_H_
#define CC_RESOURCES_PRIORITY_CALCULATOR_H_

#include "cc/base/cc_export.h"

namespace gfx { class Rect; }

namespace cc {

class CC_EXPORT PriorityCalculator {
 public:
  static int UIPriority(bool draws_to_root_surface);
  static int VisiblePriority(bool draws_to_root_surface);
  static int RenderSurfacePriority();
  static int LingeringPriority(int previous_priority);
  static int PriorityFromDistance(gfx::Rect visible_rect,
                                  gfx::Rect texture_rect,
                                  bool draws_to_root_surface);
  static int SmallAnimatedLayerMinPriority();

  static int HighestPriority();
  static int LowestPriority();
  static inline bool priority_is_lower(int a, int b) { return a > b; }
  static inline bool priority_is_higher(int a, int b) { return a < b; }
  static inline int max_priority(int a, int b) {
    return priority_is_higher(a, b) ? a : b;
  }

  static int AllowNothingCutoff();
  static int AllowVisibleOnlyCutoff();
  static int AllowVisibleAndNearbyCutoff();
  static int AllowEverythingCutoff();
};

}

#endif  // CC_RESOURCES_PRIORITY_CALCULATOR_H_