Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2014 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkCanvasDrawable_DEFINED | |
| 9 #define SkCanvasDrawable_DEFINED | |
| 10 | |
| 11 #include "SkRefCnt.h" | |
| 12 | |
| 13 class SkCanvas; | |
| 14 struct SkRect; | |
| 15 | |
| 16 /** | |
| 17 * Base-class to capture a set of drawing commands (sent to SkCanvas). Instance s of this class | |
| 18 * need not be thread-safe, but they must be able to be used in a thread differ ent from where | |
| 19 * they were created. | |
| 20 */ | |
| 21 class SkCanvasDrawable : public SkRefCnt { | |
|
djsollen
2014/11/10 19:23:38
seems that the only real use case for this is anim
reed1
2014/11/11 12:46:30
I see it as more general. For instance, it could a
| |
| 22 public: | |
| 23 SkCanvasDrawable(); | |
| 24 | |
| 25 /** | |
| 26 * 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, | |
| 28 * and the current matrix and clip settings will not be changed. | |
| 29 */ | |
| 30 void draw(SkCanvas*); | |
| 31 | |
| 32 /** | |
| 33 * 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. | |
| 35 * | |
| 36 * Subclasses that change their state should call notifyDrawingChanged() to ensure that | |
| 37 * a new value will be returned the next time it is called. | |
| 38 */ | |
| 39 uint32_t getGenerationID(); | |
| 40 | |
| 41 /** | |
| 42 * 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 | |
| 44 * return false. | |
| 45 */ | |
| 46 bool getBounds(SkRect*); | |
| 47 | |
| 48 void notifyDrawingChanged(); | |
|
djsollen
2014/11/10 19:23:39
can you add some comments on this?
reed1
2014/11/11 12:46:30
Done.
djsollen
2014/11/11 12:53:12
Did you forget to upload the comments? I don't see
| |
| 49 | |
| 50 protected: | |
| 51 virtual void onDraw(SkCanvas*) = 0; | |
|
robertphillips
2014/11/10 19:16:35
What do you think about having a default implement
reed1
2014/11/10 19:20:03
Done.
| |
| 52 virtual bool onGetBounds(SkRect*) = 0; | |
| 53 | |
| 54 private: | |
| 55 int32_t fGenerationID; | |
| 56 }; | |
| 57 | |
| 58 #endif | |
| OLD | NEW |