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

Side by Side Diff: core/src/fxge/win32/fx_win32_dwrite.cpp

Issue 1243953004: Re-land else-after-returns (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 5 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 | « core/src/fxge/win32/fx_win32_dib.cpp ('k') | core/src/fxge/win32/fx_win32_gdipext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "../../../include/fxge/fx_ge.h" 7 #include "../../../include/fxge/fx_ge.h"
8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ 8 #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_
9 #include "../../../include/fxge/fx_ge_win32.h" 9 #include "../../../include/fxge/fx_ge_win32.h"
10 #include "dwrite_int.h" 10 #include "dwrite_int.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 refCount_ = 0; 275 refCount_ = 0;
276 resourcePtr_ = fontFileReferenceKey; 276 resourcePtr_ = fontFileReferenceKey;
277 resourceSize_ = fontFileReferenceKeySize; 277 resourceSize_ = fontFileReferenceKeySize;
278 } 278 }
279 HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p pvObject) 279 HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p pvObject)
280 { 280 {
281 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileStream)) { 281 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileStream)) {
282 *ppvObject = this; 282 *ppvObject = this;
283 AddRef(); 283 AddRef();
284 return S_OK; 284 return S_OK;
285 } else {
286 *ppvObject = NULL;
287 return E_NOINTERFACE;
288 } 285 }
286 *ppvObject = NULL;
287 return E_NOINTERFACE;
289 } 288 }
290 ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef() 289 ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef()
291 { 290 {
292 return InterlockedIncrement((long*)(&refCount_)); 291 return InterlockedIncrement((long*)(&refCount_));
293 } 292 }
294 ULONG STDMETHODCALLTYPE CDwFontFileStream::Release() 293 ULONG STDMETHODCALLTYPE CDwFontFileStream::Release()
295 { 294 {
296 ULONG newCount = InterlockedDecrement((long*)(&refCount_)); 295 ULONG newCount = InterlockedDecrement((long*)(&refCount_));
297 if (newCount == 0) { 296 if (newCount == 0) {
298 delete this; 297 delete this;
299 } 298 }
300 return newCount; 299 return newCount;
301 } 300 }
302 HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment( 301 HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment(
303 void const** fragmentStart, 302 void const** fragmentStart,
304 UINT64 fileOffset, 303 UINT64 fileOffset,
305 UINT64 fragmentSize, 304 UINT64 fragmentSize,
306 OUT void** fragmentContext 305 OUT void** fragmentContext
307 ) 306 )
308 { 307 {
309 if (fileOffset <= resourceSize_ && 308 if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffse t) {
310 fragmentSize <= resourceSize_ - fileOffset) {
311 *fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast <size_t>(fileOffset); 309 *fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast <size_t>(fileOffset);
312 *fragmentContext = NULL; 310 *fragmentContext = NULL;
313 return S_OK; 311 return S_OK;
314 } else {
315 *fragmentStart = NULL;
316 *fragmentContext = NULL;
317 return E_FAIL;
318 } 312 }
313 *fragmentStart = NULL;
314 *fragmentContext = NULL;
315 return E_FAIL;
319 } 316 }
320 void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentCont ext) 317 void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentCont ext)
321 { 318 {
322 } 319 }
323 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetFileSize(OUT UINT64* fileSize) 320 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetFileSize(OUT UINT64* fileSize)
324 { 321 {
325 *fileSize = resourceSize_; 322 *fileSize = resourceSize_;
326 return S_OK; 323 return S_OK;
327 } 324 }
328 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetLastWriteTime(OUT UINT64* lastWr iteTime) 325 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetLastWriteTime(OUT UINT64* lastWr iteTime)
329 { 326 {
330 *lastWriteTime = 0; 327 *lastWriteTime = 0;
331 return E_NOTIMPL; 328 return E_NOTIMPL;
332 } 329 }
333 IDWriteFontFileLoader* CDwFontFileLoader::instance_ = NULL; 330 IDWriteFontFileLoader* CDwFontFileLoader::instance_ = NULL;
334 CDwFontFileLoader::CDwFontFileLoader() : 331 CDwFontFileLoader::CDwFontFileLoader() :
335 refCount_(0) 332 refCount_(0)
336 { 333 {
337 } 334 }
338 HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p pvObject) 335 HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p pvObject)
339 { 336 {
340 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) { 337 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) {
341 *ppvObject = this; 338 *ppvObject = this;
342 AddRef(); 339 AddRef();
343 return S_OK; 340 return S_OK;
344 } else {
345 *ppvObject = NULL;
346 return E_NOINTERFACE;
347 } 341 }
342 *ppvObject = NULL;
343 return E_NOINTERFACE;
348 } 344 }
349 ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef() 345 ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef()
350 { 346 {
351 return InterlockedIncrement((long*)(&refCount_)); 347 return InterlockedIncrement((long*)(&refCount_));
352 } 348 }
353 ULONG STDMETHODCALLTYPE CDwFontFileLoader::Release() 349 ULONG STDMETHODCALLTYPE CDwFontFileLoader::Release()
354 { 350 {
355 ULONG newCount = InterlockedDecrement((long*)(&refCount_)); 351 ULONG newCount = InterlockedDecrement((long*)(&refCount_));
356 if (newCount == 0) { 352 if (newCount == 0) {
357 instance_ = NULL; 353 instance_ = NULL;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 text_bbox.Height(), 458 text_bbox.Height(),
463 &dib, 459 &dib,
464 text_bbox.left, 460 text_bbox.left,
465 text_bbox.top, 461 text_bbox.top,
466 FXDIB_BLEND_NORMAL, 462 FXDIB_BLEND_NORMAL,
467 pClipRgn 463 pClipRgn
468 ); 464 );
469 return hr; 465 return hr;
470 } 466 }
471 #endif 467 #endif
OLDNEW
« no previous file with comments | « core/src/fxge/win32/fx_win32_dib.cpp ('k') | core/src/fxge/win32/fx_win32_gdipext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698