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

Side by Side Diff: include/core/SkPicture.h

Issue 313613004: Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add staging entry point for Chromium and Android Created 6 years, 6 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkPicture_DEFINED 10 #ifndef SkPicture_DEFINED
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 typedef SkRefCnt INHERITED; 61 typedef SkRefCnt INHERITED;
62 }; 62 };
63 63
64 SkPicture(); 64 SkPicture();
65 /** Make a copy of the contents of src. If src records more drawing after 65 /** Make a copy of the contents of src. If src records more drawing after
66 this call, those elements will not appear in this picture. 66 this call, those elements will not appear in this picture.
67 */ 67 */
68 SkPicture(const SkPicture& src); 68 SkPicture(const SkPicture& src);
69 69
70 /** PRIVATE / EXPERIMENTAL -- do not call */ 70 /** PRIVATE / EXPERIMENTAL -- do not call */
71 void EXPERIMENTAL_addAccelData(const AccelData* data) { 71 void EXPERIMENTAL_addAccelData(const AccelData* data) const {
72 SkRefCnt_SafeAssign(fAccelData, data); 72 SkRefCnt_SafeAssign(fAccelData, data);
73 } 73 }
74 /** PRIVATE / EXPERIMENTAL -- do not call */ 74 /** PRIVATE / EXPERIMENTAL -- do not call */
75 const AccelData* EXPERIMENTAL_getAccelData(AccelData::Key key) const { 75 const AccelData* EXPERIMENTAL_getAccelData(AccelData::Key key) const {
76 if (NULL != fAccelData && fAccelData->getKey() == key) { 76 if (NULL != fAccelData && fAccelData->getKey() == key) {
77 return fAccelData; 77 return fAccelData;
78 } 78 }
79 return NULL; 79 return NULL;
80 } 80 }
81 81
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 clip-query calls will reflect the path's bounds, not the actual 144 clip-query calls will reflect the path's bounds, not the actual
145 path. 145 path.
146 */ 146 */
147 kUsePathBoundsForClip_RecordingFlag = 0x01 147 kUsePathBoundsForClip_RecordingFlag = 0x01
148 }; 148 };
149 149
150 /** Replays the drawing commands on the specified canvas. This internally 150 /** Replays the drawing commands on the specified canvas. This internally
151 calls endRecording() if that has not already been called. 151 calls endRecording() if that has not already been called.
152 @param canvas the canvas receiving the drawing commands. 152 @param canvas the canvas receiving the drawing commands.
153 */ 153 */
154 void draw(SkCanvas* canvas, SkDrawPictureCallback* = NULL); 154 void draw(SkCanvas* canvas, SkDrawPictureCallback* = NULL) const;
155 155
156 /** Return the width of the picture's recording canvas. This 156 /** Return the width of the picture's recording canvas. This
157 value reflects what was passed to setSize(), and does not necessarily 157 value reflects what was passed to setSize(), and does not necessarily
158 reflect the bounds of what has been recorded into the picture. 158 reflect the bounds of what has been recorded into the picture.
159 @return the width of the picture's recording canvas 159 @return the width of the picture's recording canvas
160 */ 160 */
161 int width() const { return fWidth; } 161 int width() const { return fWidth; }
162 162
163 /** Return the height of the picture's recording canvas. This 163 /** Return the height of the picture's recording canvas. This
164 value reflects what was passed to setSize(), and does not necessarily 164 value reflects what was passed to setSize(), and does not necessarily
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 static const uint32_t CURRENT_PICTURE_VERSION = 28; 279 static const uint32_t CURRENT_PICTURE_VERSION = 28;
280 280
281 mutable uint32_t fUniqueID; 281 mutable uint32_t fUniqueID;
282 282
283 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to 283 // fPlayback, fRecord, fWidth & fHeight are protected to allow derived class es to
284 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed 284 // install their own SkPicturePlayback-derived players,SkPictureRecord-deriv ed
285 // recorders and set the picture size 285 // recorders and set the picture size
286 SkPicturePlayback* fPlayback; 286 SkPicturePlayback* fPlayback;
287 SkPictureRecord* fRecord; 287 SkPictureRecord* fRecord;
288 int fWidth, fHeight; 288 int fWidth, fHeight;
289 const AccelData* fAccelData; 289 mutable const AccelData* fAccelData;
290 290
291 void needsNewGenID() { fUniqueID = SK_InvalidGenID; } 291 void needsNewGenID() { fUniqueID = SK_InvalidGenID; }
292 292
293 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of 293 // Create a new SkPicture from an existing SkPicturePlayback. Ref count of
294 // playback is unchanged. 294 // playback is unchanged.
295 SkPicture(SkPicturePlayback*, int width, int height); 295 SkPicture(SkPicturePlayback*, int width, int height);
296 296
297 private: 297 private:
298 friend class SkPictureRecord; 298 friend class SkPictureRecord;
299 friend class SkPictureTester; // for unit testing 299 friend class SkPictureTester; // for unit testing
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 virtual uint32_t offset(int index) const { SkASSERT(false); return 0; }; 390 virtual uint32_t offset(int index) const { SkASSERT(false); return 0; };
391 // The CTM that must be installed for the operation to behave correctly 391 // The CTM that must be installed for the operation to behave correctly
392 virtual const SkMatrix& matrix(int index) const { SkASSERT(false); retur n SkMatrix::I(); } 392 virtual const SkMatrix& matrix(int index) const { SkASSERT(false); retur n SkMatrix::I(); }
393 393
394 static const OperationList& InvalidList(); 394 static const OperationList& InvalidList();
395 }; 395 };
396 396
397 /** PRIVATE / EXPERIMENTAL -- do not call 397 /** PRIVATE / EXPERIMENTAL -- do not call
398 Return the operations required to render the content inside 'queryRect'. 398 Return the operations required to render the content inside 'queryRect'.
399 */ 399 */
400 const OperationList& EXPERIMENTAL_getActiveOps(const SkIRect& queryRect); 400 const OperationList& EXPERIMENTAL_getActiveOps(const SkIRect& queryRect) con st;
401 401
402 /** PRIVATE / EXPERIMENTAL -- do not call 402 /** PRIVATE / EXPERIMENTAL -- do not call
403 Return the ID of the operation currently being executed when playing 403 Return the ID of the operation currently being executed when playing
404 back. 0 indicates no call is active. 404 back. 0 indicates no call is active.
405 */ 405 */
406 size_t EXPERIMENTAL_curOpID() const; 406 size_t EXPERIMENTAL_curOpID() const;
407 407
408 void createHeader(SkPictInfo* info) const; 408 void createHeader(SkPictInfo* info) const;
409 static bool IsValidPictInfo(const SkPictInfo& info); 409 static bool IsValidPictInfo(const SkPictInfo& info);
410 static SkPicturePlayback* FakeEndRecording(const SkPicture* resourceSrc, 410 static SkPicturePlayback* FakeEndRecording(const SkPicture* resourceSrc,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 */ 459 */
460 class SK_API SkDrawPictureCallback { 460 class SK_API SkDrawPictureCallback {
461 public: 461 public:
462 SkDrawPictureCallback() {} 462 SkDrawPictureCallback() {}
463 virtual ~SkDrawPictureCallback() {} 463 virtual ~SkDrawPictureCallback() {}
464 464
465 virtual bool abortDrawing() = 0; 465 virtual bool abortDrawing() = 0;
466 }; 466 };
467 467
468 #endif 468 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698