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_
10 #include "base/logging.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "cc/output/filter_operation.h"
15 namespace trace_event
{
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
22 using ::base::trace_event::TracedValue
;
29 // An ordered list of filter operations.
30 class CC_EXPORT FilterOperations
{
34 FilterOperations(const FilterOperations
& other
);
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.
53 void GetOutsets(int* top
, int* right
, int* bottom
, int* left
) const;
54 bool HasFilterThatMovesPixels() const;
55 bool HasFilterThatAffectsOpacity() const;
56 bool HasReferenceFilter() 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
77 FilterOperations
Blend(const FilterOperations
& from
, double progress
) const;
79 void AsValueInto(base::debug::TracedValue
* value
) const;
82 std::vector
<FilterOperation
> operations_
;
87 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_