| 1741 | } |
| 1742 | |
| 1743 | Texture* PSDReader::LoadMergedLayerTexture(const std::vector<int>& layerIndices, int* ofsX, int* ofsY) |
| 1744 | { |
| 1745 | AutoPerf gPerf("PSDReader::LoadMergedLayerTexture"); |
| 1746 | |
| 1747 | LayerInfoMap groupMap; |
| 1748 | |
| 1749 | if (layerIndices.size() == 0) |
| 1750 | return NULL; |
| 1751 | |
| 1752 | IntSet layerSet; |
| 1753 | |
| 1754 | // Fix up the layer set - add parents and remove children whose parents don't appear in the list |
| 1755 | for (int indexIdx = 0; indexIdx < (int) layerIndices.size(); indexIdx++) |
| 1756 | { |
| 1757 | PSDLayerInfo* layerInfo = mPSDLayerInfoVector[layerIndices[indexIdx]]; |
| 1758 | layerSet.insert(layerInfo->mIdx); |
| 1759 | } |
| 1760 | |
| 1761 | |
| 1762 | for (int indexIdx = 0; indexIdx < (int) layerIndices.size(); indexIdx++) |
| 1763 | { |
| 1764 | PSDLayerInfo* layerInfo = mPSDLayerInfoVector[layerIndices[indexIdx]]; |
| 1765 | |
| 1766 | PSDLayerInfo* parentCheck = layerInfo->mParent; |
| 1767 | bool includeLayer = true; |
| 1768 | |
| 1769 | if (!layerInfo->mBaseClipping) |
| 1770 | { |
| 1771 | int baseIdx = layerInfo->mIdx + 1; |
| 1772 | while (baseIdx < (int) mPSDLayerInfoVector.size()) |
| 1773 | { |
| 1774 | PSDLayerInfo* baseCheck = mPSDLayerInfoVector[baseIdx]; |
| 1775 | if (baseCheck->mBaseClipping) |
| 1776 | { |
| 1777 | includeLayer &= baseCheck->mVisible; |
| 1778 | break; |
| 1779 | } |
| 1780 | baseIdx++; |
| 1781 | } |
| 1782 | } |
| 1783 | |
| 1784 | while (parentCheck != NULL) |
| 1785 | { |
| 1786 | includeLayer &= layerSet.find(parentCheck->mIdx) != layerSet.end(); |
| 1787 | parentCheck = parentCheck->mParent; |
| 1788 | } |
| 1789 | |
| 1790 | if (!includeLayer) |
| 1791 | layerSet.erase(layerSet.find(layerInfo->mIdx)); |
| 1792 | } |
| 1793 | |
| 1794 | std::vector<int> aLayerIndices; |
| 1795 | |
| 1796 | // Composite |
| 1797 | IntSet::reverse_iterator revItr = layerSet.rbegin(); |
| 1798 | while (revItr != layerSet.rend()) |
| 1799 | { |
| 1800 | //PSDLayerInfo* layerInfo = mPSDLayerInfoVector[*revItr]; |
no test coverage detected