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
{
23 // An ordered list of filter operations.
24 class CC_EXPORT FilterOperations
{
28 FilterOperations(const FilterOperations
& other
);
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.
47 void GetOutsets(int* top
, int* right
, int* bottom
, int* left
) const;
48 bool HasFilterThatMovesPixels() const;
49 bool HasFilterThatAffectsOpacity() const;
50 bool HasReferenceFilter() 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
71 FilterOperations
Blend(const FilterOperations
& from
, double progress
) const;
73 void AsValueInto(base::trace_event::TracedValue
* value
) const;
76 std::vector
<FilterOperation
> operations_
;
81 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_