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

Side by Side Diff: core/fxge/skia/fx_skia_device.cpp

Issue 1837113004: Support the device font cache (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 8 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 | « core/fxge/ge/fx_ge_text.cpp ('k') | core/include/fxge/fx_font.h » ('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 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium 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 "core/include/fxge/fx_ge.h" 5 #include "core/include/fxge/fx_ge.h"
6 6
7 #if defined(_SKIA_SUPPORT_) 7 #if defined(_SKIA_SUPPORT_)
8 #include "core/include/fxcodec/fx_codec.h" 8 #include "core/include/fxcodec/fx_codec.h"
9 9
10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 313
314 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars, 314 FX_BOOL CFX_SkiaDeviceDriver::DrawDeviceText(int nChars,
315 const FXTEXT_CHARPOS* pCharPos, 315 const FXTEXT_CHARPOS* pCharPos,
316 CFX_Font* pFont, 316 CFX_Font* pFont,
317 CFX_FontCache* pCache, 317 CFX_FontCache* pCache,
318 const CFX_Matrix* pObject2Device, 318 const CFX_Matrix* pObject2Device,
319 FX_FLOAT font_size, 319 FX_FLOAT font_size,
320 uint32_t color, 320 uint32_t color,
321 int alpha_flag, 321 int alpha_flag,
322 void* pIccTransform) { 322 void* pIccTransform) {
323 SkAutoTUnref<SkTypeface> typeface(SkTypeface::CreateFromStream( 323 CFX_TypeFace* typeface = pCache->GetDeviceCache(pFont);
324 new SkMemoryStream(pFont->GetFontData(), pFont->GetSize())));
325 SkPaint paint; 324 SkPaint paint;
326 paint.setAntiAlias(true); 325 paint.setAntiAlias(true);
327 paint.setColor(color); 326 paint.setColor(color);
328 paint.setTypeface(typeface); 327 paint.setTypeface(typeface);
329 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 328 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
330 paint.setTextSize(font_size); 329 paint.setTextSize(font_size);
331 paint.setSubpixelText(true); 330 paint.setSubpixelText(true);
332 m_pCanvas->save(); 331 m_pCanvas->save();
333 SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device); 332 SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device);
334 m_pCanvas->concat(skMatrix); 333 m_pCanvas->concat(skMatrix);
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
752 SetDeviceDriver(pDriver); 751 SetDeviceDriver(pDriver);
753 return TRUE; 752 return TRUE;
754 } 753 }
755 754
756 CFX_SkiaDevice::~CFX_SkiaDevice() { 755 CFX_SkiaDevice::~CFX_SkiaDevice() {
757 if (m_bOwnedBitmap && GetBitmap()) 756 if (m_bOwnedBitmap && GetBitmap())
758 delete GetBitmap(); 757 delete GetBitmap();
759 } 758 }
760 759
761 #endif 760 #endif
OLDNEW
« no previous file with comments | « core/fxge/ge/fx_ge_text.cpp ('k') | core/include/fxge/fx_font.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698