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