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

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

Issue 2057343002: use pos text (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | no next file » | 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/fxge/include/fx_ge.h" 5 #include "core/fxge/include/fx_ge.h"
6 6
7 #if defined(_SKIA_SUPPORT_) 7 #if defined(_SKIA_SUPPORT_)
8 #include "core/fxcodec/include/fx_codec.h" 8 #include "core/fxcodec/include/fx_codec.h"
9 9
10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" 10 #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 SkPaint paint; 598 SkPaint paint;
599 paint.setAntiAlias(true); 599 paint.setAntiAlias(true);
600 paint.setColor(color); 600 paint.setColor(color);
601 paint.setTypeface(typeface); 601 paint.setTypeface(typeface);
602 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding); 602 paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
603 paint.setTextSize(font_size); 603 paint.setTextSize(font_size);
604 paint.setSubpixelText(true); 604 paint.setSubpixelText(true);
605 m_pCanvas->save(); 605 m_pCanvas->save();
606 SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device); 606 SkMatrix skMatrix = ToFlippedSkMatrix(*pObject2Device);
607 m_pCanvas->concat(skMatrix); 607 m_pCanvas->concat(skMatrix);
608 SkTDArray<SkPoint> positions;
609 positions.setCount(nChars);
610 SkTDArray<uint16_t> glyphs;
611 glyphs.setCount(nChars);
608 for (int index = 0; index < nChars; ++index) { 612 for (int index = 0; index < nChars; ++index) {
609 const FXTEXT_CHARPOS& cp = pCharPos[index]; 613 const FXTEXT_CHARPOS& cp = pCharPos[index];
610 uint16_t glyph = (uint16_t)cp.m_GlyphIndex; 614 positions[index] = {cp.m_OriginX, cp.m_OriginY};
611 m_pCanvas->drawText(&glyph, 2, cp.m_OriginX, cp.m_OriginY, paint); 615 glyphs[index] = (uint16_t)cp.m_GlyphIndex;
612 } 616 }
617 m_pCanvas->drawPosText(glyphs.begin(), nChars * 2, positions.begin(), paint);
613 m_pCanvas->restore(); 618 m_pCanvas->restore();
614 return TRUE; 619 return TRUE;
615 } 620 }
616 621
617 int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) { 622 int CFX_SkiaDeviceDriver::GetDeviceCaps(int caps_id) {
618 switch (caps_id) { 623 switch (caps_id) {
619 case FXDC_DEVICE_CLASS: 624 case FXDC_DEVICE_CLASS:
620 return FXDC_DISPLAY; 625 return FXDC_DISPLAY;
621 case FXDC_PIXEL_WIDTH: 626 case FXDC_PIXEL_WIDTH:
622 return m_pCanvas->imageInfo().width(); 627 return m_pCanvas->imageInfo().width();
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 CFX_FxgeDevice::~CFX_FxgeDevice() { 1178 CFX_FxgeDevice::~CFX_FxgeDevice() {
1174 if (m_bOwnedBitmap && GetBitmap()) 1179 if (m_bOwnedBitmap && GetBitmap())
1175 delete GetBitmap(); 1180 delete GetBitmap();
1176 } 1181 }
1177 1182
1178 void CFX_FxgeDevice::PreMultiply() { 1183 void CFX_FxgeDevice::PreMultiply() {
1179 (static_cast<CFX_SkiaDeviceDriver*>(this->GetDeviceDriver()))->PreMultiply(); 1184 (static_cast<CFX_SkiaDeviceDriver*>(this->GetDeviceDriver()))->PreMultiply();
1180 } 1185 }
1181 1186
1182 #endif 1187 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698