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

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

Issue 14230007: cc: Do GatherPixelRefs from skia at record time (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update to hash_map 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
« no previous file with comments | « no previous file | cc/resources/picture.cc » ('j') | cc/resources/picture.cc » ('J')
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 <utility>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/hash_tables.h"
12 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
13 #include "cc/base/cc_export.h" 15 #include "cc/base/cc_export.h"
16 #include "cc/base/hash_pair.h"
14 #include "skia/ext/lazy_pixel_ref.h" 17 #include "skia/ext/lazy_pixel_ref.h"
15 #include "skia/ext/refptr.h" 18 #include "skia/ext/refptr.h"
16 #include "third_party/skia/include/core/SkPixelRef.h" 19 #include "third_party/skia/include/core/SkPixelRef.h"
17 #include "third_party/skia/include/core/SkTileGridPicture.h" 20 #include "third_party/skia/include/core/SkTileGridPicture.h"
18 #include "ui/gfx/rect.h" 21 #include "ui/gfx/rect.h"
19 22
20 namespace skia { 23 namespace skia {
21 class AnalysisCanvas; 24 class AnalysisCanvas;
22 } 25 }
23 26
(...skipping 29 matching lines...) Expand all
53 void Raster(SkCanvas* canvas, 56 void Raster(SkCanvas* canvas,
54 gfx::Rect content_rect, 57 gfx::Rect content_rect,
55 float contents_scale, 58 float contents_scale,
56 bool enable_lcd_text); 59 bool enable_lcd_text);
57 60
58 void GatherPixelRefs( 61 void GatherPixelRefs(
59 const gfx::Rect& layer_rect, 62 const gfx::Rect& layer_rect,
60 std::list<skia::LazyPixelRef*>& pixel_ref_list); 63 std::list<skia::LazyPixelRef*>& pixel_ref_list);
61 64
62 private: 65 private:
66 typedef base::hash_map<
67 std::pair<int, int>,
68 std::list<skia::LazyPixelRef*> > PixelRefsMap;
69
63 explicit Picture(gfx::Rect layer_rect); 70 explicit Picture(gfx::Rect layer_rect);
64 // This constructor assumes SkPicture is already ref'd and transfers 71 // This constructor assumes SkPicture is already ref'd and transfers
65 // ownership to this picture. 72 // ownership to this picture.
66 Picture(const skia::RefPtr<SkPicture>&, 73 Picture(const skia::RefPtr<SkPicture>&,
67 gfx::Rect layer_rect, 74 gfx::Rect layer_rect,
68 gfx::Rect opaque_rect); 75 gfx::Rect opaque_rect,
76 const PixelRefsMap& lazy_pixel_refs);
69 ~Picture(); 77 ~Picture();
70 78
79 void GatherPixelRefsFromSkia(
80 const gfx::Rect& layer_rect,
81 std::list<skia::LazyPixelRef*>& pixel_ref_list);
82 void GatherAllPixelRefs();
83
71 gfx::Rect layer_rect_; 84 gfx::Rect layer_rect_;
72 gfx::Rect opaque_rect_; 85 gfx::Rect opaque_rect_;
73 skia::RefPtr<SkPicture> picture_; 86 skia::RefPtr<SkPicture> picture_;
74 87
75 typedef std::vector<scoped_refptr<Picture> > PictureVector; 88 typedef std::vector<scoped_refptr<Picture> > PictureVector;
76 PictureVector clones_; 89 PictureVector clones_;
77 90
91 PixelRefsMap lazy_pixel_refs_;
92
78 friend class base::RefCountedThreadSafe<Picture>; 93 friend class base::RefCountedThreadSafe<Picture>;
79 DISALLOW_COPY_AND_ASSIGN(Picture); 94 DISALLOW_COPY_AND_ASSIGN(Picture);
80 }; 95 };
81 96
82 } // namespace cc 97 } // namespace cc
83 98
84 #endif // CC_RESOURCES_PICTURE_H_ 99 #endif // CC_RESOURCES_PICTURE_H_
OLDNEW
« no previous file with comments | « no previous file | cc/resources/picture.cc » ('j') | cc/resources/picture.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698