MCPcopy Create free account
hub / github.com/9miao/CrossApp / updateTransform

Method updateTransform

CrossApp/view/CAView.cpp:1684–1765  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1682}
1683
1684void CAView::updateTransform()
1685{
1686 // Recursively iterate over children
1687 if(m_pobImage && isDirty() )
1688 {
1689
1690 // If it is not visible, or one of its ancestors is not visible, then do nothing:
1691 if( !m_bVisible || ( m_pSuperview && m_pSuperview != m_pobBatchView && m_pSuperview->m_bShouldBeHidden) )
1692 {
1693 m_sQuad.br.vertices = m_sQuad.tl.vertices = m_sQuad.tr.vertices = m_sQuad.bl.vertices = vertex3(0,0,0);
1694 m_bShouldBeHidden = true;
1695 }
1696 else
1697 {
1698 m_bShouldBeHidden = false;
1699
1700 if( !m_pSuperview || m_pSuperview == m_pobBatchView)
1701 {
1702 m_transformToBatch = viewToSuperviewTransform();
1703 }
1704 else
1705 {
1706 m_transformToBatch = CATransformationConcat( viewToSuperviewTransform() , m_pSuperview->m_transformToBatch );
1707 }
1708
1709 DSize size = m_obContentSize;
1710
1711 float x1 = 0;
1712 float y1 = 0;
1713
1714 float x = m_transformToBatch.tx;
1715 float y = m_transformToBatch.ty;
1716
1717 float cr = m_transformToBatch.a;
1718 float sr = m_transformToBatch.b;
1719 float cr2 = m_transformToBatch.d;
1720 float sr2 = -m_transformToBatch.c;
1721
1722 x1 = x1 * cr - y1 * sr2 + x;
1723 y1 = x1 * sr + y1 * cr2 + y;
1724
1725 x1 = RENDER_IN_SUBPIXEL(x1);
1726 y1 = RENDER_IN_SUBPIXEL(y1);
1727
1728 float x2 = x1 + size.width;
1729 float y2 = y1 + size.height;
1730
1731 m_sQuad.bl.vertices = vertex3( x1, y1, m_fVertexZ );
1732 m_sQuad.br.vertices = vertex3( x2, y1, m_fVertexZ );
1733 m_sQuad.tl.vertices = vertex3( x1, y2, m_fVertexZ );
1734 m_sQuad.tr.vertices = vertex3( x2, y2, m_fVertexZ );
1735 }
1736
1737 if (m_pobImageAtlas)
1738 {
1739 m_pobImageAtlas->updateQuad(&m_sQuad, m_uAtlasIndex);
1740 }
1741

Callers 4

drawMethod · 0.80
insertQuadFromViewMethod · 0.80
updateQuadFromViewMethod · 0.80

Calls 10

vertex3Function · 0.85
CATransformationConcatFunction · 0.85
DPointClass · 0.85
ccDrawPolyFunction · 0.85
updateQuadMethod · 0.80
isDirtyFunction · 0.50
setDirtyFunction · 0.50
emptyMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected