view-manager: Create the root-view only when the viewport-metrics are known.
[chromium-blink-merge.git] / cc / output / filter_operations.h
blob7018b82af186c56fb4623a0c2327855c33706cac
1 // Copyright 2013 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.
5 #ifndef CC_OUTPUT_FILTER_OPERATIONS_H_
6 #define CC_OUTPUT_FILTER_OPERATIONS_H_
8 #include <vector>
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "cc/output/filter_operation.h"
14 namespace base {
15 namespace trace_event {
16 class TracedValue;
18 class Value;
21 namespace cc {
23 // An ordered list of filter operations.
24 class CC_EXPORT FilterOperations {
25 public:
26 FilterOperations();
28 FilterOperations(const FilterOperations& other);
30 ~FilterOperations();
32 FilterOperations& operator=(const FilterOperations& other);
34 bool operator==(const FilterOperations& other) const;
36 bool operator!=(const FilterOperations& other) const {
37 return !(*this == other);
40 void Append(const FilterOperation& filter);
42 // Removes all filter operations.
43 void Clear();
45 bool IsEmpty() const;
47 void GetOutsets(int* top, int* right, int* bottom, int* left) const;
48 bool HasFilterThatMovesPixels() const;
49 bool HasFilterThatAffectsOpacity() const;
50 bool HasReferenceFilter() const;
52 size_t size() const {
53 return operations_.size();
56 const FilterOperation& at(size_t index) const {
57 DCHECK_LT(index, size());
58 return operations_[index];
61 // If |from| is of the same size as this, where in each position, the filter
62 // in |from| is of the same type as the filter in this, and if this doesn't
63 // contain any reference filters, returns a FilterOperations formed by
64 // linearly interpolating at each position a |progress| fraction of the way
65 // from the filter in |from| to the filter in this. If |from| and this are of
66 // different lengths, they are treated as having the same length by padding
67 // the shorter sequence with no-op filters of the same type as the filters in
68 // the corresponding positions in the longer sequence. If either sequence has
69 // a reference filter or if there is a type mismatch at some position, returns
70 // a copy of this.
71 FilterOperations Blend(const FilterOperations& from, double progress) const;
73 void AsValueInto(base::trace_event::TracedValue* value) const;
75 private:
76 std::vector<FilterOperation> operations_;
79 } // namespace cc
81 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_