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

Side by Side Diff: cc/picture_pile_impl.h

Issue 12316084: cc: Consolidate the analysis_canvas operations (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed unused vars 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
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_PICTURE_PILE_IMPL_H_ 5 #ifndef CC_PICTURE_PILE_IMPL_H_
6 #define CC_PICTURE_PILE_IMPL_H_ 6 #define CC_PICTURE_PILE_IMPL_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 10
11 #include "base/threading/thread.h" 11 #include "base/threading/thread.h"
12 #include "cc/cc_export.h" 12 #include "cc/cc_export.h"
13 #include "cc/picture_pile_base.h" 13 #include "cc/picture_pile_base.h"
14 #include "skia/ext/refptr.h" 14 #include "skia/ext/refptr.h"
15 #include "third_party/skia/include/core/SkPicture.h" 15 #include "third_party/skia/include/core/SkPicture.h"
16 16
17 namespace cc { 17 namespace cc {
18 struct RenderingStats; 18 struct RenderingStats;
19 19
20 class CC_EXPORT PicturePileImpl : public PicturePileBase { 20 class CC_EXPORT PicturePileImpl : public PicturePileBase {
21 public: 21 public:
22
23 class Analysis {
reveman 2013/02/28 21:23:10 can we move this or just use the Picture::Analysis
24 public:
25 Analysis();
26
27 bool is_solid_color() const {
28 return is_analyzed_ && is_solid_color_;
29 }
30
31 SkColor get_solid_color() const {
32 DCHECK(is_solid_color());
33 return solid_color_;
34 }
35
36 bool is_transparent() const {
37 return is_analyzed_ && is_transparent_;
38 }
39
40 bool is_cheap_to_raster() const {
41 return is_analyzed_ && is_cheap_to_raster_;
42 }
43
44 private:
45 friend class PicturePileImpl;
46
47 bool is_solid_color_;
48 bool is_transparent_;
49 bool is_cheap_to_raster_;
50 bool is_analyzed_;
reveman 2013/02/28 21:23:10 why do you need this flag? can't you just initiali
51 SkColor solid_color_;
52 };
53
22 static scoped_refptr<PicturePileImpl> Create(); 54 static scoped_refptr<PicturePileImpl> Create();
23 55
24 // Get paint-safe version of this picture for a specific thread. 56 // Get paint-safe version of this picture for a specific thread.
25 PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*); 57 PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*);
26 58
27 // Clone a paint-safe version of this picture. 59 // Clone a paint-safe version of this picture.
28 scoped_refptr<PicturePileImpl> CloneForDrawing() const; 60 scoped_refptr<PicturePileImpl> CloneForDrawing() const;
29 61
30 // Raster a subrect of this PicturePileImpl into the given canvas. 62 // Raster a subrect of this PicturePileImpl into the given canvas.
31 // It's only safe to call paint on a cloned version. 63 // It's only safe to call paint on a cloned version.
(...skipping 10 matching lines...) Expand all
42 std::list<skia::LazyPixelRef*>& pixel_refs); 74 std::list<skia::LazyPixelRef*>& pixel_refs);
43 75
44 void PushPropertiesTo(PicturePileImpl* other); 76 void PushPropertiesTo(PicturePileImpl* other);
45 77
46 skia::RefPtr<SkPicture> GetFlattenedPicture(); 78 skia::RefPtr<SkPicture> GetFlattenedPicture();
47 79
48 void set_slow_down_raster_scale_factor(int factor) { 80 void set_slow_down_raster_scale_factor(int factor) {
49 slow_down_raster_scale_factor_for_debug_ = factor; 81 slow_down_raster_scale_factor_for_debug_ = factor;
50 } 82 }
51 83
52 bool IsCheapInRect(gfx::Rect content_rect, float contents_scale) const; 84 void AnalyzeInRect(const gfx::Rect& content_rect,
85 float contents_scale,
86 Analysis* analysis);
53 87
54 protected: 88 protected:
55 friend class PicturePile; 89 friend class PicturePile;
56 90
57 PicturePileImpl(); 91 PicturePileImpl();
58 virtual ~PicturePileImpl(); 92 virtual ~PicturePileImpl();
59 93
60 typedef std::map<base::PlatformThreadId, scoped_refptr<PicturePileImpl> > 94 typedef std::map<base::PlatformThreadId, scoped_refptr<PicturePileImpl> >
61 CloneMap; 95 CloneMap;
62 CloneMap clones_; 96 CloneMap clones_;
63 97
64 int slow_down_raster_scale_factor_for_debug_; 98 int slow_down_raster_scale_factor_for_debug_;
65 99
66 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl); 100 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
67 }; 101 };
68 102
69 } // namespace cc 103 } // namespace cc
70 104
71 #endif // CC_PICTURE_PILE_IMPL_H_ 105 #endif // CC_PICTURE_PILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698