OLD | NEW |
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 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCanvasDrawable.h" | 9 #include "SkCanvasDrawable.h" |
10 #include "SkThread.h" | 10 #include "SkThread.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 void SkCanvasDrawable::draw(SkCanvas* canvas) { | 35 void SkCanvasDrawable::draw(SkCanvas* canvas) { |
36 SkAutoCanvasRestore acr(canvas, true); | 36 SkAutoCanvasRestore acr(canvas, true); |
37 this->onDraw(canvas); | 37 this->onDraw(canvas); |
38 | 38 |
39 if (false) { | 39 if (false) { |
40 draw_bbox(canvas, this->getBounds()); | 40 draw_bbox(canvas, this->getBounds()); |
41 } | 41 } |
42 } | 42 } |
43 | 43 |
44 SkPicture* SkCanvasDrawable::newPictureSnapshot(SkBBHFactory* bbhFactory, uint32
_t recordFlags) { | 44 SkPicture* SkCanvasDrawable::newPictureSnapshot() { |
45 return this->onNewPictureSnapshot(bbhFactory, recordFlags); | 45 return this->onNewPictureSnapshot(); |
46 } | 46 } |
47 | 47 |
48 uint32_t SkCanvasDrawable::getGenerationID() { | 48 uint32_t SkCanvasDrawable::getGenerationID() { |
49 if (0 == fGenerationID) { | 49 if (0 == fGenerationID) { |
50 fGenerationID = next_generation_id(); | 50 fGenerationID = next_generation_id(); |
51 } | 51 } |
52 return fGenerationID; | 52 return fGenerationID; |
53 } | 53 } |
54 | 54 |
55 SkRect SkCanvasDrawable::getBounds() { | 55 SkRect SkCanvasDrawable::getBounds() { |
56 return this->onGetBounds(); | 56 return this->onGetBounds(); |
57 } | 57 } |
58 | 58 |
59 void SkCanvasDrawable::notifyDrawingChanged() { | 59 void SkCanvasDrawable::notifyDrawingChanged() { |
60 fGenerationID = 0; | 60 fGenerationID = 0; |
61 } | 61 } |
62 | 62 |
63 ////////////////////////////////////////////////////////////////////////////////
///////// | 63 ////////////////////////////////////////////////////////////////////////////////
///////// |
64 | 64 |
65 #include "SkPictureRecorder.h" | 65 #include "SkPictureRecorder.h" |
66 | 66 |
67 SkPicture* SkCanvasDrawable::onNewPictureSnapshot(SkBBHFactory* bbhFactory, uint
32_t recordFlags) { | 67 SkPicture* SkCanvasDrawable::onNewPictureSnapshot() { |
68 SkPictureRecorder recorder; | 68 SkPictureRecorder recorder; |
69 | 69 |
70 const SkRect bounds = this->getBounds(); | 70 const SkRect bounds = this->getBounds(); |
71 SkCanvas* canvas = recorder.beginRecording(bounds, bbhFactory, recordFlags); | 71 SkCanvas* canvas = recorder.beginRecording(bounds, NULL, 0); |
72 this->draw(canvas); | 72 this->draw(canvas); |
73 if (false) { | 73 if (false) { |
74 draw_bbox(canvas, bounds); | 74 draw_bbox(canvas, bounds); |
75 } | 75 } |
76 return recorder.endRecording(); | 76 return recorder.endRecording(); |
77 } | 77 } |
OLD | NEW |