MozNDEFRecord::MozNDEFRecord(JSContext* aCx, nsPIDOMWindow* aWindow, const MozNDEFRecordOptions& aOptions) { mWindow = aWindow; // For GetParentObject() mTnf = aOptions.mTnf; if (aOptions.mType.WasPassed()) { const Uint8Array& type = aOptions.mType.Value(); type.ComputeLengthAndData(); mType = Uint8Array::Create(aCx, this, type.Length(), type.Data()); } if (aOptions.mId.WasPassed()) { const Uint8Array& id = aOptions.mId.Value(); id.ComputeLengthAndData(); mId = Uint8Array::Create(aCx, this, id.Length(), id.Data()); } if (aOptions.mPayload.WasPassed()) { const Uint8Array& payload = aOptions.mPayload.Value(); payload.ComputeLengthAndData(); mPayload = Uint8Array::Create(aCx, this, payload.Length(), payload.Data()); } SetIsDOMBinding(); HoldData(); }
MozNDEFRecord::MozNDEFRecord(JSContext* aCx, nsPIDOMWindow* aWindow, uint8_t aTnf, const Optional<Uint8Array>& aType, const Optional<Uint8Array>& aId, const Optional<Uint8Array>& aPayload) : mTnf(aTnf) { mWindow = aWindow; // For GetParentObject() if (aType.WasPassed()) { aType.Value().ComputeLengthAndData(); mType = Uint8Array::Create(aCx, this, aType.Value().Length(), aType.Value().Data()); } if (aId.WasPassed()) { aId.Value().ComputeLengthAndData(); mId = Uint8Array::Create(aCx, this, aId.Value().Length(), aId.Value().Data()); } if (aPayload.WasPassed()) { aPayload.Value().ComputeLengthAndData(); mPayload = Uint8Array::Create(aCx, this, aPayload.Value().Length(), aPayload.Value().Data()); } SetIsDOMBinding(); HoldData(); }
void SplineData::Resample(int sampleCount) { if (theHold.Holding()) HoldData(); if (sampleCount < 2) sampleCount = 2; for (int j = 0; j < NumberOfSplines(); j++) { float u = 0.0f; int numSections = mSplineElementData[j]->GetNumberOfCrossSections(); for (int i = 0; i < numSections-2; i++) { mSplineElementData[j]->DeleteCrossSection(1); } int finalSample = sampleCount; if (mSplineElementData[j]->IsClosed()) finalSample = sampleCount +1; float inc = 1.0f/(float)(finalSample - 1); for (int i = 0; i < finalSample-2; i++) { u += inc; mSplineElementData[j]->InsertCrossSection(u); } mSplineElementData[j]->UpdateCrossSectionData(); } }