Summary: | [Windows] Revise GDI Create Functions to use GDIObject Smart Pointer | ||||||
---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Brent Fulgham <bfulgham> | ||||
Component: | WebKit Misc. | Assignee: | Brent Fulgham <bfulgham> | ||||
Status: | RESOLVED FIXED | ||||||
Severity: | Normal | CC: | andersca, bfulgham, webkit-bug-importer | ||||
Priority: | P2 | Keywords: | InRadar | ||||
Version: | 528+ (Nightly build) | ||||||
Hardware: | Unspecified | ||||||
OS: | Unspecified | ||||||
Bug Depends on: | 120778 | ||||||
Bug Blocks: | |||||||
Attachments: |
|
Description
Brent Fulgham
2013-09-10 09:58:48 PDT
1. Change FontPlatformData to take a GDIObject<HFONT> and use std::move. 2. 'createGDIFont' should return a GDIObject<HFONT> - as should any other create functions we have that return GDI objects. Created attachment 211341 [details]
Patch
Comment on attachment 211341 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211341&action=review > Source/WebCore/platform/graphics/win/FontCacheWin.cpp:491 > + return GDIObject<HFONT>(); If you add a GDIObject constructor that takes std::nullptr_t you can just return nullptr here. > Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:58 > + ::SelectObject(hdc, m_font.get()->get()); I think SharedGDIObject’s get function should just return T, then this would just be m_font.get(). > Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:69 > + platformDataInit(m_font.get()->get(), size, hdc, faceName); Same thing here. Comment on attachment 211341 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211341&action=review >> Source/WebCore/platform/graphics/win/FontCacheWin.cpp:491 >> + return GDIObject<HFONT>(); > > If you add a GDIObject constructor that takes std::nullptr_t you can just return nullptr here. Great! I'll do that. >> Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:58 >> + ::SelectObject(hdc, m_font.get()->get()); > > I think SharedGDIObject’s get function should just return T, then this would just be m_font.get(). m_font is a RefPtr; SharedGDIObject.get() already returns T. I should have written this as ::SelectObject(hdc, m_font->get()); >> Source/WebCore/platform/graphics/win/FontPlatformDataWin.cpp:69 >> + platformDataInit(m_font.get()->get(), size, hdc, faceName); > > Same thing here. OK! Committed r155557: <http://trac.webkit.org/changeset/155557> |