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

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

Issue 2523673004: [NOT FOR COMMIT] Fully replace SkCanvas uses.
Patch Set: Support Android build. Created 4 years 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.cc ('k') | skia/ext/cdl_picture_buffer.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_BUFFER_H_
6 #define SKIA_EXT_CDL_PICTURE_BUFFER_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
17 #include "third_party/skia/include/core/SkCanvas.h"
18 #include "third_party/skia/include/core/SkPaint.h"
19 #include "third_party/skia/include/core/SkPath.h"
20 #include "third_party/skia/include/core/SkDrawable.h"
21 #include "third_party/skia/include/core/SkRect.h"
22 #include "third_party/skia/include/private/SkTDArray.h"
23
24 class CdlCanvas;
25 class CdlPaint;
26 class CdlPicture;
27
28 class CdlPictureBuffer : public SkRefCnt /*public SkDrawable*/ {
29 public:
30 CdlPictureBuffer(SkRect bounds);
31 ~CdlPictureBuffer() override;
32
33 // Prepares to append new picture to same record.
34 void resetForNextPicture(SkRect bounds);
35
36 // Discards full contents.
37 void reset(SkRect);
38
39 void makeThreadsafe();
40 bool empty() const { return fUsed == 0; }
41 int getRecordOffset() { return fUsed; }
42
43 void playback(CdlCanvas*, int start_offset, int end_offset);
44
45 SkRect getBounds();
46
47 // Draws as if...
48 // SkRect bounds = this->getBounds();
49 // canvas->saveLayer(&bounds, paint);
50 // this->draw(canvas, matrix);
51 // canvas->restore();
52 void drawAsLayer(CdlCanvas*, const SkMatrix*, const SkPaint*);
53
54 void save();
55 void saveLayer(const SkRect*,
56 const CdlPaint*,
57 const SkImageFilter*,
58 SkCanvas::SaveLayerFlags);
59 void restore();
60
61 void concat(const SkMatrix&);
62 void setMatrix(const SkMatrix&);
63 void translate(SkScalar, SkScalar);
64
65 void clipPath(const SkPath&, SkCanvas::ClipOp, bool aa);
66 void clipRect(const SkRect&, SkCanvas::ClipOp, bool aa);
67 void clipRRect(const SkRRect&, SkCanvas::ClipOp, bool aa);
68 void clipRegion(const SkRegion&, SkCanvas::ClipOp);
69
70 void drawPaint(const CdlPaint&);
71 void drawPath(const SkPath&, const CdlPaint&);
72 void drawRect(const SkRect&, const CdlPaint&);
73 void drawRRect(const SkRRect&, const CdlPaint&);
74 void drawDRRect(const SkRRect&, const SkRRect&, const CdlPaint&);
75 void drawOval(const SkRect&, const CdlPaint&);
76
77 void drawAnnotation(const SkRect&, const char*, SkData*);
78 void drawPicture(const CdlPicture*, const SkMatrix*, const CdlPaint*);
79
80 void drawText(const void*, size_t, SkScalar, SkScalar, const CdlPaint&);
81 void drawPosText(const void*, size_t, const SkPoint[], const CdlPaint&);
82 void drawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const CdlPaint&);
83
84 void drawImage(sk_sp<const SkImage>, SkScalar, SkScalar, const CdlPaint*);
85 void drawImageRect(sk_sp<const SkImage>,
86 const SkRect*,
87 const SkRect&,
88 const CdlPaint*,
89 SkCanvas::SrcRectConstraint);
90 void drawPoints(SkCanvas::PointMode,
91 size_t,
92 const SkPoint[],
93 const CdlPaint&);
94 void setBounds(const SkRect& bounds);
95
96 // Cdl
97 struct DrawContext {};
98
99 private:
100 // SkRect onGetBounds() override;
101 // void onDraw(SkCanvas*) override;
102
103 template <typename T, typename... Args>
104 void* push(size_t, Args&&...);
105
106 template <typename Fn, typename... Args>
107 void map(const Fn[], int start_offset, int end_offset, Args...);
108
109 SkAutoTMalloc<uint8_t> fBytes;
110 size_t fUsed;
111 size_t fReserved;
112 SkRect fBounds;
113 };
114
115 #endif
116
117 #endif // SKIA_EXT_CDL_PICTURE_BUFFER_H_
OLDNEW
« no previous file with comments | « skia/ext/cdl_picture.cc ('k') | skia/ext/cdl_picture_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698