OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
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 #include "SkBBoxHierarchyRecord.h" | 9 #include "SkBBoxHierarchyRecord.h" |
10 #include "SkPictureStateTree.h" | 10 #include "SkPictureStateTree.h" |
11 | 11 |
12 SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(const SkISize& size, | 12 SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(SkPicture* picture, |
| 13 const SkISize& size, |
13 uint32_t recordFlags, | 14 uint32_t recordFlags, |
14 SkBBoxHierarchy* h) | 15 SkBBoxHierarchy* h) |
15 : INHERITED(size, recordFlags) { | 16 : INHERITED(picture, size, recordFlags) { |
16 fStateTree = SkNEW(SkPictureStateTree); | 17 fStateTree = SkNEW(SkPictureStateTree); |
17 fBoundingHierarchy = h; | 18 fBoundingHierarchy = h; |
18 fBoundingHierarchy->ref(); | 19 fBoundingHierarchy->ref(); |
19 fBoundingHierarchy->setClient(this); | 20 fBoundingHierarchy->setClient(this); |
20 } | 21 } |
21 | 22 |
22 void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) { | 23 void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) { |
23 SkIRect r; | 24 SkIRect r; |
24 bounds.roundOut(&r); | 25 bounds.roundOut(&r); |
25 SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().
bytesWritten()); | 26 SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().
bytesWritten()); |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 83 |
83 bool SkBBoxHierarchyRecord::shouldRewind(void* data) { | 84 bool SkBBoxHierarchyRecord::shouldRewind(void* data) { |
84 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the | 85 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the |
85 // SkPicture has rewound its command stream. To match that rewind in the | 86 // SkPicture has rewound its command stream. To match that rewind in the |
86 // BBH, we rewind all draws that reference commands that were recorded | 87 // BBH, we rewind all draws that reference commands that were recorded |
87 // past the point to which the SkPicture has rewound, which is given by | 88 // past the point to which the SkPicture has rewound, which is given by |
88 // writeStream().bytesWritten(). | 89 // writeStream().bytesWritten(). |
89 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data
); | 90 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data
); |
90 return draw->fOffset >= writeStream().bytesWritten(); | 91 return draw->fOffset >= writeStream().bytesWritten(); |
91 } | 92 } |
OLD | NEW |