From: isn Date: Thu, 12 Oct 2017 12:33:30 +0000 (+0300) Subject: quick optimization patch (bytearray for images) X-Git-Tag: v2.1~66^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fce3f1240b6161d7cb837344078e5943b90eca65;p=modules%2Fhydro.git quick optimization patch (bytearray for images) --- 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]); } }