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

Side by Side Diff: ui/gfx/font_fallback_win.cc

Issue 2864523002: Rename ScopedComPtr::QueryInterface to ScopedComPtr::CopyTo (Closed)
Patch Set: Created 3 years, 7 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 | « ui/accessibility/platform/ax_platform_node_win.cc ('k') | ui/gfx/win/direct_write.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium 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 #include "ui/gfx/font_fallback_win.h" 5 #include "ui/gfx/font_fallback_win.h"
6 6
7 #include <dwrite_2.h> 7 #include <dwrite_2.h>
8 #include <usp10.h> 8 #include <usp10.h>
9 #include <wrl.h> 9 #include <wrl.h>
10 10
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 352
353 // Check that we have at least as much text as was claimed. If we have less 353 // Check that we have at least as much text as was claimed. If we have less
354 // text than expected then DirectWrite will become confused and crash. This 354 // text than expected then DirectWrite will become confused and crash. This
355 // shouldn't happen, but crbug.com/624905 shows that it happens sometimes. 355 // shouldn't happen, but crbug.com/624905 shows that it happens sometimes.
356 DCHECK_GE(wcslen(text), static_cast<size_t>(text_length)); 356 DCHECK_GE(wcslen(text), static_cast<size_t>(text_length));
357 text_length = std::min(wcslen(text), static_cast<size_t>(text_length)); 357 text_length = std::min(wcslen(text), static_cast<size_t>(text_length));
358 358
359 base::win::ScopedComPtr<IDWriteFactory> factory; 359 base::win::ScopedComPtr<IDWriteFactory> factory;
360 gfx::win::CreateDWriteFactory(factory.Receive()); 360 gfx::win::CreateDWriteFactory(factory.Receive());
361 base::win::ScopedComPtr<IDWriteFactory2> factory2; 361 base::win::ScopedComPtr<IDWriteFactory2> factory2;
362 factory.QueryInterface(factory2.Receive()); 362 factory.CopyTo(factory2.Receive());
363 if (!factory2) { 363 if (!factory2) {
364 // IDWriteFactory2 is not available before Win8.1 364 // IDWriteFactory2 is not available before Win8.1
365 return GetUniscribeFallbackFont(font, text, text_length, result); 365 return GetUniscribeFallbackFont(font, text, text_length, result);
366 } 366 }
367 367
368 base::win::ScopedComPtr<IDWriteFontFallback> fallback; 368 base::win::ScopedComPtr<IDWriteFontFallback> fallback;
369 if (FAILED(factory2->GetSystemFontFallback(fallback.Receive()))) 369 if (FAILED(factory2->GetSystemFontFallback(fallback.Receive())))
370 return false; 370 return false;
371 371
372 base::string16 locale = base::UTF8ToUTF16(base::i18n::GetConfiguredLocale()); 372 base::string16 locale = base::UTF8ToUTF16(base::i18n::GetConfiguredLocale());
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
406 base::string16 name; 406 base::string16 name;
407 if (FAILED(GetFamilyNameFromDirectWriteFont(mapped_font.Get(), &name))) 407 if (FAILED(GetFamilyNameFromDirectWriteFont(mapped_font.Get(), &name)))
408 return false; 408 return false;
409 *result = Font(base::UTF16ToUTF8(name), font.GetFontSize() * scale); 409 *result = Font(base::UTF16ToUTF8(name), font.GetFontSize() * scale);
410 return true; 410 return true;
411 } 411 }
412 return false; 412 return false;
413 } 413 }
414 414
415 } // namespace gfx 415 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/accessibility/platform/ax_platform_node_win.cc ('k') | ui/gfx/win/direct_write.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698