Salome HOME
quick optimization patch (bytearray for images)
[modules/hydro.git] / src / HYDROData / HYDROData_Entity.cxx
index 79444df5ae8c18a65365d170c783d2ae2aec16f7..62a7095e0f181f97a07fb36c24cf8628555d0ea5 100644 (file)
@@ -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]);
   }
 }
 
@@ -489,7 +493,7 @@ void HYDROData_Entity::SetReferenceObjects( const HYDROData_SequenceOfObjects& t
 Handle(HYDROData_Entity) HYDROData_Entity::GetReferenceObject( const int theTag,
                                                                const int theIndex ) const
 {
-  DEBTRACE("GetReferenceObject " << theTag << " " << theIndex);
+  //DEBTRACE("GetReferenceObject " << theTag << " " << theIndex);
   Handle(HYDROData_Entity) aRes;
 
   Handle(TDataStd_ReferenceList) aRefs = getReferenceList( theTag, false );
@@ -579,7 +583,7 @@ void HYDROData_Entity::ClearReferenceObjects( const int theTag )
 Handle(TDataStd_ReferenceList) HYDROData_Entity::getReferenceList( const int theTag,
                                                                    const bool theIsCreate ) const
 {
-  DEBTRACE("getReferenceList " << theTag << " " << theIsCreate);
+  //DEBTRACE("getReferenceList " << theTag << " " << theIsCreate);
   TDF_Label aLabel = theTag == 0 ? myLab : myLab.FindChild( theTag );
 
   Handle(TDataStd_ReferenceList) aRefs;