| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CC_OUTPUT_FILTER_OPERATIONS_H_ | 5 #ifndef CC_OUTPUT_FILTER_OPERATIONS_H_ |
| 6 #define CC_OUTPUT_FILTER_OPERATIONS_H_ | 6 #define CC_OUTPUT_FILTER_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 namespace cc { | 27 namespace cc { |
| 28 | 28 |
| 29 // An ordered list of filter operations. | 29 // An ordered list of filter operations. |
| 30 class CC_EXPORT FilterOperations { | 30 class CC_EXPORT FilterOperations { |
| 31 public: | 31 public: |
| 32 FilterOperations(); | 32 FilterOperations(); |
| 33 | 33 |
| 34 FilterOperations(const FilterOperations& other); | 34 FilterOperations(const FilterOperations& other); |
| 35 | 35 |
| 36 explicit FilterOperations(std::vector<FilterOperation>&& operations); |
| 37 |
| 36 ~FilterOperations(); | 38 ~FilterOperations(); |
| 37 | 39 |
| 38 FilterOperations& operator=(const FilterOperations& other); | 40 FilterOperations& operator=(const FilterOperations& other); |
| 39 | 41 |
| 42 FilterOperations& operator=(FilterOperations&& other); |
| 43 |
| 40 bool operator==(const FilterOperations& other) const; | 44 bool operator==(const FilterOperations& other) const; |
| 41 | 45 |
| 42 bool operator!=(const FilterOperations& other) const { | 46 bool operator!=(const FilterOperations& other) const { |
| 43 return !(*this == other); | 47 return !(*this == other); |
| 44 } | 48 } |
| 45 | 49 |
| 46 void Append(const FilterOperation& filter); | 50 void Append(const FilterOperation& filter); |
| 47 | 51 |
| 48 // Removes all filter operations. | 52 // Removes all filter operations. |
| 49 void Clear(); | 53 void Clear(); |
| 50 | 54 |
| 51 bool IsEmpty() const; | 55 bool IsEmpty() const; |
| 52 | 56 |
| 53 // Maps "forward" to determine which pixels in a destination rect are affected | 57 // Maps "forward" to determine which pixels in a destination rect are affected |
| 54 // by pixels in the source rect. | 58 // by pixels in the source rect. |
| 55 gfx::Rect MapRect(const gfx::Rect& rect, const SkMatrix& matrix) const; | 59 gfx::Rect MapRect(const gfx::Rect& rect, const SkMatrix& matrix) const; |
| 56 | 60 |
| 57 void GetOutsets(int* top, int* right, int* bottom, int* left) const; | 61 void GetOutsets(int* top, int* right, int* bottom, int* left) const; |
| 58 bool HasFilterThatMovesPixels() const; | 62 bool HasFilterThatMovesPixels() const; |
| 59 bool HasFilterThatAffectsOpacity() const; | 63 bool HasFilterThatAffectsOpacity() const; |
| 60 bool HasReferenceFilter() const; | 64 bool HasReferenceFilter() const; |
| 61 | 65 |
| 62 size_t size() const { | 66 size_t size() const { |
| 63 return operations_.size(); | 67 return operations_.size(); |
| 64 } | 68 } |
| 65 | 69 |
| 70 const std::vector<FilterOperation>& operations() const { return operations_; } |
| 71 |
| 66 const FilterOperation& at(size_t index) const { | 72 const FilterOperation& at(size_t index) const { |
| 67 DCHECK_LT(index, size()); | 73 DCHECK_LT(index, size()); |
| 68 return operations_[index]; | 74 return operations_[index]; |
| 69 } | 75 } |
| 70 | 76 |
| 71 // If |from| is of the same size as this, where in each position, the filter | 77 // If |from| is of the same size as this, where in each position, the filter |
| 72 // in |from| is of the same type as the filter in this, and if this doesn't | 78 // in |from| is of the same type as the filter in this, and if this doesn't |
| 73 // contain any reference filters, returns a FilterOperations formed by | 79 // contain any reference filters, returns a FilterOperations formed by |
| 74 // linearly interpolating at each position a |progress| fraction of the way | 80 // linearly interpolating at each position a |progress| fraction of the way |
| 75 // from the filter in |from| to the filter in this. If |from| and this are of | 81 // from the filter in |from| to the filter in this. If |from| and this are of |
| 76 // different lengths, they are treated as having the same length by padding | 82 // different lengths, they are treated as having the same length by padding |
| 77 // the shorter sequence with no-op filters of the same type as the filters in | 83 // the shorter sequence with no-op filters of the same type as the filters in |
| 78 // the corresponding positions in the longer sequence. If either sequence has | 84 // the corresponding positions in the longer sequence. If either sequence has |
| 79 // a reference filter or if there is a type mismatch at some position, returns | 85 // a reference filter or if there is a type mismatch at some position, returns |
| 80 // a copy of this. | 86 // a copy of this. |
| 81 FilterOperations Blend(const FilterOperations& from, double progress) const; | 87 FilterOperations Blend(const FilterOperations& from, double progress) const; |
| 82 | 88 |
| 83 void AsValueInto(base::trace_event::TracedValue* value) const; | 89 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 84 | 90 |
| 85 private: | 91 private: |
| 86 std::vector<FilterOperation> operations_; | 92 std::vector<FilterOperation> operations_; |
| 87 }; | 93 }; |
| 88 | 94 |
| 89 } // namespace cc | 95 } // namespace cc |
| 90 | 96 |
| 91 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_ | 97 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_ |
| OLD | NEW |