Skia
2D Graphics Library
SkPictureRecorder.h
Go to the documentation of this file.
1 /*
2  * Copyright 2014 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 SkPictureRecorder_DEFINED
9 #define SkPictureRecorder_DEFINED
10 
12 #include "include/core/SkPicture.h"
13 #include "include/core/SkRefCnt.h"
14 
15 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
16 namespace android {
17  class Picture;
18 };
19 #endif
20 
21 class SkCanvas;
22 class SkDrawable;
23 class SkMiniRecorder;
24 class SkPictureRecord;
25 class SkRecord;
26 class SkRecorder;
27 
29 public:
32 
33  enum FinishFlags {
34  };
35 
44 
45  SkCanvas* beginRecording(const SkRect& bounds, SkBBHFactory* bbhFactory = nullptr);
46 
48  SkBBHFactory* bbhFactory = nullptr) {
49  return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory);
50  }
51 
56 
68 
79 
91 
92 private:
93  void reset();
94 
98 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK
99  friend class android::Picture;
100 #endif
101  friend class SkPictureRecorderReplayTester; // for unit testing
102  void partialReplay(SkCanvas* canvas) const;
103 
104  bool fActivelyRecording;
105  SkRect fCullRect;
107  std::unique_ptr<SkRecorder> fRecorder;
108  sk_sp<SkRecord> fRecord;
109  std::unique_ptr<SkMiniRecorder> fMiniRecorder;
110 
112  SkPictureRecorder& operator=(SkPictureRecorder&&) = delete;
113 };
114 
115 #endif
SkPictureRecorder::~SkPictureRecorder
~SkPictureRecorder()
SkPictureRecorder::finishRecordingAsDrawable
sk_sp< SkDrawable > finishRecordingAsDrawable()
Signal that the caller is done recording.
SkBBHFactory
Definition: SkBBHFactory.h:44
SkRect::MakeWH
static constexpr SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h)
Returns constructed SkRect set to SkScalar values (0, 0, w, h).
Definition: SkRect.h:599
SkPictureRecorder::FinishFlags
FinishFlags
Definition: SkPictureRecorder.h:33
SkRefCnt.h
sk_sp< SkBBoxHierarchy >
SkPictureRecorder::finishRecordingAsPicture
sk_sp< SkPicture > finishRecordingAsPicture()
Signal that the caller is done recording.
SkPictureRecorder
Definition: SkPictureRecorder.h:28
SK_API
#define SK_API
Definition: SkTypes.h:181
SkPictureRecorder::beginRecording
SkCanvas * beginRecording(const SkRect &bounds, sk_sp< SkBBoxHierarchy > bbh)
Returns the canvas that records the drawing commands.
SkPictureRecorder::beginRecording
SkCanvas * beginRecording(const SkRect &bounds, SkBBHFactory *bbhFactory=nullptr)
SkPictureRecorder::SkPictureRecorder
SkPictureRecorder()
SkPictureRecorder::beginRecording
SkCanvas * beginRecording(SkScalar width, SkScalar height, SkBBHFactory *bbhFactory=nullptr)
Definition: SkPictureRecorder.h:47
SkCanvas
Definition: SkCanvas.h:87
SkDrawable
Base-class for objects that draw into SkCanvas.
Definition: SkDrawable.h:29
SkScalar
float SkScalar
Definition: SkScalar.h:16
SkPicture.h
SkPictureRecorder::getRecordingCanvas
SkCanvas * getRecordingCanvas()
Returns the recording canvas if one is active, or NULL if recording is not active.
SkRect
Definition: SkRect.h:572
SkPictureRecorder::finishRecordingAsPictureWithCull
sk_sp< SkPicture > finishRecordingAsPictureWithCull(const SkRect &cullRect)
Signal that the caller is done recording, and update the cull rect to use for bounding box hierarchy ...
SkBBHFactory.h