| 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(SkPicture* picture, | 12 SkBBoxHierarchyRecord::SkBBoxHierarchyRecord(const SkISize& size, |
| 13 const SkISize& size, | |
| 14 uint32_t recordFlags, | 13 uint32_t recordFlags, |
| 15 SkBBoxHierarchy* h) | 14 SkBBoxHierarchy* h) |
| 16 : INHERITED(picture, size, recordFlags) { | 15 : INHERITED(size, recordFlags) { |
| 17 fStateTree = SkNEW(SkPictureStateTree); | 16 fStateTree = SkNEW(SkPictureStateTree); |
| 18 fBoundingHierarchy = h; | 17 fBoundingHierarchy = h; |
| 19 fBoundingHierarchy->ref(); | 18 fBoundingHierarchy->ref(); |
| 20 fBoundingHierarchy->setClient(this); | 19 fBoundingHierarchy->setClient(this); |
| 21 } | 20 } |
| 22 | 21 |
| 23 void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) { | 22 void SkBBoxHierarchyRecord::handleBBox(const SkRect& bounds) { |
| 24 SkIRect r; | 23 SkIRect r; |
| 25 bounds.roundOut(&r); | 24 bounds.roundOut(&r); |
| 26 SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().
bytesWritten()); | 25 SkPictureStateTree::Draw* draw = fStateTree->appendDraw(this->writeStream().
bytesWritten()); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 103 |
| 105 bool SkBBoxHierarchyRecord::shouldRewind(void* data) { | 104 bool SkBBoxHierarchyRecord::shouldRewind(void* data) { |
| 106 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the | 105 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the |
| 107 // SkPicture has rewound its command stream. To match that rewind in the | 106 // SkPicture has rewound its command stream. To match that rewind in the |
| 108 // BBH, we rewind all draws that reference commands that were recorded | 107 // BBH, we rewind all draws that reference commands that were recorded |
| 109 // past the point to which the SkPicture has rewound, which is given by | 108 // past the point to which the SkPicture has rewound, which is given by |
| 110 // writeStream().bytesWritten(). | 109 // writeStream().bytesWritten(). |
| 111 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data
); | 110 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data
); |
| 112 return draw->fOffset >= writeStream().bytesWritten(); | 111 return draw->fOffset >= writeStream().bytesWritten(); |
| 113 } | 112 } |
| OLD | NEW |