michael@0: /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*- michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "DrawEventRecorder.h" michael@0: #include "PathRecording.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gfx { michael@0: michael@0: using namespace std; michael@0: michael@0: const uint32_t kMagicInt = 0xc001feed; michael@0: michael@0: DrawEventRecorderPrivate::DrawEventRecorderPrivate(std::ostream *aStream) michael@0: : mOutputStream(aStream) michael@0: { michael@0: } michael@0: michael@0: void michael@0: DrawEventRecorderPrivate::RecordEvent(const RecordedEvent &aEvent) michael@0: { michael@0: WriteElement(*mOutputStream, aEvent.mType); michael@0: michael@0: aEvent.RecordToStream(*mOutputStream); michael@0: michael@0: Flush(); michael@0: } michael@0: michael@0: DrawEventRecorderFile::DrawEventRecorderFile(const char *aFilename) michael@0: : DrawEventRecorderPrivate(nullptr) michael@0: , mOutputFile(aFilename, ofstream::binary) michael@0: { michael@0: mOutputStream = &mOutputFile; michael@0: michael@0: WriteElement(*mOutputStream, kMagicInt); michael@0: WriteElement(*mOutputStream, kMajorRevision); michael@0: WriteElement(*mOutputStream, kMinorRevision); michael@0: } michael@0: michael@0: DrawEventRecorderFile::~DrawEventRecorderFile() michael@0: { michael@0: mOutputFile.close(); michael@0: } michael@0: michael@0: void michael@0: DrawEventRecorderFile::Flush() michael@0: { michael@0: mOutputFile.flush(); michael@0: } michael@0: michael@0: } michael@0: }