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

Side by Side Diff: skia/picture/SkPictureRecord.h

Issue 113827: Remove the remainder of the skia source code from the Chromium repo.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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 | Annotate | Revision Log
« no previous file with comments | « skia/picture/SkPicturePlayback.cpp ('k') | skia/picture/SkPictureRecord.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 #ifndef SkPictureRecord_DEFINED
2 #define SkPictureRecord_DEFINED
3
4 #include "SkCanvas.h"
5 #include "SkFlattenable.h"
6 #include "SkPathHeap.h"
7 #include "SkPicture.h"
8 #include "SkPictureFlat.h"
9 #include "SkTemplates.h"
10 #include "SkWriter32.h"
11
12 class SkPictureRecord : public SkCanvas {
13 public:
14 SkPictureRecord();
15 virtual ~SkPictureRecord();
16
17 // overrides from SkCanvas
18 virtual int save(SaveFlags);
19 virtual int saveLayer(const SkRect* bounds, const SkPaint*, SaveFlags);
20 virtual void restore();
21 virtual bool translate(SkScalar dx, SkScalar dy);
22 virtual bool scale(SkScalar sx, SkScalar sy);
23 virtual bool rotate(SkScalar degrees);
24 virtual bool skew(SkScalar sx, SkScalar sy);
25 virtual bool concat(const SkMatrix& matrix);
26 virtual bool clipRect(const SkRect& rect, SkRegion::Op op);
27 virtual bool clipPath(const SkPath& path, SkRegion::Op op);
28 virtual bool clipRegion(const SkRegion& region, SkRegion::Op op);
29 virtual void drawPaint(const SkPaint& paint);
30 virtual void drawPoints(PointMode, size_t count, const SkPoint pts[],
31 const SkPaint&);
32 virtual void drawRect(const SkRect& rect, const SkPaint&);
33 virtual void drawPath(const SkPath& path, const SkPaint&);
34 virtual void drawBitmap(const SkBitmap&, SkScalar left, SkScalar top,
35 const SkPaint*);
36 virtual void drawBitmapRect(const SkBitmap&, const SkIRect* src,
37 const SkRect& dst, const SkPaint*);
38 virtual void drawBitmapMatrix(const SkBitmap&, const SkMatrix&,
39 const SkPaint*);
40 virtual void drawSprite(const SkBitmap&, int left, int top,
41 const SkPaint*);
42 virtual void drawText(const void* text, size_t byteLength, SkScalar x,
43 SkScalar y, const SkPaint&);
44 virtual void drawPosText(const void* text, size_t byteLength,
45 const SkPoint pos[], const SkPaint&);
46 virtual void drawPosTextH(const void* text, size_t byteLength,
47 const SkScalar xpos[], SkScalar constY, const SkPaint&);
48 virtual void drawTextOnPath(const void* text, size_t byteLength,
49 const SkPath& path, const SkMatrix* matrix,
50 const SkPaint&);
51 virtual void drawPicture(SkPicture& picture);
52 virtual void drawVertices(VertexMode, int vertexCount,
53 const SkPoint vertices[], const SkPoint texs[],
54 const SkColor colors[], SkXfermode*,
55 const uint16_t indices[], int indexCount,
56 const SkPaint&);
57
58 void addFontMetricsTopBottom(const SkPaint& paint, SkScalar baselineY);
59
60 const SkTDArray<const SkFlatBitmap* >& getBitmaps() const {
61 return fBitmaps;
62 }
63 const SkTDArray<const SkFlatMatrix* >& getMatrices() const {
64 return fMatrices;
65 }
66 const SkTDArray<const SkFlatPaint* >& getPaints() const {
67 return fPaints;
68 }
69 const SkTDArray<SkPicture* >& getPictureRefs() const {
70 return fPictureRefs;
71 }
72 const SkTDArray<const SkFlatRegion* >& getRegions() const {
73 return fRegions;
74 }
75
76 void reset();
77
78 const SkWriter32& writeStream() const {
79 return fWriter;
80 }
81
82 private:
83 SkTDArray<uint32_t> fRestoreOffsetStack;
84
85 void addDraw(DrawType drawType) {
86 #ifdef SK_DEBUG_TRACE
87 SkDebugf("add %s\n", DrawTypeToString(drawType));
88 #endif
89 fWriter.writeInt(drawType);
90 }
91 void addInt(int value) {
92 fWriter.writeInt(value);
93 }
94 void addScalar(SkScalar scalar) {
95 fWriter.writeScalar(scalar);
96 }
97
98 void addBitmap(const SkBitmap& bitmap);
99 void addMatrix(const SkMatrix& matrix);
100 void addMatrixPtr(const SkMatrix* matrix);
101 void addPaint(const SkPaint& paint);
102 void addPaintPtr(const SkPaint* paint);
103 void addPath(const SkPath& path);
104 void addPicture(SkPicture& picture);
105 void addPoint(const SkPoint& point);
106 void addPoints(const SkPoint pts[], int count);
107 void addRect(const SkRect& rect);
108 void addRectPtr(const SkRect* rect);
109 void addIRectPtr(const SkIRect* rect);
110 void addRegion(const SkRegion& region);
111 void addText(const void* text, size_t byteLength);
112
113 int find(SkTDArray<const SkFlatBitmap* >& bitmaps,
114 const SkBitmap& bitmap);
115 int find(SkTDArray<const SkFlatMatrix* >& matrices,
116 const SkMatrix* matrix);
117 int find(SkTDArray<const SkFlatPaint* >& paints, const SkPaint* paint);
118 int find(SkTDArray<const SkFlatRegion* >& regions, const SkRegion& region);
119
120 #ifdef SK_DEBUG_DUMP
121 public:
122 void dumpMatrices();
123 void dumpPaints();
124 #endif
125
126 #ifdef SK_DEBUG_SIZE
127 public:
128 size_t size() const;
129 int bitmaps(size_t* size) const;
130 int matrices(size_t* size) const;
131 int paints(size_t* size) const;
132 int paths(size_t* size) const;
133 int regions(size_t* size) const;
134 size_t streamlen() const;
135
136 size_t fPointBytes, fRectBytes, fTextBytes;
137 int fPointWrites, fRectWrites, fTextWrites;
138 #endif
139
140 #ifdef SK_DEBUG_VALIDATE
141 public:
142 void validate() const;
143 private:
144 void validateBitmaps() const;
145 void validateMatrices() const;
146 void validatePaints() const;
147 void validatePaths() const;
148 void validateRegions() const;
149 #else
150 public:
151 void validate() const {}
152 #endif
153
154 private:
155 SkChunkAlloc fHeap;
156 int fBitmapIndex;
157 SkTDArray<const SkFlatBitmap* > fBitmaps;
158 int fMatrixIndex;
159 SkTDArray<const SkFlatMatrix* > fMatrices;
160 int fPaintIndex;
161 SkTDArray<const SkFlatPaint* > fPaints;
162 int fRegionIndex;
163 SkTDArray<const SkFlatRegion* > fRegions;
164 SkPathHeap* fPathHeap; // reference counted
165 SkWriter32 fWriter;
166
167 // we ref each item in this array
168 SkTDArray<SkPicture*> fPictureRefs;
169
170 SkRefCntRecorder fRCRecorder;
171 SkRefCntRecorder fTFRecorder;
172
173 friend class SkPicturePlayback;
174
175 typedef SkCanvas INHERITED;
176 };
177
178 #endif
OLDNEW
« no previous file with comments | « skia/picture/SkPicturePlayback.cpp ('k') | skia/picture/SkPictureRecord.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698