OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_PAINT_PAINT_OP_BUFFER_H_ | 5 #ifndef CC_PAINT_PAINT_OP_BUFFER_H_ |
6 #define CC_PAINT_PAINT_OP_BUFFER_H_ | 6 #define CC_PAINT_PAINT_OP_BUFFER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 struct CC_PAINT_EXPORT PaintOpWithFlags : PaintOp { | 108 struct CC_PAINT_EXPORT PaintOpWithFlags : PaintOp { |
109 static constexpr bool kHasPaintFlags = true; | 109 static constexpr bool kHasPaintFlags = true; |
110 | 110 |
111 explicit PaintOpWithFlags(const PaintFlags& flags) : flags(flags) {} | 111 explicit PaintOpWithFlags(const PaintFlags& flags) : flags(flags) {} |
112 | 112 |
113 int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } | 113 int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } |
114 bool HasDiscardableImagesFromFlags() const { | 114 bool HasDiscardableImagesFromFlags() const { |
115 if (!IsDrawOp()) | 115 if (!IsDrawOp()) |
116 return false; | 116 return false; |
117 | 117 |
118 SkShader* shader = flags.getShader(); | 118 SkShader* shader = flags.getSkShader(); |
119 SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; | 119 SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; |
120 return image && image->isLazyGenerated(); | 120 return image && image->isLazyGenerated(); |
121 } | 121 } |
122 | 122 |
123 // Subclasses should provide a static RasterWithFlags() method which is called | 123 // Subclasses should provide a static RasterWithFlags() method which is called |
124 // from the Raster() method. The RasterWithFlags() should use the PaintFlags | 124 // from the Raster() method. The RasterWithFlags() should use the PaintFlags |
125 // passed to it, instead of the |flags| member directly, as some callers may | 125 // passed to it, instead of the |flags| member directly, as some callers may |
126 // provide a modified PaintFlags. The RasterWithFlags() method is static with | 126 // provide a modified PaintFlags. The RasterWithFlags() method is static with |
127 // a const PaintOpWithFlags* parameter so that it can be used as a function | 127 // a const PaintOpWithFlags* parameter so that it can be used as a function |
128 // pointer. | 128 // pointer. |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 // Record additional bytes used by referenced sub-records and display lists. | 968 // Record additional bytes used by referenced sub-records and display lists. |
969 size_t subrecord_bytes_used_ = 0; | 969 size_t subrecord_bytes_used_ = 0; |
970 bool has_discardable_images_ = false; | 970 bool has_discardable_images_ = false; |
971 | 971 |
972 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); | 972 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); |
973 }; | 973 }; |
974 | 974 |
975 } // namespace cc | 975 } // namespace cc |
976 | 976 |
977 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ | 977 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ |
OLD | NEW |