| 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_PAINT_FILTER_OPERATIONS_H_ |
| 6 #define CC_OUTPUT_FILTER_OPERATIONS_H_ | 6 #define CC_PAINT_FILTER_OPERATIONS_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "cc/output/filter_operation.h" | 14 #include "cc/paint/filter_operation.h" |
| 15 | 15 |
| 16 namespace base { | 16 namespace base { |
| 17 namespace trace_event { | 17 namespace trace_event { |
| 18 class TracedValue; | 18 class TracedValue; |
| 19 } | 19 } |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| 23 class Rect; | 23 class Rect; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace cc { | 26 namespace cc { |
| 27 | 27 |
| 28 // An ordered list of filter operations. | 28 // An ordered list of filter operations. |
| 29 class CC_EXPORT FilterOperations { | 29 class CC_PAINT_EXPORT FilterOperations { |
| 30 public: | 30 public: |
| 31 FilterOperations(); | 31 FilterOperations(); |
| 32 | 32 |
| 33 FilterOperations(const FilterOperations& other); | 33 FilterOperations(const FilterOperations& other); |
| 34 | 34 |
| 35 explicit FilterOperations(std::vector<FilterOperation>&& operations); | 35 explicit FilterOperations(std::vector<FilterOperation>&& operations); |
| 36 | 36 |
| 37 ~FilterOperations(); | 37 ~FilterOperations(); |
| 38 | 38 |
| 39 FilterOperations& operator=(const FilterOperations& other); | 39 FilterOperations& operator=(const FilterOperations& other); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 59 | 59 |
| 60 // Maps "backward" to determine which pixels in the source affect the pixels | 60 // Maps "backward" to determine which pixels in the source affect the pixels |
| 61 // in the destination rect. | 61 // in the destination rect. |
| 62 gfx::Rect MapRectReverse(const gfx::Rect& rect, const SkMatrix& matrix) const; | 62 gfx::Rect MapRectReverse(const gfx::Rect& rect, const SkMatrix& matrix) const; |
| 63 | 63 |
| 64 void GetOutsets(int* top, int* right, int* bottom, int* left) const; | 64 void GetOutsets(int* top, int* right, int* bottom, int* left) const; |
| 65 bool HasFilterThatMovesPixels() const; | 65 bool HasFilterThatMovesPixels() const; |
| 66 bool HasFilterThatAffectsOpacity() const; | 66 bool HasFilterThatAffectsOpacity() const; |
| 67 bool HasReferenceFilter() const; | 67 bool HasReferenceFilter() const; |
| 68 | 68 |
| 69 size_t size() const { | 69 size_t size() const { return operations_.size(); } |
| 70 return operations_.size(); | |
| 71 } | |
| 72 | 70 |
| 73 const std::vector<FilterOperation>& operations() const { return operations_; } | 71 const std::vector<FilterOperation>& operations() const { return operations_; } |
| 74 | 72 |
| 75 const FilterOperation& at(size_t index) const { | 73 const FilterOperation& at(size_t index) const { |
| 76 DCHECK_LT(index, size()); | 74 DCHECK_LT(index, size()); |
| 77 return operations_[index]; | 75 return operations_[index]; |
| 78 } | 76 } |
| 79 | 77 |
| 80 // If |from| is of the same size as this, where in each position, the filter | 78 // 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 | 79 // 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 | 80 // contain any reference filters, returns a FilterOperations formed by |
| 83 // linearly interpolating at each position a |progress| fraction of the way | 81 // 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 | 82 // 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 | 83 // 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 | 84 // 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 | 85 // 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 | 86 // a reference filter or if there is a type mismatch at some position, returns |
| 89 // a copy of this. | 87 // a copy of this. |
| 90 FilterOperations Blend(const FilterOperations& from, double progress) const; | 88 FilterOperations Blend(const FilterOperations& from, double progress) const; |
| 91 | 89 |
| 92 void AsValueInto(base::trace_event::TracedValue* value) const; | 90 void AsValueInto(base::trace_event::TracedValue* value) const; |
| 93 std::string ToString() const; | 91 std::string ToString() const; |
| 94 | 92 |
| 95 private: | 93 private: |
| 96 std::vector<FilterOperation> operations_; | 94 std::vector<FilterOperation> operations_; |
| 97 }; | 95 }; |
| 98 | 96 |
| 99 } // namespace cc | 97 } // namespace cc |
| 100 | 98 |
| 101 #endif // CC_OUTPUT_FILTER_OPERATIONS_H_ | 99 #endif // CC_PAINT_FILTER_OPERATIONS_H_ |
| OLD | NEW |