OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include <new> | 7 #include <new> |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkDrawPictureCallback.h" | 9 #include "SkDrawPictureCallback.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 | 582 |
583 /////////////////////////////////////////////////////////////////////////////// | 583 /////////////////////////////////////////////////////////////////////////////// |
584 /////////////////////////////////////////////////////////////////////////////// | 584 /////////////////////////////////////////////////////////////////////////////// |
585 | 585 |
586 const SkPicture::OperationList* SkPictureData::getActiveOps(const SkIRect& query
) const { | 586 const SkPicture::OperationList* SkPictureData::getActiveOps(const SkIRect& query
) const { |
587 if (NULL == fStateTree || NULL == fBoundingHierarchy) { | 587 if (NULL == fStateTree || NULL == fBoundingHierarchy) { |
588 return NULL; | 588 return NULL; |
589 } | 589 } |
590 | 590 |
591 SkPicture::OperationList* activeOps = SkNEW(SkPicture::OperationList); | 591 SkPicture::OperationList* activeOps = SkNEW(SkPicture::OperationList); |
592 | |
593 fBoundingHierarchy->search(query, &(activeOps->fOps)); | 592 fBoundingHierarchy->search(query, &(activeOps->fOps)); |
594 if (0 != activeOps->fOps.count()) { | |
595 SkTQSort<SkPictureStateTree::Draw>( | |
596 reinterpret_cast<SkPictureStateTree::Draw**>(activeOps->fOps.begin()
), | |
597 reinterpret_cast<SkPictureStateTree::Draw**>(activeOps->fOps.end()-1
)); | |
598 } | |
599 | |
600 return activeOps; | 593 return activeOps; |
601 } | 594 } |
602 | 595 |
603 #if SK_SUPPORT_GPU | 596 #if SK_SUPPORT_GPU |
604 bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char *
*reason, | 597 bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char *
*reason, |
605 int sampleCount) const { | 598 int sampleCount) const { |
606 return fContentInfo.suitableForGpuRasterization(context, reason, sampleCount
); | 599 return fContentInfo.suitableForGpuRasterization(context, reason, sampleCount
); |
607 } | 600 } |
608 | 601 |
609 bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char *
*reason, | 602 bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char *
*reason, |
610 GrPixelConfig config, SkScalar d
pi) const { | 603 GrPixelConfig config, SkScalar d
pi) const { |
611 | 604 |
612 if (context != NULL) { | 605 if (context != NULL) { |
613 return this->suitableForGpuRasterization(context, reason, | 606 return this->suitableForGpuRasterization(context, reason, |
614 context->getRecommendedSampleCo
unt(config, dpi)); | 607 context->getRecommendedSampleCo
unt(config, dpi)); |
615 } else { | 608 } else { |
616 return this->suitableForGpuRasterization(NULL, reason); | 609 return this->suitableForGpuRasterization(NULL, reason); |
617 } | 610 } |
618 } | 611 } |
619 | 612 |
620 bool SkPictureData::suitableForLayerOptimization() const { | 613 bool SkPictureData::suitableForLayerOptimization() const { |
621 return fContentInfo.numLayers() > 0; | 614 return fContentInfo.numLayers() > 0; |
622 } | 615 } |
623 #endif | 616 #endif |
624 /////////////////////////////////////////////////////////////////////////////// | 617 /////////////////////////////////////////////////////////////////////////////// |
625 | 618 |
626 | 619 |
OLD | NEW |