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

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

Issue 1112523006: Sketch splitting SkPicture into an interface and SkBigPicture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: check on all ops 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 | « src/core/SkLayerInfo.cpp ('k') | src/core/SkMiniRecorder.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 SkMiniRecorder_DEFINED
9 #define SkMiniRecorder_DEFINED
10
11 #include "SkRecords.h"
12 #include "SkScalar.h"
13 #include "SkTypes.h"
14 class SkCanvas;
15
16 // Records small pictures, but only a limited subset of the canvas API, and may fail.
17 class SkMiniRecorder : SkNoncopyable {
18 public:
19 SkMiniRecorder();
20 ~SkMiniRecorder();
21
22 // Try to record an op. Returns false on failure.
23 bool drawRect(const SkRect&, const SkPaint&);
24 bool drawPath(const SkPath&, const SkPaint&);
25 bool drawTextBlob(const SkTextBlob*, SkScalar x, SkScalar y, const SkPaint&) ;
26
27 // Detach anything we've recorded as a picture, resetting this SkMiniRecorde r.
28 SkPicture* detachAsPicture(const SkRect& cull);
29
30 private:
31 enum class State { kEmpty, kDrawRect, kDrawPath, kDrawTextBlob };
32
33 State fState;
34 SkAlignedSStorage<sizeof(SkRecords::DrawPath)> fBuffer;
jbroman 2015/05/07 19:38:25 Lacking constexpr std::max, maybe a trick like thi
35
36 static_assert(sizeof(SkRecords::DrawRect) <= sizeof(SkRecords::DrawPath) , "");
37 static_assert(sizeof(SkRecords::DrawTextBlob) <= sizeof(SkRecords::DrawPath) , "");
38 };
39
40 #endif//SkMiniRecorder_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkLayerInfo.cpp ('k') | src/core/SkMiniRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698