| 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" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 void SkBBoxHierarchyRecord::willSave() { | 27 void SkBBoxHierarchyRecord::willSave() { |
| 28 fStateTree->appendSave(); | 28 fStateTree->appendSave(); |
| 29 this->INHERITED::willSave(); | 29 this->INHERITED::willSave(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 SkCanvas::SaveLayerStrategy SkBBoxHierarchyRecord::willSaveLayer(const SkRect* b
ounds, | 32 SkCanvas::SaveLayerStrategy SkBBoxHierarchyRecord::willSaveLayer(const SkRect* b
ounds, |
| 33 const SkPaint*
paint, | 33 const SkPaint*
paint, |
| 34 SaveFlags flags
) { | 34 SaveFlags flags
) { |
| 35 // For now, assume all filters affect transparent black. | 35 // For now, assume all filters affect transparent black. |
| 36 // FIXME: This could be made less conservative as an optimization. | 36 // FIXME: This could be made less conservative as an optimization. |
| 37 bool paintAffectsTransparentBlack = NULL != paint && | 37 bool paintAffectsTransparentBlack = paint && |
| 38 ((NULL != paint->getImageFilter()) || | 38 ((paint->getImageFilter()) || |
| 39 (NULL != paint->getColorFilter())); | 39 (paint->getColorFilter())); |
| 40 SkRect drawBounds; | 40 SkRect drawBounds; |
| 41 if (paintAffectsTransparentBlack) { | 41 if (paintAffectsTransparentBlack) { |
| 42 SkIRect deviceBounds; | 42 SkIRect deviceBounds; |
| 43 this->getClipDeviceBounds(&deviceBounds); | 43 this->getClipDeviceBounds(&deviceBounds); |
| 44 drawBounds.set(deviceBounds); | 44 drawBounds.set(deviceBounds); |
| 45 } | 45 } |
| 46 fStateTree->appendSaveLayer(this->writeStream().bytesWritten()); | 46 fStateTree->appendSaveLayer(this->writeStream().bytesWritten()); |
| 47 SkCanvas::SaveLayerStrategy strategy = this->INHERITED::willSaveLayer(bounds
, paint, flags); | 47 SkCanvas::SaveLayerStrategy strategy = this->INHERITED::willSaveLayer(bounds
, paint, flags); |
| 48 if (paintAffectsTransparentBlack) { | 48 if (paintAffectsTransparentBlack) { |
| 49 this->handleBBox(drawBounds); | 49 this->handleBBox(drawBounds); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 bool SkBBoxHierarchyRecord::shouldRewind(void* data) { | 97 bool SkBBoxHierarchyRecord::shouldRewind(void* data) { |
| 98 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the | 98 // SkBBoxHierarchy::rewindInserts is called by SkPicture after the |
| 99 // SkPicture has rewound its command stream. To match that rewind in the | 99 // SkPicture has rewound its command stream. To match that rewind in the |
| 100 // BBH, we rewind all draws that reference commands that were recorded | 100 // BBH, we rewind all draws that reference commands that were recorded |
| 101 // past the point to which the SkPicture has rewound, which is given by | 101 // past the point to which the SkPicture has rewound, which is given by |
| 102 // writeStream().bytesWritten(). | 102 // writeStream().bytesWritten(). |
| 103 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data
); | 103 SkPictureStateTree::Draw* draw = static_cast<SkPictureStateTree::Draw*>(data
); |
| 104 return draw->fOffset >= writeStream().bytesWritten(); | 104 return draw->fOffset >= writeStream().bytesWritten(); |
| 105 } | 105 } |
| OLD | NEW |