| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 struct CC_PAINT_EXPORT PaintOpWithFlags : PaintOp { | 110 struct CC_PAINT_EXPORT PaintOpWithFlags : PaintOp { |
| 111 static constexpr bool kHasPaintFlags = true; | 111 static constexpr bool kHasPaintFlags = true; |
| 112 | 112 |
| 113 explicit PaintOpWithFlags(const PaintFlags& flags) : flags(flags) {} | 113 explicit PaintOpWithFlags(const PaintFlags& flags) : flags(flags) {} |
| 114 | 114 |
| 115 int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } | 115 int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } |
| 116 bool HasDiscardableImagesFromFlags() const { | 116 bool HasDiscardableImagesFromFlags() const { |
| 117 if (!IsDrawOp()) | 117 if (!IsDrawOp()) |
| 118 return false; | 118 return false; |
| 119 | 119 |
| 120 SkShader* shader = flags.getShader(); | 120 SkShader* shader = flags.getSkShader(); |
| 121 SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; | 121 SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; |
| 122 return image && image->isLazyGenerated(); | 122 return image && image->isLazyGenerated(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 // Subclasses should provide a static RasterWithFlags() method which is called | 125 // Subclasses should provide a static RasterWithFlags() method which is called |
| 126 // from the Raster() method. The RasterWithFlags() should use the PaintFlags | 126 // from the Raster() method. The RasterWithFlags() should use the PaintFlags |
| 127 // passed to it, instead of the |flags| member directly, as some callers may | 127 // passed to it, instead of the |flags| member directly, as some callers may |
| 128 // provide a modified PaintFlags. The RasterWithFlags() method is static with | 128 // provide a modified PaintFlags. The RasterWithFlags() method is static with |
| 129 // a const PaintOpWithFlags* parameter so that it can be used as a function | 129 // a const PaintOpWithFlags* parameter so that it can be used as a function |
| 130 // pointer. | 130 // pointer. |
| (...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 975 // Record additional bytes used by referenced sub-records and display lists. | 975 // Record additional bytes used by referenced sub-records and display lists. |
| 976 size_t subrecord_bytes_used_ = 0; | 976 size_t subrecord_bytes_used_ = 0; |
| 977 bool has_discardable_images_ = false; | 977 bool has_discardable_images_ = false; |
| 978 | 978 |
| 979 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); | 979 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); |
| 980 }; | 980 }; |
| 981 | 981 |
| 982 } // namespace cc | 982 } // namespace cc |
| 983 | 983 |
| 984 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ | 984 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ |
| OLD | NEW |