From fce3f1240b6161d7cb837344078e5943b90eca65 Mon Sep 17 00:00:00 2001 From: isn Date: Thu, 12 Oct 2017 15:33:30 +0300 Subject: [PATCH] quick optimization patch (bytearray for images) --- src/HYDROData/HYDROData_Entity.cxx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/HYDROData/HYDROData_Entity.cxx b/src/HYDROData/HYDROData_Entity.cxx index a8222673..62a7095e 100644 --- a/src/HYDROData/HYDROData_Entity.cxx +++ b/src/HYDROData/HYDROData_Entity.cxx @@ -352,15 +352,19 @@ void HYDROData_Entity::SaveByteArray( const int theTag, if (!aLab.FindAttribute(TDataStd_ByteArray::GetID(), aData)) { aData = TDataStd_ByteArray::Set(aLab, 1, theLen); } + Standard_Byte* Byte0 = &(aData->InternalArray()->ChangeArray1().ChangeFirst()); + memcpy(Byte0, theData, theLen * sizeof (char)); // copy bytes one by one if (aData->Length() != theLen) { Handle(TColStd_HArray1OfByte) aNewData = new TColStd_HArray1OfByte(1, theLen); for(int a = 0; a < theLen; a++) aNewData->SetValue(a + 1, theData[a]); aData->ChangeArray(aNewData); - } else { - for(int a = 0; a < theLen; a++) - aData->SetValue(a + 1, theData[a]); + } + else + { + // for(int a = 0; a < theLen; a++) + // aData->SetValue(a + 1, theData[a]); } } -- 2.39.2