OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |