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

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

Issue 1130333002: 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
13 class SkBBoxHierarchy;
14 class SkRecord;
15
16 // An implementation of SkPicture supporting an arbitrary number of drawing comm ands.
17 class SkBigPicture final : public SkPicture {
18 public:
19 // AccelData provides a base class for device-specific acceleration data.
20 class AccelData : public SkRefCnt { };
21
22 // An array of refcounted const SkPicture pointers.
23 class SnapshotArray : ::SkNoncopyable {
24 public:
25 SnapshotArray(const SkPicture* pics[], int count) : fPics(pics), fCount( count) {}
26 ~SnapshotArray() { for (int i = 0; i < fCount; i++) { fPics[i]->unref(); } }
27
28 const SkPicture* const* begin() const { return fPics; }
29 int count() const { return fCount; }
30 private:
31 SkAutoTMalloc<const SkPicture*> fPics;
32 int fCount;
33 };
34
35 SkBigPicture(const SkRect& cull,
36 SkRecord*, // We take ownership of the caller's ref.
37 SnapshotArray*, // We take exclusive ownership.
38 SkBBoxHierarchy*, // We take ownership of the caller's ref.
39 AccelData*, // We take ownership of the caller's ref.
40 size_t approxBytesUsedBySubPictures);
41
42
43 // SkPicture overrides
44 void playback(SkCanvas*, AbortCallback*) const override;
45 SkRect cullRect() const override;
46 bool hasText() const override;
47 bool willPlayBackBitmaps() const override;
48 int approximateOpCount() const override;
49 size_t approximateBytesUsed() const override;
50 bool suitableForGpuRasterization(GrContext*, const char** whyNot) const over ride;
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 struct PathCounter;
74
75 int numSlowPaths() const override;
76
77 int drawableCount() const;
78 SkPicture const* const* drawablePicts() const;
79
80 const SkRect fCullRect;
81 const Analysis fAnalysis;
82 const size_t fApproxBytesUsedBySubPictures;
83 SkAutoTUnref<const SkRecord> fRecord;
84 SkAutoTDelete<const SnapshotArray> fDrawablePicts;
85 SkAutoTUnref<const SkBBoxHierarchy> fBBH;
86 SkAutoTUnref<const AccelData> fAccelData;
87 };
88
89 #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