Revert of Linux MSan: enable swarming/sharding for browser_tests. (patchset #1 id...
[chromium-blink-merge.git] / cc / output / filter_operations.h
blob8e3793321cfc6dd043c827df8dc2a9feefa80f5f
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;
19 // TODO(ssid): remove these aliases after the tracing clients are moved to the
20 // new trace_event namespace. See crbug.com/451032. ETA: March 2015
21 namespace debug {
22 using ::base::trace_event::TracedValue;
24 class Value;
25 } // namespace base
27 namespace cc {
29 // An ordered list of filter operations.
30 class CC_EXPORT FilterOperations {
31 public:
32 FilterOperations();
34 FilterOperations(const FilterOperations& other);
36 ~FilterOperations();
38 FilterOperations& operator=(const FilterOperations& other);
40 bool operator==(const FilterOperations& other) const;
42 bool operator!=(const FilterOperations& other) const {
43 return !(*this == other);
46 void Append(const FilterOperation& filter);
48 // Removes all filter operations.
49 void Clear();
51 bool IsEmpty() const;
53 void GetOutsets(int* top, int* right, int* bottom, int* left) const;
54 bool HasFilterThatMovesPixels() const;
55 bool HasFilterThatAffectsOpacity() const;
56 bool HasReferenceFilter() const;
58 size_t size() const {
59 return operations_.size();
62 const FilterOperation& at(size_t index) const {
63 DCHECK_LT(index, size());
64 return operations_[index];
67 // If |from| is of the same size as this, where in each position, the filter
68 // in |from| is of the same type as the filter in this, and if this doesn't
69 // contain any reference filters, returns a FilterOperations formed by
70 // linearly interpolating at each position a |progress| fraction of the way
71 // from the filter in |from| to the filter in this. If |from| and this are of
72 // different lengths, they are treated as having the same length by padding
73 // the shorter sequence with no-op filters of the same type as the filters in
74 // the corresponding positions in the longer sequence. If either sequence has
75 // a reference filter or if there is a type mismatch at some position, returns
76 // a copy of this.
77 FilterOperations Blend(const FilterOperations& from, double progress) const;
79 void AsValueInto(base::debug::TracedValue* value) const;
81 private:
82 std::vector<FilterOperation> operations_;
85 } // namespace cc
87 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_