RESOLVED FIXED 121100
[Windows] Revise GDI Create Functions to use GDIObject Smart Pointer
https://bugs.webkit.org/show_bug.cgi?id=121100
Summary [Windows] Revise GDI Create Functions to use GDIObject Smart Pointer
Brent Fulgham
Reported 2013-09-10 09:58:48 PDT
Revise various Windows create functions to use GDIObject smart pointer.
Attachments
Patch (26.27 KB, patch)
2013-09-11 12:42 PDT, Brent Fulgham
andersca: review+
Brent Fulgham
Comment 1 2013-09-10 14:40:23 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.
Radar WebKit Bug Importer
Comment 2 2013-09-10 14:43:05 PDT
Brent Fulgham
Comment 3 2013-09-11 12:42:36 PDT
Anders Carlsson
Comment 4 2013-09-11 12:47:13 PDT
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.
Brent Fulgham
Comment 5 2013-09-11 13:18:55 PDT
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!
Brent Fulgham
Comment 6 2013-09-11 13:30:49 PDT
Note You need to log in before you can comment on or make changes to this bug.