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

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

Issue 14301021: cc: Don't pass simple well-defined classes by reference. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/quads/shared_quad_state.cc ('k') | cc/resources/picture.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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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_PICTURE_H_ 5 #ifndef CC_RESOURCES_PICTURE_H_
6 #define CC_RESOURCES_PICTURE_H_ 6 #define CC_RESOURCES_PICTURE_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 class ContentLayerClient; 27 class ContentLayerClient;
28 struct RenderingStats; 28 struct RenderingStats;
29 29
30 class CC_EXPORT Picture 30 class CC_EXPORT Picture
31 : public base::RefCountedThreadSafe<Picture> { 31 : public base::RefCountedThreadSafe<Picture> {
32 public: 32 public:
33 static scoped_refptr<Picture> Create(gfx::Rect layer_rect); 33 static scoped_refptr<Picture> Create(gfx::Rect layer_rect);
34 static scoped_refptr<Picture> CreateFromBase64String( 34 static scoped_refptr<Picture> CreateFromBase64String(
35 const std::string& encoded_string); 35 const std::string& encoded_string);
36 36
37 const gfx::Rect& LayerRect() const { return layer_rect_; } 37 gfx::Rect LayerRect() const { return layer_rect_; }
38 const gfx::Rect& OpaqueRect() const { return opaque_rect_; } 38 gfx::Rect OpaqueRect() const { return opaque_rect_; }
39 39
40 // Get thread-safe clone for rasterizing with on a specific thread. 40 // Get thread-safe clone for rasterizing with on a specific thread.
41 scoped_refptr<Picture> GetCloneForDrawingOnThread( 41 scoped_refptr<Picture> GetCloneForDrawingOnThread(
42 unsigned thread_index) const; 42 unsigned thread_index) const;
43 43
44 // Make thread-safe clones for rasterizing with. 44 // Make thread-safe clones for rasterizing with.
45 void CloneForDrawing(int num_threads); 45 void CloneForDrawing(int num_threads);
46 46
47 // Record a paint operation. To be able to safely use this SkPicture for 47 // Record a paint operation. To be able to safely use this SkPicture for
48 // playback on a different thread this can only be called once. 48 // playback on a different thread this can only be called once.
49 void Record(ContentLayerClient*, RenderingStats*, 49 void Record(ContentLayerClient*, RenderingStats*,
50 const SkTileGridPicture::TileGridInfo& tile_grid_info); 50 const SkTileGridPicture::TileGridInfo& tile_grid_info);
51 51
52 // Has Record() been called yet? 52 // Has Record() been called yet?
53 bool HasRecording() const { return picture_.get() != NULL; } 53 bool HasRecording() const { return picture_.get() != NULL; }
54 54
55 // Apply this contents scale and raster the content rect into the canvas. 55 // Apply this contents scale and raster the content rect into the canvas.
56 void Raster(SkCanvas* canvas, 56 void Raster(SkCanvas* canvas,
57 gfx::Rect content_rect, 57 gfx::Rect content_rect,
58 float contents_scale, 58 float contents_scale,
59 bool enable_lcd_text); 59 bool enable_lcd_text);
60 60
61 void GatherPixelRefs( 61 void GatherPixelRefs(
62 const gfx::Rect& layer_rect, 62 gfx::Rect layer_rect,
63 std::list<skia::LazyPixelRef*>& pixel_ref_list); 63 std::list<skia::LazyPixelRef*>& pixel_ref_list);
64 64
65 void AsBase64String(std::string* output) const; 65 void AsBase64String(std::string* output) const;
66 66
67 private: 67 private:
68 explicit Picture(gfx::Rect layer_rect); 68 explicit Picture(gfx::Rect layer_rect);
69 Picture(const std::string& encoded_string, bool* success); 69 Picture(const std::string& encoded_string, bool* success);
70 // This constructor assumes SkPicture is already ref'd and transfers 70 // This constructor assumes SkPicture is already ref'd and transfers
71 // ownership to this picture. 71 // ownership to this picture.
72 Picture(const skia::RefPtr<SkPicture>&, 72 Picture(const skia::RefPtr<SkPicture>&,
73 gfx::Rect layer_rect, 73 gfx::Rect layer_rect,
74 gfx::Rect opaque_rect); 74 gfx::Rect opaque_rect);
75 ~Picture(); 75 ~Picture();
76 76
77 gfx::Rect layer_rect_; 77 gfx::Rect layer_rect_;
78 gfx::Rect opaque_rect_; 78 gfx::Rect opaque_rect_;
79 skia::RefPtr<SkPicture> picture_; 79 skia::RefPtr<SkPicture> picture_;
80 80
81 typedef std::vector<scoped_refptr<Picture> > PictureVector; 81 typedef std::vector<scoped_refptr<Picture> > PictureVector;
82 PictureVector clones_; 82 PictureVector clones_;
83 83
84 friend class base::RefCountedThreadSafe<Picture>; 84 friend class base::RefCountedThreadSafe<Picture>;
85 DISALLOW_COPY_AND_ASSIGN(Picture); 85 DISALLOW_COPY_AND_ASSIGN(Picture);
86 }; 86 };
87 87
88 } // namespace cc 88 } // namespace cc
89 89
90 #endif // CC_RESOURCES_PICTURE_H_ 90 #endif // CC_RESOURCES_PICTURE_H_
OLDNEW
« no previous file with comments | « cc/quads/shared_quad_state.cc ('k') | cc/resources/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698