| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 struct CC_PAINT_EXPORT PaintOpWithFlags : PaintOp { | 106 struct CC_PAINT_EXPORT PaintOpWithFlags : PaintOp { |
| 107 static constexpr bool kHasPaintFlags = true; | 107 static constexpr bool kHasPaintFlags = true; |
| 108 | 108 |
| 109 explicit PaintOpWithFlags(const PaintFlags& flags) : flags(flags) {} | 109 explicit PaintOpWithFlags(const PaintFlags& flags) : flags(flags) {} |
| 110 | 110 |
| 111 int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } | 111 int CountSlowPathsFromFlags() const { return flags.getPathEffect() ? 1 : 0; } |
| 112 bool HasDiscardableImagesFromFlags() const { | 112 bool HasDiscardableImagesFromFlags() const { |
| 113 if (!IsDrawOp()) | 113 if (!IsDrawOp()) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 SkShader* shader = flags.getShader(); | 116 SkShader* shader = flags.getSkShader(); |
| 117 SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; | 117 SkImage* image = shader ? shader->isAImage(nullptr, nullptr) : nullptr; |
| 118 return image && image->isLazyGenerated(); | 118 return image && image->isLazyGenerated(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 // Subclasses should provide a static RasterWithFlags() method which is called | 121 // Subclasses should provide a static RasterWithFlags() method which is called |
| 122 // from the Raster() method. The RasterWithFlags() should use the PaintFlags | 122 // from the Raster() method. The RasterWithFlags() should use the PaintFlags |
| 123 // passed to it, instead of the |flags| member directly, as some callers may | 123 // passed to it, instead of the |flags| member directly, as some callers may |
| 124 // provide a modified PaintFlags. The RasterWithFlags() method is static with | 124 // provide a modified PaintFlags. The RasterWithFlags() method is static with |
| 125 // a const PaintOpWithFlags* parameter so that it can be used as a function | 125 // a const PaintOpWithFlags* parameter so that it can be used as a function |
| 126 // pointer. | 126 // pointer. |
| (...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 950 size_t subrecord_bytes_used_ = 0; | 950 size_t subrecord_bytes_used_ = 0; |
| 951 bool has_discardable_images_ = false; | 951 bool has_discardable_images_ = false; |
| 952 SkRect cull_rect_; | 952 SkRect cull_rect_; |
| 953 | 953 |
| 954 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); | 954 DISALLOW_COPY_AND_ASSIGN(PaintOpBuffer); |
| 955 }; | 955 }; |
| 956 | 956 |
| 957 } // namespace cc | 957 } // namespace cc |
| 958 | 958 |
| 959 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ | 959 #endif // CC_PAINT_PAINT_OP_BUFFER_H_ |
| OLD | NEW |