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

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

Issue 1239313005: Merge to XFA - else after returns. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Fix issues. 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 refCount_ = 0; 279 refCount_ = 0;
280 resourcePtr_ = fontFileReferenceKey; 280 resourcePtr_ = fontFileReferenceKey;
281 resourceSize_ = fontFileReferenceKeySize; 281 resourceSize_ = fontFileReferenceKeySize;
282 } 282 }
283 HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p pvObject) 283 HRESULT STDMETHODCALLTYPE CDwFontFileStream::QueryInterface(REFIID iid, void** p pvObject)
284 { 284 {
285 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileStream)) { 285 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileStream)) {
286 *ppvObject = this; 286 *ppvObject = this;
287 AddRef(); 287 AddRef();
288 return S_OK; 288 return S_OK;
289 } else {
290 *ppvObject = NULL;
291 return E_NOINTERFACE;
292 } 289 }
290 *ppvObject = NULL;
291 return E_NOINTERFACE;
293 } 292 }
294 ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef() 293 ULONG STDMETHODCALLTYPE CDwFontFileStream::AddRef()
295 { 294 {
296 return InterlockedIncrement((long*)(&refCount_)); 295 return InterlockedIncrement((long*)(&refCount_));
297 } 296 }
298 ULONG STDMETHODCALLTYPE CDwFontFileStream::Release() 297 ULONG STDMETHODCALLTYPE CDwFontFileStream::Release()
299 { 298 {
300 ULONG newCount = InterlockedDecrement((long*)(&refCount_)); 299 ULONG newCount = InterlockedDecrement((long*)(&refCount_));
301 if (newCount == 0) { 300 if (newCount == 0) {
302 delete this; 301 delete this;
303 } 302 }
304 return newCount; 303 return newCount;
305 } 304 }
306 HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment( 305 HRESULT STDMETHODCALLTYPE CDwFontFileStream::ReadFileFragment(
307 void const** fragmentStart, 306 void const** fragmentStart,
308 UINT64 fileOffset, 307 UINT64 fileOffset,
309 UINT64 fragmentSize, 308 UINT64 fragmentSize,
310 OUT void** fragmentContext 309 OUT void** fragmentContext
311 ) 310 )
312 { 311 {
313 if (fileOffset <= resourceSize_ && 312 if (fileOffset <= resourceSize_ && fragmentSize <= resourceSize_ - fileOffse t) {
314 fragmentSize <= resourceSize_ - fileOffset) {
315 *fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast <size_t>(fileOffset); 313 *fragmentStart = static_cast<uint8_t const*>(resourcePtr_) + static_cast <size_t>(fileOffset);
316 *fragmentContext = NULL; 314 *fragmentContext = NULL;
317 return S_OK; 315 return S_OK;
318 } else {
319 *fragmentStart = NULL;
320 *fragmentContext = NULL;
321 return E_FAIL;
322 } 316 }
317 *fragmentStart = NULL;
318 *fragmentContext = NULL;
319 return E_FAIL;
323 } 320 }
324 void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentCont ext) 321 void STDMETHODCALLTYPE CDwFontFileStream::ReleaseFileFragment(void* fragmentCont ext)
325 { 322 {
326 } 323 }
327 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetFileSize(OUT UINT64* fileSize) 324 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetFileSize(OUT UINT64* fileSize)
328 { 325 {
329 *fileSize = resourceSize_; 326 *fileSize = resourceSize_;
330 return S_OK; 327 return S_OK;
331 } 328 }
332 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetLastWriteTime(OUT UINT64* lastWr iteTime) 329 HRESULT STDMETHODCALLTYPE CDwFontFileStream::GetLastWriteTime(OUT UINT64* lastWr iteTime)
333 { 330 {
334 *lastWriteTime = 0; 331 *lastWriteTime = 0;
335 return E_NOTIMPL; 332 return E_NOTIMPL;
336 } 333 }
337 IDWriteFontFileLoader* CDwFontFileLoader::instance_ = NULL; 334 IDWriteFontFileLoader* CDwFontFileLoader::instance_ = NULL;
338 CDwFontFileLoader::CDwFontFileLoader() : 335 CDwFontFileLoader::CDwFontFileLoader() :
339 refCount_(0) 336 refCount_(0)
340 { 337 {
341 } 338 }
342 HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p pvObject) 339 HRESULT STDMETHODCALLTYPE CDwFontFileLoader::QueryInterface(REFIID iid, void** p pvObject)
343 { 340 {
344 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) { 341 if (iid == IID_IUnknown || iid == __uuidof(IDWriteFontFileLoader)) {
345 *ppvObject = this; 342 *ppvObject = this;
346 AddRef(); 343 AddRef();
347 return S_OK; 344 return S_OK;
348 } else {
349 *ppvObject = NULL;
350 return E_NOINTERFACE;
351 } 345 }
346 *ppvObject = NULL;
347 return E_NOINTERFACE;
352 } 348 }
353 ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef() 349 ULONG STDMETHODCALLTYPE CDwFontFileLoader::AddRef()
354 { 350 {
355 return InterlockedIncrement((long*)(&refCount_)); 351 return InterlockedIncrement((long*)(&refCount_));
356 } 352 }
357 ULONG STDMETHODCALLTYPE CDwFontFileLoader::Release() 353 ULONG STDMETHODCALLTYPE CDwFontFileLoader::Release()
358 { 354 {
359 ULONG newCount = InterlockedDecrement((long*)(&refCount_)); 355 ULONG newCount = InterlockedDecrement((long*)(&refCount_));
360 if (newCount == 0) { 356 if (newCount == 0) {
361 instance_ = NULL; 357 instance_ = NULL;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 text_bbox.Height(), 465 text_bbox.Height(),
470 &dib, 466 &dib,
471 text_bbox.left, 467 text_bbox.left,
472 text_bbox.top, 468 text_bbox.top,
473 FXDIB_BLEND_NORMAL, 469 FXDIB_BLEND_NORMAL,
474 pClipRgn 470 pClipRgn
475 ); 471 );
476 return hr; 472 return hr;
477 } 473 }
478 #endif 474 #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