From f8a5ef3056619c1a8e7d1108ac3720c97ca8e67d Mon Sep 17 00:00:00 2001 From: caryclark Date: Mon, 4 Apr 2016 12:27:16 -0700 Subject: Support the device font cache Reuse the Skia typeface on sucessive text draw calls. This reduces the SKP size by 100x for some documents. Note that this does not use a smart pointer for the Skia typeface object. The downside of doing so is that it requires all clients that include fx_font.h to also have access to Skia. In this specific case, it is preferable to have a forward declared class to isolate Skia from the rest of PDFium. R=dsinclair,tsepez@chromium.org Review URL: https://codereview.chromium.org/1837113004 --- core/fxge/skia/fx_skia_device.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'core/fxge/skia/fx_skia_device.cpp') diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index 745c9b50fd..e61dda68d4 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -320,8 +320,7 @@ FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, uint32_t color, int alpha_flag, void* pIccTransform) { - SkAutoTUnref typeface(SkTypeface::CreateFromStream( - new SkMemoryStream(pFont->GetFontData(), pFont->GetSize()))); + CFX_TypeFace* typeface = pCache->GetDeviceCache(pFont); SkPaint paint; paint.setAntiAlias(true); paint.setColor(color); -- cgit v1.2.3