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

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

Issue 697363004: update dox (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | 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 SkCanvasDrawable_DEFINED 8 #ifndef SkCanvasDrawable_DEFINED
9 #define SkCanvasDrawable_DEFINED 9 #define SkCanvasDrawable_DEFINED
10 10
11 #include "SkRefCnt.h" 11 #include "SkRefCnt.h"
12 12
13 class SkCanvas; 13 class SkCanvas;
14 struct SkRect; 14 struct SkRect;
15 15
16 /** 16 /**
17 * Base-class to capture a set of drawing commands (sent to SkCanvas). Instance s of this class 17 * Base-class for objects that draw into SkCanvas.
18 * need not be thread-safe, but they must be able to be used in a thread differ ent from where 18 *
19 * they were created. 19 * The object has a generation ID, which is guaranteed to be unique across all drawables. To
20 * allow for clients of the drawable that may want to cache the results, the dr awable must
21 * change its generation ID whenever its internal state changes such that it wi ll draw differently.
20 */ 22 */
21 class SkCanvasDrawable : public SkRefCnt { 23 class SkCanvasDrawable : public SkRefCnt {
22 public: 24 public:
23 SkCanvasDrawable(); 25 SkCanvasDrawable();
24 26
25 /** 27 /**
26 * Draws into the specified content. The drawing sequence will be balanced upon return 28 * Draws into the specified content. The drawing sequence will be balanced upon return
27 * (i.e. the saveLevel() on the canvas will match what it was when draw() w as called, 29 * (i.e. the saveLevel() on the canvas will match what it was when draw() w as called,
28 * and the current matrix and clip settings will not be changed. 30 * and the current matrix and clip settings will not be changed.
29 */ 31 */
30 void draw(SkCanvas*); 32 void draw(SkCanvas*);
31 33
32 /** 34 /**
33 * Return a unique value for this instance. If two calls to this return the same value, 35 * Return a unique value for this instance. If two calls to this return the same value,
34 * it is presumed that calling the draw() method will render the same thing as well. 36 * it is presumed that calling the draw() method will render the same thing as well.
35 * 37 *
36 * Subclasses that change their state should call notifyDrawingChanged() to ensure that 38 * Subclasses that change their state should call notifyDrawingChanged() to ensure that
37 * a new value will be returned the next time it is called. 39 * a new value will be returned the next time it is called.
38 */ 40 */
39 uint32_t getGenerationID(); 41 uint32_t getGenerationID();
40 42
41 /** 43 /**
42 * If the drawable knows a bounds that will contains all of its drawing, re turn true and 44 * If the drawable knows a bounds that will contains all of its drawing, re turn true and
43 * set the parameter to that rectangle. If one is not known, ignore the par ameter and 45 * set the parameter to that rectangle. If one is not known, ignore the par ameter and
44 * return false. 46 * return false.
45 */ 47 */
46 bool getBounds(SkRect*); 48 bool getBounds(SkRect*);
47 49
50 /**
51 * Calling this invalidates the previous generation ID, and causes a new on e to be computed
52 * the next time getGenerationID() is called. Typically this is called by t he object itself,
53 * in response to its internal state changing.
54 */
48 void notifyDrawingChanged(); 55 void notifyDrawingChanged();
49 56
50 protected: 57 protected:
51 virtual void onDraw(SkCanvas*) = 0; 58 virtual void onDraw(SkCanvas*) = 0;
52 59
53 virtual bool onGetBounds(SkRect*) { return false; } 60 virtual bool onGetBounds(SkRect*) { return false; }
54 61
55 private: 62 private:
56 int32_t fGenerationID; 63 int32_t fGenerationID;
57 }; 64 };
58 65
59 #endif 66 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698