Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(490)

Side by Side Diff: src/core/SkBigPicture.h

Issue 1130283004: Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/utils/SkPictureUtils.h ('k') | src/core/SkBigPicture.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
11 #include "SkPicture.h"
12 #include "SkLazyPtr.h"
13
14 class SkBBoxHierarchy;
15 class SkRecord;
16
17 // An implementation of SkPicture supporting an arbitrary number of drawing comm ands.
18 class SkBigPicture final : public SkPicture {
19 public:
20 // AccelData provides a base class for device-specific acceleration data.
21 class AccelData : public SkRefCnt { };
22
23 // An array of refcounted const SkPicture pointers.
24 class SnapshotArray : ::SkNoncopyable {
25 public:
26 SnapshotArray(const SkPicture* pics[], int count) : fPics(pics), fCount( count) {}
27 ~SnapshotArray() { for (int i = 0; i < fCount; i++) { fPics[i]->unref(); } }
28
29 const SkPicture* const* begin() const { return fPics; }
30 int count() const { return fCount; }
31 private:
32 SkAutoTMalloc<const SkPicture*> fPics;
33 int fCount;
34 };
35
36 SkBigPicture(const SkRect& cull,
37 SkRecord*, // We take ownership of the caller's ref.
38 SnapshotArray*, // We take exclusive ownership.
39 SkBBoxHierarchy*, // We take ownership of the caller's ref.
40 AccelData*, // We take ownership of the caller's ref.
41 size_t approxBytesUsedBySubPictures);
42
43
44 // SkPicture overrides
45 void playback(SkCanvas*, AbortCallback*) const override;
46 SkRect cullRect() const override;
47 bool hasText() const override;
48 bool willPlayBackBitmaps() const override;
49 int approximateOpCount() const override;
50 size_t approximateBytesUsed() const override;
51 const SkBigPicture* asSkBigPicture() const override { return this; }
52
53 // Used by GrLayerHoister
54 void partialPlayback(SkCanvas*,
55 unsigned start,
56 unsigned stop,
57 const SkMatrix& initialCTM) const;
58 // Used by GrRecordReplaceDraw
59 const SkBBoxHierarchy* bbh() const { return fBBH; }
60 const SkRecord* record() const { return fRecord; }
61 const AccelData* accelData() const { return fAccelData; }
62
63 private:
64 struct Analysis {
65 explicit Analysis(const SkRecord&);
66
67 bool suitableForGpuRasterization(const char** reason) const;
68
69 uint8_t fNumSlowPathsAndDashEffects;
70 bool fWillPlaybackBitmaps : 1;
71 bool fHasText : 1;
72 };
73
74 int numSlowPaths() const override;
75 const Analysis& analysis() const;
76 int drawableCount() const;
77 SkPicture const* const* drawablePicts() const;
78
79 const SkRect fCullRect;
80 const size_t fApproxBytesUsedBySubPictures;
81 SkLazyPtr<const Analysis> fAnalysis;
82 SkAutoTUnref<const SkRecord> fRecord;
83 SkAutoTDelete<const SnapshotArray> fDrawablePicts;
84 SkAutoTUnref<const SkBBoxHierarchy> fBBH;
85 SkAutoTUnref<const AccelData> fAccelData;
86 };
87
88 #endif//SkBigPicture_DEFINED
OLDNEW
« no previous file with comments | « include/utils/SkPictureUtils.h ('k') | src/core/SkBigPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698