зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1850072: Initialize RecordedDrawTargetCreation::mHasExistingData. r=jrmuizel
This also specializes ElementStreamFormat for bool. Differential Revision: https://phabricator.services.mozilla.com/D187794
This commit is contained in:
Родитель
74b92aa33c
Коммит
6cee752c49
|
@ -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) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче