Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(520)

Unified Diff: src/utils/win/SkDWriteFontFileStream.cpp

Issue 940563002: Update DirectWrite streams to SkStreamAsset. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/win/SkDWriteFontFileStream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/win/SkDWriteFontFileStream.cpp
diff --git a/src/utils/win/SkDWriteFontFileStream.cpp b/src/utils/win/SkDWriteFontFileStream.cpp
index 809ae7bd9a2f2eb669a791f117a177e7753a8a9d..a18760111c0e36239443a8f50d9ea3e59997df81 100644
--- a/src/utils/win/SkDWriteFontFileStream.cpp
+++ b/src/utils/win/SkDWriteFontFileStream.cpp
@@ -133,7 +133,9 @@ const void* SkDWriteFontFileStream::getMemoryBase() {
///////////////////////////////////////////////////////////////////////////////
// SkIDWriteFontFileStreamWrapper
-HRESULT SkDWriteFontFileStreamWrapper::Create(SkStream* stream, SkDWriteFontFileStreamWrapper** streamFontFileStream) {
+HRESULT SkDWriteFontFileStreamWrapper::Create(SkStreamAsset* stream,
+ SkDWriteFontFileStreamWrapper** streamFontFileStream)
+{
*streamFontFileStream = new SkDWriteFontFileStreamWrapper(stream);
if (NULL == streamFontFileStream) {
return E_OUTOFMEMORY;
@@ -141,7 +143,7 @@ HRESULT SkDWriteFontFileStreamWrapper::Create(SkStream* stream, SkDWriteFontFile
return S_OK;
}
-SkDWriteFontFileStreamWrapper::SkDWriteFontFileStreamWrapper(SkStream* stream)
+SkDWriteFontFileStreamWrapper::SkDWriteFontFileStreamWrapper(SkStreamAsset* stream)
: fRefCount(1), fStream(stream) {
}
@@ -193,16 +195,13 @@ HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReadFileFragment(
*fragmentContext = NULL;
} else {
- //May be called from multiple threads.
+ // May be called from multiple threads.
SkAutoMutexAcquire ama(fStreamMutex);
*fragmentStart = NULL;
*fragmentContext = NULL;
- if (!fStream->rewind()) {
- return E_FAIL;
- }
- if (fStream->skip(static_cast<size_t>(fileOffset)) != fileOffset) {
+ if (!fStream->seek(static_cast<size_t>(fileOffset))) {
return E_FAIL;
}
SkAutoTMalloc<uint8_t> streamData(static_cast<size_t>(fragmentSize));
« no previous file with comments | « src/utils/win/SkDWriteFontFileStream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698