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_
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"
18 struct RenderingStats
;
20 class CC_EXPORT PicturePileImpl
: public PicturePileBase
{
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.
35 gfx::Rect content_rect
,
37 int64
* total_pixels_rasterized
);
40 gfx::Rect content_rect
,
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;
55 friend class PicturePile
;
58 virtual ~PicturePileImpl();
60 typedef std::map
<base::PlatformThreadId
, scoped_refptr
<PicturePileImpl
> >
64 int slow_down_raster_scale_factor_for_debug_
;
66 DISALLOW_COPY_AND_ASSIGN(PicturePileImpl
);
71 #endif // CC_PICTURE_PILE_IMPL_H_