Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: cc/resources/compositing_display_item.h

Issue 942403002: Add a compositing display item which replaces transparency display item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Forward decls and imports oh my Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/cc.gyp ('k') | cc/resources/compositing_display_item.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 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_RESOURCES_TRANSPARENCY_DISPLAY_ITEM_H_ 5 #ifndef CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_
6 #define CC_RESOURCES_TRANSPARENCY_DISPLAY_ITEM_H_ 6 #define CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "cc/base/cc_export.h" 9 #include "cc/base/cc_export.h"
10 #include "cc/resources/display_item.h" 10 #include "cc/resources/display_item.h"
11 #include "skia/ext/refptr.h" 11 #include "skia/ext/refptr.h"
12 #include "third_party/skia/include/core/SkColorFilter.h"
12 #include "third_party/skia/include/core/SkXfermode.h" 13 #include "third_party/skia/include/core/SkXfermode.h"
13 #include "ui/gfx/geometry/rect_f.h" 14 #include "ui/gfx/geometry/rect_f.h"
14 15
15 class SkCanvas; 16 class SkCanvas;
16 class SkDrawPictureCallback; 17 class SkDrawPictureCallback;
17 18
18 namespace cc { 19 namespace cc {
19 20
20 class CC_EXPORT TransparencyDisplayItem : public DisplayItem { 21 class CC_EXPORT CompositingDisplayItem : public DisplayItem {
21 public: 22 public:
22 ~TransparencyDisplayItem() override; 23 ~CompositingDisplayItem() override;
23 24
24 static scoped_ptr<TransparencyDisplayItem> Create( 25 static scoped_ptr<CompositingDisplayItem> Create(
25 float opacity, 26 float opacity,
26 SkXfermode::Mode blend_mode) { 27 SkXfermode::Mode xfermode,
27 return make_scoped_ptr(new TransparencyDisplayItem(opacity, blend_mode)); 28 skia::RefPtr<SkColorFilter> color_filter) {
29 return make_scoped_ptr(
30 new CompositingDisplayItem(opacity, xfermode, color_filter));
28 } 31 }
29 32
30 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; 33 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override;
31 34
32 bool IsSuitableForGpuRasterization() const override; 35 bool IsSuitableForGpuRasterization() const override;
33 int ApproximateOpCount() const override; 36 int ApproximateOpCount() const override;
34 size_t PictureMemoryUsage() const override; 37 size_t PictureMemoryUsage() const override;
35 void AsValueInto(base::trace_event::TracedValue* array) const override; 38 void AsValueInto(base::trace_event::TracedValue* array) const override;
36 39
37 protected: 40 protected:
38 TransparencyDisplayItem(float opacity, SkXfermode::Mode blend_mode); 41 CompositingDisplayItem(float opacity,
42 SkXfermode::Mode,
43 skia::RefPtr<SkColorFilter>);
39 44
40 private: 45 private:
41 float opacity_; 46 float opacity_;
42 SkXfermode::Mode blend_mode_; 47 SkXfermode::Mode xfermode_;
48 skia::RefPtr<SkColorFilter> color_filter_;
43 }; 49 };
44 50
45 class CC_EXPORT EndTransparencyDisplayItem : public DisplayItem { 51 class CC_EXPORT EndCompositingDisplayItem : public DisplayItem {
46 public: 52 public:
47 ~EndTransparencyDisplayItem() override; 53 ~EndCompositingDisplayItem() override;
48 54
49 static scoped_ptr<EndTransparencyDisplayItem> Create() { 55 static scoped_ptr<EndCompositingDisplayItem> Create() {
50 return make_scoped_ptr(new EndTransparencyDisplayItem()); 56 return make_scoped_ptr(new EndCompositingDisplayItem());
51 } 57 }
52 58
53 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override; 59 void Raster(SkCanvas* canvas, SkDrawPictureCallback* callback) const override;
54 60
55 bool IsSuitableForGpuRasterization() const override; 61 bool IsSuitableForGpuRasterization() const override;
56 int ApproximateOpCount() const override; 62 int ApproximateOpCount() const override;
57 size_t PictureMemoryUsage() const override; 63 size_t PictureMemoryUsage() const override;
58 void AsValueInto(base::trace_event::TracedValue* array) const override; 64 void AsValueInto(base::trace_event::TracedValue* array) const override;
59 65
60 protected: 66 protected:
61 EndTransparencyDisplayItem(); 67 EndCompositingDisplayItem();
62 }; 68 };
63 69
64 } // namespace cc 70 } // namespace cc
65 71
66 #endif // CC_RESOURCES_TRANSPARENCY_DISPLAY_ITEM_H_ 72 #endif // CC_RESOURCES_COMPOSITING_DISPLAY_ITEM_H_
OLDNEW
« no previous file with comments | « cc/cc.gyp ('k') | cc/resources/compositing_display_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698