| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 5 #ifndef CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| 6 #define CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 6 #define CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | |
| 10 | 9 |
| 11 #include <memory> | |
| 12 | |
| 13 #include "base/memory/ptr_util.h" | |
| 14 #include "cc/base/cc_export.h" | 10 #include "cc/base/cc_export.h" |
| 15 #include "cc/playback/display_item.h" | 11 #include "cc/playback/display_item.h" |
| 12 #include "third_party/skia/include/core/SkBlendMode.h" |
| 16 #include "third_party/skia/include/core/SkColorFilter.h" | 13 #include "third_party/skia/include/core/SkColorFilter.h" |
| 17 #include "third_party/skia/include/core/SkRect.h" | 14 #include "third_party/skia/include/core/SkRect.h" |
| 18 #include "third_party/skia/include/core/SkRefCnt.h" | 15 #include "third_party/skia/include/core/SkRefCnt.h" |
| 19 #include "ui/gfx/geometry/rect_f.h" | |
| 20 | |
| 21 class SkCanvas; | |
| 22 | 16 |
| 23 namespace cc { | 17 namespace cc { |
| 24 | 18 |
| 25 class CC_EXPORT CompositingDisplayItem : public DisplayItem { | 19 class CC_EXPORT CompositingDisplayItem : public DisplayItem { |
| 26 public: | 20 public: |
| 27 CompositingDisplayItem(uint8_t alpha, | 21 CompositingDisplayItem(uint8_t alpha, |
| 28 SkBlendMode xfermode, | 22 SkBlendMode xfermode, |
| 29 SkRect* bounds, | 23 SkRect* bounds, |
| 30 sk_sp<SkColorFilter> color_filter, | 24 sk_sp<SkColorFilter> color_filter, |
| 31 bool lcd_text_requires_opaque_layer); | 25 bool lcd_text_requires_opaque_layer); |
| 32 ~CompositingDisplayItem() override; | 26 ~CompositingDisplayItem() override; |
| 33 | 27 |
| 34 void Raster(SkCanvas* canvas, | |
| 35 SkPicture::AbortCallback* callback) const override; | |
| 36 | |
| 37 size_t ExternalMemoryUsage() const { | 28 size_t ExternalMemoryUsage() const { |
| 38 // TODO(pdr): Include color_filter's memory here. | 29 // TODO(pdr): Include color_filter's memory here. |
| 39 return 0; | 30 return 0; |
| 40 } | 31 } |
| 41 int ApproximateOpCount() const { return 1; } | 32 int ApproximateOpCount() const { return 1; } |
| 42 | 33 |
| 43 uint8_t alpha() const { return alpha_; } | 34 const uint8_t alpha; |
| 44 SkBlendMode xfermode() const { return xfermode_; } | 35 const SkBlendMode xfermode; |
| 45 bool has_bounds() const { return has_bounds_; } | 36 const bool has_bounds; |
| 46 const SkRect& bounds() const { return bounds_; } | 37 const SkRect bounds; |
| 47 | 38 const sk_sp<SkColorFilter> color_filter; |
| 48 private: | 39 const bool lcd_text_requires_opaque_layer; |
| 49 void SetNew(uint8_t alpha, | |
| 50 SkBlendMode xfermode, | |
| 51 SkRect* bounds, | |
| 52 sk_sp<SkColorFilter> color_filter, | |
| 53 bool lcd_text_requires_opaque_layer); | |
| 54 | |
| 55 uint8_t alpha_; | |
| 56 SkBlendMode xfermode_; | |
| 57 bool has_bounds_; | |
| 58 SkRect bounds_; | |
| 59 sk_sp<SkColorFilter> color_filter_; | |
| 60 bool lcd_text_requires_opaque_layer_; | |
| 61 }; | 40 }; |
| 62 | 41 |
| 63 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { | 42 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem { |
| 64 public: | 43 public: |
| 65 EndCompositingDisplayItem(); | 44 EndCompositingDisplayItem(); |
| 66 ~EndCompositingDisplayItem() override; | 45 ~EndCompositingDisplayItem() override; |
| 67 | 46 |
| 68 static std::unique_ptr<EndCompositingDisplayItem> Create() { | |
| 69 return base::MakeUnique<EndCompositingDisplayItem>(); | |
| 70 } | |
| 71 | |
| 72 void Raster(SkCanvas* canvas, | |
| 73 SkPicture::AbortCallback* callback) const override; | |
| 74 | |
| 75 int ApproximateOpCount() const { return 0; } | 47 int ApproximateOpCount() const { return 0; } |
| 76 }; | 48 }; |
| 77 | 49 |
| 78 } // namespace cc | 50 } // namespace cc |
| 79 | 51 |
| 80 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ | 52 #endif // CC_PLAYBACK_COMPOSITING_DISPLAY_ITEM_H_ |
| OLD | NEW |