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

Side by Side Diff: src/utils/win/SkDWriteFontFileStream.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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 unified diff | Download patch
« no previous file with comments | « src/utils/SkFrontBufferedStream.cpp ('k') | src/views/ios/SkOSWindow_iOS.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "SkTypes.h" 7 #include "SkTypes.h"
8 #if defined(SK_BUILD_FOR_WIN32) 8 #if defined(SK_BUILD_FOR_WIN32)
9 9
10 #include "SkTypes.h" 10 #include "SkTypes.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 return true; 100 return true;
101 } 101 }
102 102
103 bool SkDWriteFontFileStream::move(long offset) { 103 bool SkDWriteFontFileStream::move(long offset) {
104 return seek(fPos + offset); 104 return seek(fPos + offset);
105 } 105 }
106 106
107 SkDWriteFontFileStream* SkDWriteFontFileStream::fork() const { 107 SkDWriteFontFileStream* SkDWriteFontFileStream::fork() const {
108 SkAutoTDelete<SkDWriteFontFileStream> that(this->duplicate()); 108 SkAutoTDelete<SkDWriteFontFileStream> that(this->duplicate());
109 that->seek(fPos); 109 that->seek(fPos);
110 return that.detach(); 110 return that.release();
111 } 111 }
112 112
113 size_t SkDWriteFontFileStream::getLength() const { 113 size_t SkDWriteFontFileStream::getLength() const {
114 HRESULT hr = S_OK; 114 HRESULT hr = S_OK;
115 UINT64 realFileSize = 0; 115 UINT64 realFileSize = 0;
116 hr = fFontFileStream->GetFileSize(&realFileSize); 116 hr = fFontFileStream->GetFileSize(&realFileSize);
117 if (!SkTFitsIn<size_t>(realFileSize)) { 117 if (!SkTFitsIn<size_t>(realFileSize)) {
118 return 0; 118 return 0;
119 } 119 }
120 return static_cast<size_t>(realFileSize); 120 return static_cast<size_t>(realFileSize);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 if (!fStream->seek(static_cast<size_t>(fileOffset))) { 206 if (!fStream->seek(static_cast<size_t>(fileOffset))) {
207 return E_FAIL; 207 return E_FAIL;
208 } 208 }
209 SkAutoTMalloc<uint8_t> streamData(static_cast<size_t>(fragmentSize)); 209 SkAutoTMalloc<uint8_t> streamData(static_cast<size_t>(fragmentSize));
210 if (fStream->read(streamData.get(), static_cast<size_t>(fragmentSize)) ! = fragmentSize) { 210 if (fStream->read(streamData.get(), static_cast<size_t>(fragmentSize)) ! = fragmentSize) {
211 return E_FAIL; 211 return E_FAIL;
212 } 212 }
213 213
214 *fragmentStart = streamData.get(); 214 *fragmentStart = streamData.get();
215 *fragmentContext = streamData.detach(); 215 *fragmentContext = streamData.release();
216 } 216 }
217 return S_OK; 217 return S_OK;
218 } 218 }
219 219
220 void STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReleaseFileFragment(void* fragmentContext) { 220 void STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::ReleaseFileFragment(void* fragmentContext) {
221 sk_free(fragmentContext); 221 sk_free(fragmentContext);
222 } 222 }
223 223
224 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetFileSize(UINT64* fil eSize) { 224 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetFileSize(UINT64* fil eSize) {
225 *fileSize = fStream->getLength(); 225 *fileSize = fStream->getLength();
226 return S_OK; 226 return S_OK;
227 } 227 }
228 228
229 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetLastWriteTime(UINT64 * lastWriteTime) { 229 HRESULT STDMETHODCALLTYPE SkDWriteFontFileStreamWrapper::GetLastWriteTime(UINT64 * lastWriteTime) {
230 // The concept of last write time does not apply to this loader. 230 // The concept of last write time does not apply to this loader.
231 *lastWriteTime = 0; 231 *lastWriteTime = 0;
232 return E_NOTIMPL; 232 return E_NOTIMPL;
233 } 233 }
234 234
235 #endif//defined(SK_BUILD_FOR_WIN32) 235 #endif//defined(SK_BUILD_FOR_WIN32)
OLDNEW
« no previous file with comments | « src/utils/SkFrontBufferedStream.cpp ('k') | src/views/ios/SkOSWindow_iOS.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698