Fixed cloning wxD2DPathData.
In addition to copying the underlying geometry sink itself also auxiliary data, like collection of transformed geometries and positional data have to copied the the new wxD2DPathData instance.
This commit is contained in:
@@ -1136,8 +1136,8 @@ wxD2DPathData::wxGraphicsObjectRefData* wxD2DPathData::Clone() const
|
|||||||
|
|
||||||
newPathData->EnsureGeometryOpen();
|
newPathData->EnsureGeometryOpen();
|
||||||
|
|
||||||
// Only geometry with closed sink (immutable)
|
// Only geometry with closed sink can be
|
||||||
// can be transferred to another geometry object with
|
// transferred to another geometry object with
|
||||||
// ID2D1PathGeometry::Stream() so we have to check
|
// ID2D1PathGeometry::Stream() so we have to check
|
||||||
// if actual transfer succeeded.
|
// if actual transfer succeeded.
|
||||||
|
|
||||||
@@ -1149,10 +1149,23 @@ wxD2DPathData::wxGraphicsObjectRefData* wxD2DPathData::Clone() const
|
|||||||
delete newPathData;
|
delete newPathData;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
// Copy auxiliary data.
|
|
||||||
newPathData->m_currentPoint = m_currentPoint;
|
// Copy the collection of transformed geometries.
|
||||||
newPathData->m_figureOpened = m_figureOpened;
|
ID2D1TransformedGeometry* pTransformedGeometry;
|
||||||
newPathData->m_figureStart = m_figureStart;
|
for ( size_t i = 0; i < m_pTransformedGeometries.size(); i++ )
|
||||||
|
{
|
||||||
|
pTransformedGeometry = NULL;
|
||||||
|
hr = m_direct2dfactory->CreateTransformedGeometry(
|
||||||
|
m_pTransformedGeometries[i],
|
||||||
|
D2D1::Matrix3x2F::Identity(), &pTransformedGeometry);
|
||||||
|
wxASSERT_MSG( SUCCEEDED(hr), wxFAILED_HRESULT_MSG(hr) );
|
||||||
|
newPathData->m_pTransformedGeometries.push_back(pTransformedGeometry);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Copy positional data.
|
||||||
|
GeometryStateData curState;
|
||||||
|
SaveGeometryState(curState);
|
||||||
|
newPathData->RestoreGeometryState(curState);
|
||||||
|
|
||||||
return newPathData;
|
return newPathData;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user