зеркало из https://github.com/mozilla/moz-skia.git
Fix some nits from http://codereview.appspot.com/6506103/
git-svn-id: http://skia.googlecode.com/svn/trunk@5547 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
3a8b0d8288
Коммит
1c6307e36f
|
@ -150,6 +150,13 @@ private:
|
|||
SkPictureRecord* fRecord;
|
||||
SkPicturePlayback* fPlayback;
|
||||
|
||||
/** Used by the R-Tree when kOptimizeForClippedPlayback_RecordingFlag is
|
||||
set, these were empirically determined to produce reasonable performance
|
||||
in most cases.
|
||||
*/
|
||||
static const int kRTreeMinChildren = 6;
|
||||
static const int kRTreeMaxChildren = 11;
|
||||
|
||||
friend class SkFlatPicture;
|
||||
friend class SkPicturePlayback;
|
||||
|
||||
|
|
|
@ -188,7 +188,8 @@ SkCanvas* SkPicture::beginRecording(int width, int height,
|
|||
if (recordingFlags & kOptimizeForClippedPlayback_RecordingFlag) {
|
||||
SkScalar aspectRatio = SkScalarDiv(SkIntToScalar(width),
|
||||
SkIntToScalar(height));
|
||||
SkRTree* tree = SkRTree::Create(6, 11, aspectRatio);
|
||||
SkRTree* tree = SkRTree::Create(kRTreeMinChildren, kRTreeMaxChildren,
|
||||
aspectRatio);
|
||||
SkASSERT(NULL != tree);
|
||||
fRecord = SkNEW_ARGS(SkBBoxHierarchyRecord, (recordingFlags, tree));
|
||||
tree->unref();
|
||||
|
|
|
@ -585,13 +585,15 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
|
|||
TextContainer text;
|
||||
SkTDArray<void*> results;
|
||||
|
||||
if (fStateTree && fBoundingHierarchy) {
|
||||
if (NULL != fStateTree && NULL != fBoundingHierarchy) {
|
||||
SkRect clipBounds;
|
||||
if (canvas.getClipBounds(&clipBounds)) {
|
||||
SkIRect query;
|
||||
clipBounds.roundOut(&query);
|
||||
fBoundingHierarchy->search(query, &results);
|
||||
if (results.count() == 0) { return; }
|
||||
if (results.count() == 0) {
|
||||
return;
|
||||
}
|
||||
SkTQSort<SkPictureStateTree::Draw>(
|
||||
reinterpret_cast<SkPictureStateTree::Draw**>(results.begin()),
|
||||
reinterpret_cast<SkPictureStateTree::Draw**>(results.end()-1));
|
||||
|
@ -604,7 +606,9 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
|
|||
|
||||
if (it.isValid()) {
|
||||
uint32_t off = it.draw();
|
||||
if (off == SK_MaxU32) { return; }
|
||||
if (off == SK_MaxU32) {
|
||||
return;
|
||||
}
|
||||
reader.setOffset(off);
|
||||
}
|
||||
|
||||
|
@ -857,7 +861,9 @@ void SkPicturePlayback::draw(SkCanvas& canvas) {
|
|||
|
||||
if (it.isValid()) {
|
||||
uint32_t off = it.draw();
|
||||
if (off == SK_MaxU32) { break; }
|
||||
if (off == SK_MaxU32) {
|
||||
break;
|
||||
}
|
||||
reader.setOffset(off);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
uint32_t draw();
|
||||
static const uint32_t kDrawComplete = SK_MaxU32;
|
||||
Iterator() : fPlaybackMatrix(), fValid(false) { }
|
||||
bool isValid() { return fValid; }
|
||||
bool isValid() const { return fValid; }
|
||||
private:
|
||||
Iterator(const SkTDArray<void*>& draws, SkCanvas* canvas, Node* root);
|
||||
// The draws this iterator is associated with
|
||||
|
|
Загрузка…
Ссылка в новой задаче