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

Side by Side Diff: cc/layers/layer.h

Issue 15435003: cc: Add CopyAsBitmapRequest class to hold the readback callback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nolint Created 7 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/layers/layer.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 2010 The Chromium Authors. All rights reserved. 1 // Copyright 2010 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_LAYERS_LAYER_H_ 5 #ifndef CC_LAYERS_LAYER_H_
6 #define CC_LAYERS_LAYER_H_ 6 #define CC_LAYERS_LAYER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector>
10 9
11 #include "base/callback.h" 10 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
13 #include "base/observer_list.h" 12 #include "base/observer_list.h"
14 #include "cc/animation/layer_animation_controller.h" 13 #include "cc/animation/layer_animation_controller.h"
15 #include "cc/animation/layer_animation_value_observer.h" 14 #include "cc/animation/layer_animation_value_observer.h"
16 #include "cc/base/cc_export.h" 15 #include "cc/base/cc_export.h"
17 #include "cc/base/region.h" 16 #include "cc/base/region.h"
17 #include "cc/base/scoped_ptr_vector.h"
18 #include "cc/layers/draw_properties.h" 18 #include "cc/layers/draw_properties.h"
19 #include "cc/layers/layer_lists.h" 19 #include "cc/layers/layer_lists.h"
20 #include "cc/layers/layer_position_constraint.h" 20 #include "cc/layers/layer_position_constraint.h"
21 #include "cc/layers/paint_properties.h" 21 #include "cc/layers/paint_properties.h"
22 #include "cc/layers/render_surface.h" 22 #include "cc/layers/render_surface.h"
23 #include "cc/trees/occlusion_tracker.h" 23 #include "cc/trees/occlusion_tracker.h"
24 #include "skia/ext/refptr.h" 24 #include "skia/ext/refptr.h"
25 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h" 25 #include "third_party/WebKit/Source/Platform/chromium/public/WebFilterOperations .h"
26 #include "third_party/skia/include/core/SkColor.h" 26 #include "third_party/skia/include/core/SkColor.h"
27 #include "third_party/skia/include/core/SkImageFilter.h" 27 #include "third_party/skia/include/core/SkImageFilter.h"
28 #include "ui/gfx/rect.h" 28 #include "ui/gfx/rect.h"
29 #include "ui/gfx/rect_f.h" 29 #include "ui/gfx/rect_f.h"
30 #include "ui/gfx/transform.h" 30 #include "ui/gfx/transform.h"
31 31
32 namespace WebKit { 32 namespace WebKit {
33 class WebAnimationDelegate; 33 class WebAnimationDelegate;
34 class WebLayerScrollClient; 34 class WebLayerScrollClient;
35 } 35 }
36 36
37 namespace cc { 37 namespace cc {
38 38
39 class Animation; 39 class Animation;
40 struct AnimationEvent; 40 struct AnimationEvent;
41 class CopyOutputRequest;
41 class LayerAnimationDelegate; 42 class LayerAnimationDelegate;
42 class LayerAnimationEventObserver; 43 class LayerAnimationEventObserver;
43 class LayerImpl; 44 class LayerImpl;
44 class LayerTreeHost; 45 class LayerTreeHost;
45 class LayerTreeImpl; 46 class LayerTreeImpl;
46 class PriorityCalculator; 47 class PriorityCalculator;
47 class RenderingStatsInstrumentation; 48 class RenderingStatsInstrumentation;
48 class ResourceUpdateQueue; 49 class ResourceUpdateQueue;
49 class ScrollbarLayer; 50 class ScrollbarLayer;
50 struct AnimationEvent; 51 struct AnimationEvent;
(...skipping 18 matching lines...) Expand all
69 void AddChild(scoped_refptr<Layer> child); 70 void AddChild(scoped_refptr<Layer> child);
70 void InsertChild(scoped_refptr<Layer> child, size_t index); 71 void InsertChild(scoped_refptr<Layer> child, size_t index);
71 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer); 72 void ReplaceChild(Layer* reference, scoped_refptr<Layer> new_layer);
72 void RemoveFromParent(); 73 void RemoveFromParent();
73 void RemoveAllChildren(); 74 void RemoveAllChildren();
74 void SetChildren(const LayerList& children); 75 void SetChildren(const LayerList& children);
75 76
76 const LayerList& children() const { return children_; } 77 const LayerList& children() const { return children_; }
77 Layer* child_at(size_t index) { return children_[index].get(); } 78 Layer* child_at(size_t index) { return children_[index].get(); }
78 79
79 typedef base::Callback<void(scoped_ptr<SkBitmap>)> 80 // This requests the layer and its subtree be rendered and given to the
80 RequestCopyAsBitmapCallback; 81 // callback. If the copy is unable to be produced (the layer is destroyed
81 82 // first), then the callback is called with a NULL/empty result.
82 // This requests the layer and its subtree be rendered into an SkBitmap and 83 void RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> request);
83 // call the given callback when the SkBitmap has been produced. If the copy 84 bool HasCopyRequest() const {
84 // is unable to be produced (the layer is destroyed first), then the callback 85 return !copy_requests_.empty();
85 // is called with a NULL bitmap.
86 void RequestCopyAsBitmap(RequestCopyAsBitmapCallback callback);
87 bool HasRequestCopyCallback() const {
88 return !request_copy_callbacks_.empty();
89 } 86 }
90 87
91 void SetAnchorPoint(gfx::PointF anchor_point); 88 void SetAnchorPoint(gfx::PointF anchor_point);
92 gfx::PointF anchor_point() const { return anchor_point_; } 89 gfx::PointF anchor_point() const { return anchor_point_; }
93 90
94 void SetAnchorPointZ(float anchor_point_z); 91 void SetAnchorPointZ(float anchor_point_z);
95 float anchor_point_z() const { return anchor_point_z_; } 92 float anchor_point_z() const { return anchor_point_z_; }
96 93
97 virtual void SetBackgroundColor(SkColor background_color); 94 virtual void SetBackgroundColor(SkColor background_color);
98 SkColor background_color() const { return background_color_; } 95 SkColor background_color() const { return background_color_; }
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
470 467
471 gfx::Transform transform_; 468 gfx::Transform transform_;
472 gfx::Transform sublayer_transform_; 469 gfx::Transform sublayer_transform_;
473 470
474 // Replica layer used for reflections. 471 // Replica layer used for reflections.
475 scoped_refptr<Layer> replica_layer_; 472 scoped_refptr<Layer> replica_layer_;
476 473
477 // Transient properties. 474 // Transient properties.
478 float raster_scale_; 475 float raster_scale_;
479 476
480 std::vector<RequestCopyAsBitmapCallback> request_copy_callbacks_; 477 ScopedPtrVector<CopyOutputRequest> copy_requests_;
481 478
482 WebKit::WebLayerScrollClient* layer_scroll_client_; 479 WebKit::WebLayerScrollClient* layer_scroll_client_;
483 480
484 DrawProperties<Layer, RenderSurface> draw_properties_; 481 DrawProperties<Layer, RenderSurface> draw_properties_;
485 482
486 PaintProperties paint_properties_; 483 PaintProperties paint_properties_;
487 484
488 DISALLOW_COPY_AND_ASSIGN(Layer); 485 DISALLOW_COPY_AND_ASSIGN(Layer);
489 }; 486 };
490 487
491 } // namespace cc 488 } // namespace cc
492 489
493 #endif // CC_LAYERS_LAYER_H_ 490 #endif // CC_LAYERS_LAYER_H_
OLDNEW
« no previous file with comments | « cc/cc_tests.gyp ('k') | cc/layers/layer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698