Bug 1328337 - Fix implicit conversion of glyph size from float to uint32_t in NativeFontResource::CreateScaledFont. r=bobowen, a=jcristau
authorLee Salzman <lsalzman@mozilla.com>
Tue, 03 Jan 2017 14:20:16 -0500
changeset 350271 dabf0d7affc2720f357cd9f67b4f10a96b056aeb
parent 350270 899b32dcae70e173a3ea0fc7c65af41f7de25d82
child 350272 d387b2aa3dc2fe58fd38d31f7a4b2f7302b27e4a
push id10593
push userryanvm@gmail.com
push dateWed, 18 Jan 2017 01:41:45 +0000
treeherdermozilla-aurora@d75736de7c46 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen, jcristau
bugs1328337
milestone52.0a2
Bug 1328337 - Fix implicit conversion of glyph size from float to uint32_t in NativeFontResource::CreateScaledFont. r=bobowen, a=jcristau MozReview-Commit-ID: 9JcrfRYJ3ca
gfx/2d/2D.h
gfx/2d/NativeFontResourceDWrite.cpp
gfx/2d/NativeFontResourceDWrite.h
gfx/2d/NativeFontResourceGDI.cpp
gfx/2d/NativeFontResourceGDI.h
gfx/2d/NativeFontResourceMac.cpp
gfx/2d/NativeFontResourceMac.h
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -730,17 +730,17 @@ public:
    * Creates a ScaledFont using the font corresponding to the index and
    * the given glyph size.
    *
    * @param aIndex index for the font within the resource.
    * @param aGlyphSize the size of ScaledFont required.
    * @return an already_addrefed ScaledFont, containing nullptr if failed.
    */
   virtual already_AddRefed<ScaledFont>
-    CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize) = 0;
+    CreateScaledFont(uint32_t aIndex, Float aGlyphSize) = 0;
 
   virtual ~NativeFontResource() {};
 };
 
 /** This class is designed to allow passing additional glyph rendering
  * parameters to the glyph drawing functions. This is an empty wrapper class
  * merely used to allow holding on to and passing around platform specific
  * parameters. This is because different platforms have unique rendering
--- a/gfx/2d/NativeFontResourceDWrite.cpp
+++ b/gfx/2d/NativeFontResourceDWrite.cpp
@@ -254,17 +254,17 @@ NativeFontResourceDWrite::Create(uint8_t
 
   RefPtr<NativeFontResourceDWrite> fontResource =
     new NativeFontResourceDWrite(factory, fontFile.forget(), faceType,
                                  numberOfFaces, aNeedsCairo);
   return fontResource.forget();
 }
 
 already_AddRefed<ScaledFont>
-NativeFontResourceDWrite::CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize)
+NativeFontResourceDWrite::CreateScaledFont(uint32_t aIndex, Float aGlyphSize)
 {
   if (aIndex >= mNumberOfFaces) {
     gfxWarning() << "Font face index is too high for font resource.";
     return nullptr;
   }
 
   IDWriteFontFile *fontFile = mFontFile;
   RefPtr<IDWriteFontFace> fontFace;
--- a/gfx/2d/NativeFontResourceDWrite.h
+++ b/gfx/2d/NativeFontResourceDWrite.h
@@ -27,17 +27,17 @@ public:
    * @param aDataLength length of data.
    * @param aNeedsCairo whether the ScaledFont created needs a cairo scaled font
    * @return Referenced NativeFontResourceDWrite or nullptr if invalid.
    */
   static already_AddRefed<NativeFontResourceDWrite>
     Create(uint8_t *aFontData, uint32_t aDataLength, bool aNeedsCairo);
 
   already_AddRefed<ScaledFont>
