FileSystem mods: Changes to snapshot file creation to remove dependencies on blobs.
[chromium-blink-merge.git] / cc / picture_pile_impl.h
blob157f9e21e6280d5a7a8ae423145caa45d92af43b
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.
5 #ifndef CC_PICTURE_PILE_IMPL_H_
6 #define CC_PICTURE_PILE_IMPL_H_
8 #include <list>
9 #include <map>
11 #include "base/threading/thread.h"
12 #include "cc/cc_export.h"
13 #include "cc/picture_pile_base.h"
14 #include "skia/ext/refptr.h"
15 #include "third_party/skia/include/core/SkPicture.h"
17 namespace cc {
18 struct RenderingStats;
20 class CC_EXPORT PicturePileImpl : public PicturePileBase {
21 public:
22 static scoped_refptr<PicturePileImpl> Create();
24 // Get paint-safe version of this picture for a specific thread.
25 PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*);
27 // Clone a paint-safe version of this picture.
28 scoped_refptr<PicturePileImpl> CloneForDrawing() const;
30 // Raster a subrect of this PicturePileImpl into the given canvas.
31 // It's only safe to call paint on a cloned version.
32 // It is assumed that contentsScale has already been applied to this canvas.
33 void Raster(
34 SkCanvas* canvas,
35 gfx::Rect content_rect,
36 float contents_scale,
37 int64* total_pixels_rasterized);
39 void GatherPixelRefs(
40 gfx::Rect content_rect,
41 float contents_scale,
42 std::list<skia::LazyPixelRef*>& pixel_refs);
44 void PushPropertiesTo(PicturePileImpl* other);
46 skia::RefPtr<SkPicture> GetFlattenedPicture();
48 void set_slow_down_raster_scale_factor(int factor) {
49 slow_down_raster_scale_factor_for_debug_ = factor;
52 bool IsCheapInRect(gfx::Rect content_rect, float contents_scale) const;
54 protected:
55 friend class PicturePile;
57 PicturePileImpl();
58 virtual ~PicturePileImpl();
60 typedef std::map<base::PlatformThreadId, scoped_refptr<PicturePileImpl> >
61 CloneMap;
62 CloneMap clones_;
64 int slow_down_raster_scale_factor_for_debug_;
66 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
69 } // namespace cc
71 #endif // CC_PICTURE_PILE_IMPL_H_