Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
SkBigPicture.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef SkBigPicture_DEFINED
9#define SkBigPicture_DEFINED
10
13#include "include/core/SkRect.h"
17#include "src/core/SkRecord.h"
18
19#include <cstddef>
20#include <memory>
21
22class SkCanvas;
23
24// An implementation of SkPicture supporting an arbitrary number of drawing commands.
25// This is called "big" because there used to be a "mini" that only supported a subset of the
26// calls as an optimization.
27class SkBigPicture final : public SkPicture {
28public:
29 // An array of refcounted const SkPicture pointers.
31 public:
32 SnapshotArray(const SkPicture* pics[], int count) : fPics(pics), fCount(count) {}
33 ~SnapshotArray() { for (int i = 0; i < fCount; i++) { fPics[i]->unref(); } }
34
35 const SkPicture* const* begin() const { return fPics; }
36 int count() const { return fCount; }
37 private:
39 int fCount;
40 };
41
42 SkBigPicture(const SkRect& cull,
44 std::unique_ptr<SnapshotArray>,
46 size_t approxBytesUsedBySubPictures);
47
48
49// SkPicture overrides
50 void playback(SkCanvas*, AbortCallback*) const override;
51 SkRect cullRect() const override;
52 int approximateOpCount(bool nested) const override;
53 size_t approximateBytesUsed() const override;
54 const SkBigPicture* asSkBigPicture() const override { return this; }
55
56// Used by GrRecordReplaceDraw
57 const SkBBoxHierarchy* bbh() const { return fBBH.get(); }
58 const SkRecord* record() const { return fRecord.get(); }
59
60private:
61 int drawableCount() const;
62 SkPicture const* const* drawablePicts() const;
63
64 const SkRect fCullRect;
65 const size_t fApproxBytesUsedBySubPictures;
67 std::unique_ptr<const SnapshotArray> fDrawablePicts;
69};
70
71#endif//SkBigPicture_DEFINED
SnapshotArray(const SkPicture *pics[], int count)
const SkPicture *const * begin() const
const SkRecord * record() const
SkRect cullRect() const override
const SkBigPicture * asSkBigPicture() const override
void playback(SkCanvas *, AbortCallback *) const override
const SkBBoxHierarchy * bbh() const
size_t approximateBytesUsed() const override
int approximateOpCount(bool nested) const override
friend class SkBigPicture
Definition SkPicture.h:253
T * get() const
Definition SkRefCnt.h:303