-    CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize) final;
+    CreateScaledFont(uint32_t aIndex, Float aGlyphSize) final;
 
 private:
   NativeFontResourceDWrite(IDWriteFactory *aFactory,
                            already_AddRefed<IDWriteFontFile> aFontFile,
                            DWRITE_FONT_FACE_TYPE aFaceType,
                            uint32_t aNumberOfFaces, bool aNeedsCairo)
     : mFactory(aFactory), mFontFile(aFontFile), mFaceType(aFaceType)
     , mNumberOfFaces(aNumberOfFaces), mNeedsCairo(aNeedsCairo)
--- a/gfx/2d/NativeFontResourceGDI.cpp
+++ b/gfx/2d/NativeFontResourceGDI.cpp
@@ -60,17 +60,17 @@ NativeFontResourceGDI::Create(uint8_t *a
 }
 
 NativeFontResourceGDI::~NativeFontResourceGDI()
 {
   ::RemoveFontMemResourceEx(mFontResourceHandle);
 }
 
 already_AddRefed<ScaledFont>
-NativeFontResourceGDI::CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize)
+NativeFontResourceGDI::CreateScaledFont(uint32_t aIndex, Float aGlyphSize)
 {
   if (aIndex >= mFontNames.length()) {
     gfxWarning() << "Font index is too high for font resource.";
     return nullptr;
   }
 
   if (mFontNames[aIndex].empty()) {
     gfxWarning() << "Font name for index is empty.";
--- a/gfx/2d/NativeFontResourceGDI.h
+++ b/gfx/2d/NativeFontResourceGDI.h
@@ -31,17 +31,17 @@ public:
    * @return Referenced NativeFontResourceGDI or nullptr if invalid.
    */
   static already_AddRefed<NativeFontResourceGDI>
     Create(uint8_t *aFontData, uint32_t aDataLength, bool aNeedsCairo);
 
   ~NativeFontResourceGDI();
 
   already_AddRefed<ScaledFont>
-    CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize) final;
+    CreateScaledFont(uint32_t aIndex, Float aGlyphSize) final;
 
 private:
   NativeFontResourceGDI(HANDLE aFontResourceHandle,
                         Vector<mozilla::u16string>&& aFontNames,
                         bool aNeedsCairo)
     : mFontResourceHandle(aFontResourceHandle), mFontNames(Move(aFontNames))
     , mNeedsCairo(aNeedsCairo)
   {}
--- a/gfx/2d/NativeFontResourceMac.cpp
+++ b/gfx/2d/NativeFontResourceMac.cpp
@@ -45,17 +45,17 @@ NativeFontResourceMac::Create(uint8_t *a
   // passes ownership of fontRef to the NativeFontResourceMac instance
   RefPtr<NativeFontResourceMac> fontResource =
     new NativeFontResourceMac(fontRef);
 
   return fontResource.forget();
 }
 
 already_AddRefed<ScaledFont>
-NativeFontResourceMac::CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize)
+NativeFontResourceMac::CreateScaledFont(uint32_t aIndex, Float aGlyphSize)
 {
   RefPtr<ScaledFontBase> scaledFont = new ScaledFontMac(mFontRef, aGlyphSize);
 
   if (!scaledFont->PopulateCairoScaledFont()) {
     gfxWarning() << "Unable to create cairo scaled Mac font.";
     return nullptr;
   }
 
--- a/gfx/2d/NativeFontResourceMac.h
+++ b/gfx/2d/NativeFontResourceMac.h
@@ -18,17 +18,17 @@ class NativeFontResourceMac final : publ
 {
 public:
   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(NativeFontResourceMac)
 
   static already_AddRefed<NativeFontResourceMac>
     Create(uint8_t *aFontData, uint32_t aDataLength);
 
   already_AddRefed<ScaledFont>
-    CreateScaledFont(uint32_t aIndex, uint32_t aGlyphSize);
+    CreateScaledFont(uint32_t aIndex, Float aGlyphSize);
 
   ~NativeFontResourceMac()
   {
     CFRelease(mFontRef);
   }
 
 private:
   explicit NativeFontResourceMac(CGFontRef aFontRef) : mFontRef(aFontRef) {}