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

Side by Side Diff: cc/picture.h

Issue 12471007: Part 8 of cc/ directory shuffles: resources (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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/output/renderer.h ('k') | cc/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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CC_PICTURE_H_
6 #define CC_PICTURE_H_
7
8 #include <list>
9
10 #include "base/basictypes.h"
11 #include "base/memory/ref_counted.h"
12 #include "cc/base/cc_export.h"
13 #include "skia/ext/lazy_pixel_ref.h"
14 #include "skia/ext/refptr.h"
15 #include "third_party/skia/include/core/SkPixelRef.h"
16 #include "third_party/skia/include/core/SkTileGridPicture.h"
17 #include "ui/gfx/rect.h"
18
19 namespace skia {
20 class AnalysisCanvas;
21 }
22
23 namespace cc {
24
25 class ContentLayerClient;
26 struct RenderingStats;
27
28 class CC_EXPORT Picture
29 : public base::RefCountedThreadSafe<Picture> {
30 public:
31 static scoped_refptr<Picture> Create(gfx::Rect layer_rect);
32
33 const gfx::Rect& LayerRect() const { return layer_rect_; }
34 const gfx::Rect& OpaqueRect() const { return opaque_rect_; }
35
36 // Get thread-safe clone for rasterizing with on a specific thread.
37 scoped_refptr<Picture> GetCloneForDrawingOnThread(
38 unsigned thread_index) const;
39
40 // Make thread-safe clones for rasterizing with.
41 void CloneForDrawing(int num_threads);
42
43 // Record a paint operation. To be able to safely use this SkPicture for
44 // playback on a different thread this can only be called once.
45 void Record(ContentLayerClient*, RenderingStats*,
46 const SkTileGridPicture::TileGridInfo& tileGridInfo);
47
48 // Has Record() been called yet?
49 bool HasRecording() const { return picture_.get() != NULL; }
50
51 // Apply this contents scale and raster the content rect into the canvas.
52 void Raster(SkCanvas* canvas, gfx::Rect content_rect, float contents_scale);
53
54 void GatherPixelRefs(
55 const gfx::Rect& layer_rect,
56 std::list<skia::LazyPixelRef*>& pixel_ref_list);
57
58 private:
59 Picture(gfx::Rect layer_rect);
60 // This constructor assumes SkPicture is already ref'd and transfers
61 // ownership to this picture.
62 Picture(const skia::RefPtr<SkPicture>&,
63 gfx::Rect layer_rect,
64 gfx::Rect opaque_rect);
65 ~Picture();
66
67 gfx::Rect layer_rect_;
68 gfx::Rect opaque_rect_;
69 skia::RefPtr<SkPicture> picture_;
70
71 typedef std::vector<scoped_refptr<Picture> > PictureVector;
72 PictureVector clones_;
73
74 friend class base::RefCountedThreadSafe<Picture>;
75 DISALLOW_COPY_AND_ASSIGN(Picture);
76 };
77
78 } // namespace cc
79
80 #endif // CC_PICTURE_H_
OLDNEW
« no previous file with comments | « cc/output/renderer.h ('k') | cc/picture.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698