blob: 3cd593d2e45ec1201556edadfc6b424841f455c5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CC_PICTURE_PILE_IMPL_H_
#define CC_PICTURE_PILE_IMPL_H_
#include <list>
#include <map>
#include "base/threading/thread.h"
#include "cc/cc_export.h"
#include "cc/picture_pile_base.h"
#include "skia/ext/refptr.h"
#include "third_party/skia/include/core/SkPicture.h"
namespace cc {
struct RenderingStats;
class CC_EXPORT PicturePileImpl : public PicturePileBase {
public:
static scoped_refptr<PicturePileImpl> Create();
// Get paint-safe version of this picture for a specific thread.
PicturePileImpl* GetCloneForDrawingOnThread(base::Thread*);
// Clone a paint-safe version of this picture.
scoped_refptr<PicturePileImpl> CloneForDrawing() const;
// Raster a subrect of this PicturePileImpl into the given canvas.
// It's only safe to call paint on a cloned version.
// It is assumed that contentsScale has already been applied to this canvas.
void Raster(
SkCanvas* canvas,
gfx::Rect content_rect,
float contents_scale,
RenderingStats* stats);
void GatherPixelRefs(
gfx::Rect content_rect,
float contents_scale,
std::list<skia::LazyPixelRef*>& pixel_refs);
void PushPropertiesTo(PicturePileImpl* other);
skia::RefPtr<SkPicture> GetFlattenedPicture();
void set_slow_down_raster_scale_factor(int factor) {
slow_down_raster_scale_factor_for_debug_ = factor;
}
protected:
friend class PicturePile;
PicturePileImpl();
virtual ~PicturePileImpl();
typedef std::map<base::PlatformThreadId, scoped_refptr<PicturePileImpl> >
CloneMap;
CloneMap clones_;
int slow_down_raster_scale_factor_for_debug_;
DISALLOW_COPY_AND_ASSIGN(PicturePileImpl);
};
} // namespace cc
#endif // CC_PICTURE_PILE_IMPL_H_
|