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_H_
6 #define CC_PICTURE_PILE_H_
8 #include "base/basictypes.h"
9 #include "cc/cc_export.h"
10 #include "cc/picture.h"
11 #include "cc/region.h"
12 #include "cc/scoped_ptr_vector.h"
13 #include "ui/gfx/rect.h"
14 #include "ui/gfx/size.h"
18 struct RenderingStats
;
20 class CC_EXPORT PicturePile
{
25 // Mark a portion of the PicturePile as invalid and needing to be re-recorded
26 // the next time update is called.
27 void Invalidate(gfx::Rect
);
29 // Resize the PicturePile, invalidating / dropping recorded pictures as necessary.
30 void Resize(gfx::Size
);
32 // Re-record parts of the picture that are invalid.
33 void Update(ContentLayerClient
* painter
, RenderingStats
&);
35 // Update other with a shallow copy of this (main => compositor thread commit)
36 void PushPropertiesTo(PicturePile
& other
);
38 // Clone a paint-safe version of this picture (with cloned PicturePileRecords)
39 scoped_ptr
<PicturePile
> CloneForDrawing();
41 // Raster a subrect of this PicturePile into the given canvas.
42 // It's only safe to call paint on a cloned version.
43 // It is assumed that contentsScale has already been applied to this canvas.
44 void Raster(SkCanvas
* canvas
, gfx::Rect rect
);
47 void CopyAllButPile(PicturePile
& from
, PicturePile
& to
);
49 std::vector
<scoped_refptr
<Picture
> > pile_
;
52 Region prev_invalidation_
;
54 DISALLOW_COPY_AND_ASSIGN(PicturePile
);
59 #endif // CC_PICTURE_PILE_H_