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

Side by Side Diff: skia/ext/cdl_picture_recorder.h

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 3 years, 12 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 | « skia/ext/cdl_picture_buffer.cc ('k') | skia/ext/cdl_picture_recorder.cc » ('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 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SKIA_EXT_CDL_PICTURE_RECORDER_H_
6 #define SKIA_EXT_CDL_PICTURE_RECORDER_H_
7
8 #include "cdl_common.h"
9
10 #if CDL_ENABLED
11
12 #include <stddef.h>
13 #include <stdint.h>
14
15 #include "base/compiler_specific.h"
16 #include "base/synchronization/lock.h"
17 #include "third_party/skia/include/core/SkCanvas.h"
18 #include "third_party/skia/include/core/SkBBHFactory.h"
19 #include "third_party/skia/include/core/SkPictureRecorder.h"
20
21 class CdlCanvas;
22 class CdlPictureBuffer;
23 class CdlPicture;
24 class CdlPictureRecordingCanvas;
25
26 class SK_API CdlPictureRecorder : SkNoncopyable {
27 public:
28 CdlPictureRecorder();
29 ~CdlPictureRecorder();
30
31 CdlCanvas* beginRecording(const SkRect& bounds,
32 SkBBHFactory* bbhFactory = NULL,
33 uint32_t recordFlags = 0);
34
35 CdlCanvas* beginRecording(SkScalar width,
36 SkScalar height,
37 SkBBHFactory* bbhFactory = NULL,
38 uint32_t recordFlags = 0) {
39 return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory,
40 recordFlags);
41 }
42
43 /** Returns the recording canvas if one is active, or NULL if recording is
44 not active. This does not alter the refcnt on the canvas (if present).
45 */
46 CdlCanvas* getRecordingCanvas();
47
48 sk_sp<CdlPicture> finishRecordingAsPicture(uint32_t endFlags = 0);
49
50 private:
51 void reset();
52
53 bool fActivelyRecording;
54 int start_offset_;
55 uint32_t fFlags;
56 SkRect fCullRect;
57
58 std::shared_ptr<CdlPictureRecordingCanvas> fRecorder;
59 sk_sp<CdlPictureBuffer> fRecord;
60
61 static base::Lock lock;
62 static std::shared_ptr<CdlPictureRecordingCanvas> free_recorder;
63 };
64
65 #else // CDL_ENABLED
66
67 #include "third_party/skia/include/core/SkPictureRecorder.h"
68
69 #endif // CDL_ENABLED
70
71 #endif // SKIA_EXT_CDL_PICTURE_RECORDER_H_
OLDNEW
« no previous file with comments | « skia/ext/cdl_picture_buffer.cc ('k') | skia/ext/cdl_picture_recorder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698