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

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

Issue 449933002: change drawPicture in SkRecord to just ref the picture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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/SkRecorder.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkRecords_DEFINED 8 #ifndef SkRecords_DEFINED
9 #define SkRecords_DEFINED 9 #define SkRecords_DEFINED
10 10
11 #include "SkCanvas.h" 11 #include "SkCanvas.h"
12 #include "SkPicture.h"
13
14 class SkPictureBox {
15 public:
16 SkPictureBox(const SkPicture* obj) : fObj(SkRef(obj)) {}
17 SkPictureBox(const SkPictureBox& src) : fObj(SkRef(src.fObj)) {}
18 ~SkPictureBox() { fObj->unref(); }
19
20 SkPictureBox& operator=(const SkPictureBox& src) {
21 SkRefCnt_SafeAssign(fObj, src.fObj);
22 return *this;
23 }
24
25 operator const SkPicture*() const { return fObj; }
26
27 private:
28 const SkPicture* fObj;
mtklein 2014/08/07 18:19:27 SkAutoTUnref<const SkPicture> ?
reed1 2014/08/07 19:10:52 Possibly, but I think the Box semantics are differ
29 };
12 30
13 namespace SkRecords { 31 namespace SkRecords {
14 32
15 // A list of all the types of canvas calls we can record. 33 // A list of all the types of canvas calls we can record.
16 // Each of these is reified into a struct below. 34 // Each of these is reified into a struct below.
17 // 35 //
18 // (We're using the macro-of-macro trick here to do several different things wit h the same list.) 36 // (We're using the macro-of-macro trick here to do several different things wit h the same list.)
19 // 37 //
20 // We leave this SK_RECORD_TYPES macro defined for use by code that wants to ope rate on SkRecords 38 // We leave this SK_RECORD_TYPES macro defined for use by code that wants to ope rate on SkRecords
21 // types polymorphically. (See SkRecord::Record::{visit,mutate} for an example. ) 39 // types polymorphically. (See SkRecord::Record::{visit,mutate} for an example. )
(...skipping 17 matching lines...) Expand all
39 M(Clear) \ 57 M(Clear) \
40 M(DrawBitmap) \ 58 M(DrawBitmap) \
41 M(DrawBitmapMatrix) \ 59 M(DrawBitmapMatrix) \
42 M(DrawBitmapNine) \ 60 M(DrawBitmapNine) \
43 M(DrawBitmapRectToRect) \ 61 M(DrawBitmapRectToRect) \
44 M(DrawDRRect) \ 62 M(DrawDRRect) \
45 M(DrawOval) \ 63 M(DrawOval) \
46 M(DrawPaint) \ 64 M(DrawPaint) \
47 M(DrawPath) \ 65 M(DrawPath) \
48 M(DrawPatch) \ 66 M(DrawPatch) \
67 M(DrawPicture) \
49 M(DrawPoints) \ 68 M(DrawPoints) \
50 M(DrawPosText) \ 69 M(DrawPosText) \
51 M(DrawPosTextH) \ 70 M(DrawPosTextH) \
52 M(DrawRRect) \ 71 M(DrawRRect) \
53 M(DrawRect) \ 72 M(DrawRect) \
54 M(DrawSprite) \ 73 M(DrawSprite) \
55 M(DrawText) \ 74 M(DrawText) \
56 M(DrawTextOnPath) \ 75 M(DrawTextOnPath) \
57 M(DrawVertices) \ 76 M(DrawVertices) \
58 M(BoundedDrawPosTextH) /*From SkRecordBoundDrawPosTextH*/ 77 M(BoundedDrawPosTextH) /*From SkRecordBoundDrawPosTextH*/
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 RECORD5(DrawBitmapRectToRect, Optional<SkPaint>, paint, 231 RECORD5(DrawBitmapRectToRect, Optional<SkPaint>, paint,
213 ImmutableBitmap, bitmap, 232 ImmutableBitmap, bitmap,
214 Optional<SkRect>, src, 233 Optional<SkRect>, src,
215 SkRect, dst, 234 SkRect, dst,
216 SkCanvas::DrawBitmapRectFlags, flags); 235 SkCanvas::DrawBitmapRectFlags, flags);
217 RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner); 236 RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner);
218 RECORD2(DrawOval, SkPaint, paint, SkRect, oval); 237 RECORD2(DrawOval, SkPaint, paint, SkRect, oval);
219 RECORD1(DrawPaint, SkPaint, paint); 238 RECORD1(DrawPaint, SkPaint, paint);
220 RECORD2(DrawPath, SkPaint, paint, SkPath, path); 239 RECORD2(DrawPath, SkPaint, paint, SkPath, path);
221 RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch); 240 RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch);
241 RECORD1(DrawPicture, SkPictureBox, picture);
222 RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, Sk Point*, pts); 242 RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, Sk Point*, pts);
223 RECORD4(DrawPosText, SkPaint, paint, 243 RECORD4(DrawPosText, SkPaint, paint,
224 PODArray<char>, text, 244 PODArray<char>, text,
225 size_t, byteLength, 245 size_t, byteLength,
226 PODArray<SkPoint>, pos); 246 PODArray<SkPoint>, pos);
227 RECORD5(DrawPosTextH, SkPaint, paint, 247 RECORD5(DrawPosTextH, SkPaint, paint,
228 PODArray<char>, text, 248 PODArray<char>, text,
229 size_t, byteLength, 249 size_t, byteLength,
230 PODArray<SkScalar>, xpos, 250 PODArray<SkScalar>, xpos,
231 SkScalar, y); 251 SkScalar, y);
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 #undef RECORD0 304 #undef RECORD0
285 #undef RECORD1 305 #undef RECORD1
286 #undef RECORD2 306 #undef RECORD2
287 #undef RECORD3 307 #undef RECORD3
288 #undef RECORD4 308 #undef RECORD4
289 #undef RECORD5 309 #undef RECORD5
290 310
291 } // namespace SkRecords 311 } // namespace SkRecords
292 312
293 #endif//SkRecords_DEFINED 313 #endif//SkRecords_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkRecorder.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698