Skip to content
Snippets Groups Projects
Verified Commit aef0c591 authored by Bob Owen's avatar Bob Owen Committed by Pier Angelo Vendrame
Browse files

Bug 1850072: Initialize RecordedDrawTargetCreation::mHasExistingData. r=jrmuizel

This also specializes ElementStreamFormat for bool.

Differential Revision: https://phabricator.services.mozilla.com/D187794
parent 6e21be49
Branches
Tags
1 merge request!849Bug 42276: Rebase alpha onto 115.5.0esr
......@@ -65,7 +65,7 @@ class RecordedDrawTargetCreation
BackendType mBackendType;
IntRect mRect;
SurfaceFormat mFormat;
bool mHasExistingData;
bool mHasExistingData = false;
RefPtr<SourceSurface> mExistingData;
private:
......
......@@ -24,6 +24,28 @@ struct ElementStreamFormat {
aStream.read(reinterpret_cast<char*>(&aElement), sizeof(T));
}
};
template <class S>
struct ElementStreamFormat<S, bool> {
static void Write(S& aStream, const bool& aElement) {
char boolChar = aElement ? '\x01' : '\x00';
aStream.write(&boolChar, sizeof(boolChar));
}
static void Read(S& aStream, bool& aElement) {
char boolChar;
aStream.read(&boolChar, sizeof(boolChar));
switch (boolChar) {
case '\x00':
aElement = false;
break;
case '\x01':
aElement = true;
break;
default:
aStream.SetIsBad();
break;
}
}
};
template <class S, class T>
void WriteElement(S& aStream, const T& aElement) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment