cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / cc / output / filter_operations.h
blobaa8d58dd8d2e11fecfa1c8250160d2f0589ba916
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 class Value;
18 namespace cc {
20 // An ordered list of filter operations.
21 class CC_EXPORT FilterOperations {
22 public:
23 FilterOperations();
25 FilterOperations(const FilterOperations& other);
27 ~FilterOperations();
29 FilterOperations& operator=(const FilterOperations& other);
31 bool operator==(const FilterOperations& other) const;
33 bool operator!=(const FilterOperations& other) const {
34 return !(*this == other);
37 void Append(const FilterOperation& filter);
39 // Removes all filter operations.
40 void Clear();
42 bool IsEmpty() const;
44 void GetOutsets(int* top, int* right, int* bottom, int* left) const;
45 bool HasFilterThatMovesPixels() const;
46 bool HasFilterThatAffectsOpacity() const;
48 size_t size() const {
49 return operations_.size();
52 const FilterOperation& at(size_t index) const {
53 DCHECK_LT(index, size());
54 return operations_[index];
57 // If |from| is of the same size as this, where in each position, the filter
58 // in |from| is of the same type as the filter in this, returns a
59 // FilterOperations formed by linearly interpolating at each position a
60 // |progress| fraction of the way from the filter in |from|
61 // to the filter in this. If either |from| or this is an empty sequence,
62 // it is treated as a sequence of the same length as the other sequence,
63 // where the filter at each position is a no-op filter of the same type
64 // as the filter in that position in the other sequence. Otherwise, if
65 // both |from| and this are non-empty sequences but are either of different
66 // lengths or if there is a type mismatch at some position, returns a copy
67 // of this.
68 FilterOperations Blend(const FilterOperations& from, double progress) const;
70 scoped_ptr<base::Value> AsValue() const;
72 private:
73 std::vector<FilterOperation> operations_;
76 } // namespace cc
78 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_