summaryrefslogtreecommitdiffstats
path: root/cc/output/filter_operations.h
blob: 1b48662901ed014ac9b95262cb2941b07e7c1e2f (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
// Copyright 2013 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_OUTPUT_FILTER_OPERATIONS_H_
#define CC_OUTPUT_FILTER_OPERATIONS_H_

#include <vector>

#include "base/logging.h"
#include "cc/output/filter_operation.h"

namespace cc {

// An ordered list of filter operations.
class CC_EXPORT FilterOperations {
 public:
  FilterOperations();

  FilterOperations(const FilterOperations& other);

  ~FilterOperations();

  FilterOperations& operator=(const FilterOperations& other);

  bool operator==(const FilterOperations& other) const;

  bool operator!=(const FilterOperations& other) const {
    return !(*this == other);
  }

  void Append(const FilterOperation& filter);

  // Removes all filter operations.
  void Clear();

  bool IsEmpty() const;

  void GetOutsets(int* top, int* right, int* bottom, int* left) const;
  bool HasFilterThatMovesPixels() const;
  bool HasFilterThatAffectsOpacity() const;

  size_t size() const {
    return operations_.size();
  }

  FilterOperation at(size_t index) const {
    DCHECK_LT(index, size());
    return operations_[index];
  }

 private:
  std::vector<FilterOperation> operations_;
};

}  // namespace cc

#endif  // CC_OUTPUT_FILTER_OPERATIONS_H_