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

Side by Side Diff: fpdfsdk/fxedit/fxet_pageobjs.cpp

Issue 1886263003: Rename CFX_ByteTextBuf::GetByteString() to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: 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
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 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h" 7 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobject.h"
8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" 8 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h"
9 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h" 9 #include "core/fpdfapi/fpdf_page/include/cpdf_pathobject.h"
10 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h" 10 #include "core/fpdfapi/fpdf_page/include/cpdf_textobject.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 227
228 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, 228 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0,
229 FXFILL_WINDING); 229 FXFILL_WINDING);
230 } 230 }
231 } 231 }
232 232
233 if (bContinuous) { 233 if (bContinuous) {
234 if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || 234 if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex ||
235 crOldFill != crCurFill) { 235 crOldFill != crCurFill) {
236 if (sTextBuf.GetLength() > 0) { 236 if (sTextBuf.GetLength() > 0) {
237 DrawTextString(pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, 237 DrawTextString(
238 ptBT.y + ptOffset.y), 238 pDevice,
239 pFontMap->GetPDFFont(nFontIndex), fFontSize, 239 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
240 pUser2Device, sTextBuf.GetByteString(), 240 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
241 crOldFill, crTextStroke, nHorzScale); 241 sTextBuf.AsStringC(), crOldFill, crTextStroke, nHorzScale);
242 242
243 sTextBuf.Clear(); 243 sTextBuf.Clear();
244 } 244 }
245 nFontIndex = word.nFontIndex; 245 nFontIndex = word.nFontIndex;
246 ptBT = word.ptWord; 246 ptBT = word.ptWord;
247 crOldFill = crCurFill; 247 crOldFill = crCurFill;
248 } 248 }
249 249
250 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 250 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word,
251 SubWord) 251 SubWord)
252 .AsStringC(); 252 .AsStringC();
253 } else { 253 } else {
254 DrawTextString( 254 DrawTextString(
255 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x, 255 pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x,
256 word.ptWord.y + ptOffset.y), 256 word.ptWord.y + ptOffset.y),
257 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, 257 pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device,
258 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), 258 GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord),
259 crCurFill, crTextStroke, nHorzScale); 259 crCurFill, crTextStroke, nHorzScale);
260 } 260 }
261 oldplace = place; 261 oldplace = place;
262 } 262 }
263 } 263 }
264 264
265 if (sTextBuf.GetLength() > 0) { 265 if (sTextBuf.GetLength() > 0) {
266 DrawTextString( 266 DrawTextString(
267 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 267 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
268 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, 268 pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device,
269 sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); 269 sTextBuf.AsStringC(), crOldFill, crTextStroke, nHorzScale);
270 } 270 }
271 } 271 }
272 } 272 }
273 273
274 pDevice->RestoreState(); 274 pDevice->RestoreState();
275 } 275 }
276 276
277 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, 277 void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice,
278 CFX_Matrix* pUser2Device, 278 CFX_Matrix* pUser2Device,
279 IFX_Edit* pEdit, 279 IFX_Edit* pEdit,
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0, 341 pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0,
342 FXFILL_WINDING); 342 FXFILL_WINDING);
343 } 343 }
344 344
345 if (place.LineCmp(oldplace) != 0 || 345 if (place.LineCmp(oldplace) != 0 ||
346 word.WordProps.fCharSpace > 0.0f || 346 word.WordProps.fCharSpace > 0.0f ||
347 word.WordProps.nHorzScale != 100 || 347 word.WordProps.nHorzScale != 100 ||
348 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || 348 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 ||
349 crOld != crCurText) { 349 crOld != crCurText) {
350 if (sTextBuf.GetLength() > 0) { 350 if (sTextBuf.GetLength() > 0) {
351 DrawTextString(pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, 351 DrawTextString(
352 ptBT.y + ptOffset.y), 352 pDevice,
353 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, 353 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
354 pUser2Device, sTextBuf.GetByteString(), crOld, 0, 354 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize,
355 wp.nHorzScale); 355 pUser2Device, sTextBuf.AsStringC(), crOld, 0, wp.nHorzScale);
356 356
357 sTextBuf.Clear(); 357 sTextBuf.Clear();
358 } 358 }
359 wp = word.WordProps; 359 wp = word.WordProps;
360 ptBT = word.ptWord; 360 ptBT = word.ptWord;
361 crOld = crCurText; 361 crOld = crCurText;
362 } 362 }
363 363
364 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, 364 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
365 word.Word, 0) 365 word.Word, 0)
(...skipping 20 matching lines...) Expand all
386 } 386 }
387 387
388 oldplace = place; 388 oldplace = place;
389 } 389 }
390 } 390 }
391 391
392 if (sTextBuf.GetLength() > 0) { 392 if (sTextBuf.GetLength() > 0) {
393 DrawTextString( 393 DrawTextString(
394 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 394 pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
395 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, 395 pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device,
396 sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); 396 sTextBuf.AsStringC(), crOld, 0, wp.nHorzScale);
397 } 397 }
398 } 398 }
399 } 399 }
400 400
401 pDevice->RestoreState(); 401 pDevice->RestoreState();
402 } 402 }
403 403
404 static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder, 404 static void AddRectToPageObjects(CPDF_PageObjectHolder* pObjectHolder,
405 FX_COLORREF crFill, 405 FX_COLORREF crFill,
406 const CFX_FloatRect& rcFill) { 406 const CFX_FloatRect& rcFill) {
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 490
491 CPVT_Word word; 491 CPVT_Word word;
492 if (pIterator->GetWord(word)) { 492 if (pIterator->GetWord(word)) {
493 if (place.LineCmp(oldplace) != 0 || 493 if (place.LineCmp(oldplace) != 0 ||
494 nOldFontIndex != word.nFontIndex) { 494 nOldFontIndex != word.nFontIndex) {
495 if (sTextBuf.GetLength() > 0) { 495 if (sTextBuf.GetLength() > 0) {
496 ObjArray.Add(AddTextObjToPageObjects( 496 ObjArray.Add(AddTextObjToPageObjects(
497 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), 497 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex),
498 fFontSize, 0.0f, 100, 498 fFontSize, 0.0f, 100,
499 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 499 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
500 sTextBuf.GetByteString())); 500 sTextBuf.AsStringC()));
501 501
502 sTextBuf.Clear(); 502 sTextBuf.Clear();
503 } 503 }
504 504
505 ptBT = word.ptWord; 505 ptBT = word.ptWord;
506 nOldFontIndex = word.nFontIndex; 506 nOldFontIndex = word.nFontIndex;
507 } 507 }
508 508
509 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0) 509 sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0)
510 .AsStringC(); 510 .AsStringC();
511 oldplace = place; 511 oldplace = place;
512 } 512 }
513 } 513 }
514 514
515 if (sTextBuf.GetLength() > 0) { 515 if (sTextBuf.GetLength() > 0) {
516 ObjArray.Add(AddTextObjToPageObjects( 516 ObjArray.Add(AddTextObjToPageObjects(
517 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), 517 pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex),
518 fFontSize, 0.0f, 100, 518 fFontSize, 0.0f, 100,
519 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 519 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
520 sTextBuf.GetByteString())); 520 sTextBuf.AsStringC()));
521 } 521 }
522 } 522 }
523 } 523 }
524 } 524 }
525 525
526 void IFX_Edit::GenerateRichPageObjects( 526 void IFX_Edit::GenerateRichPageObjects(
527 CPDF_PageObjectHolder* pObjectHolder, 527 CPDF_PageObjectHolder* pObjectHolder,
528 IFX_Edit* pEdit, 528 IFX_Edit* pEdit,
529 const CFX_FloatPoint& ptOffset, 529 const CFX_FloatPoint& ptOffset,
530 const CPVT_WordRange* pRange, 530 const CPVT_WordRange* pRange,
(...skipping 30 matching lines...) Expand all
561 if (place.LineCmp(oldplace) != 0 || 561 if (place.LineCmp(oldplace) != 0 ||
562 word.WordProps.fCharSpace > 0.0f || 562 word.WordProps.fCharSpace > 0.0f ||
563 word.WordProps.nHorzScale != 100 || 563 word.WordProps.nHorzScale != 100 ||
564 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || 564 FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 ||
565 crOld != crCurText) { 565 crOld != crCurText) {
566 if (sTextBuf.GetLength() > 0) { 566 if (sTextBuf.GetLength() > 0) {
567 ObjArray.Add(AddTextObjToPageObjects( 567 ObjArray.Add(AddTextObjToPageObjects(
568 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), 568 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex),
569 wp.fFontSize, wp.fCharSpace, wp.nHorzScale, 569 wp.fFontSize, wp.fCharSpace, wp.nHorzScale,
570 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 570 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
571 sTextBuf.GetByteString())); 571 sTextBuf.AsStringC()));
572 572
573 sTextBuf.Clear(); 573 sTextBuf.Clear();
574 } 574 }
575 575
576 wp = word.WordProps; 576 wp = word.WordProps;
577 ptBT = word.ptWord; 577 ptBT = word.ptWord;
578 crOld = crCurText; 578 crOld = crCurText;
579 } 579 }
580 580
581 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex, 581 sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
(...skipping 22 matching lines...) Expand all
604 604
605 oldplace = place; 605 oldplace = place;
606 } 606 }
607 } 607 }
608 608
609 if (sTextBuf.GetLength() > 0) { 609 if (sTextBuf.GetLength() > 0) {
610 ObjArray.Add(AddTextObjToPageObjects( 610 ObjArray.Add(AddTextObjToPageObjects(
611 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), 611 pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex),
612 wp.fFontSize, wp.fCharSpace, wp.nHorzScale, 612 wp.fFontSize, wp.fCharSpace, wp.nHorzScale,
613 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), 613 CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y),
614 sTextBuf.GetByteString())); 614 sTextBuf.AsStringC()));
615 } 615 }
616 } 616 }
617 } 617 }
618 } 618 }
619 619
620 void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder, 620 void IFX_Edit::GenerateUnderlineObjects(CPDF_PageObjectHolder* pObjectHolder,
621 IFX_Edit* pEdit, 621 IFX_Edit* pEdit,
622 const CFX_FloatPoint& ptOffset, 622 const CFX_FloatPoint& ptOffset,
623 const CPVT_WordRange* pRange, 623 const CPVT_WordRange* pRange,
624 FX_COLORREF color) { 624 FX_COLORREF color) {
(...skipping 17 matching lines...) Expand all
642 rcUnderline.left += ptOffset.x; 642 rcUnderline.left += ptOffset.x;
643 rcUnderline.right += ptOffset.x; 643 rcUnderline.right += ptOffset.x;
644 rcUnderline.top += ptOffset.y; 644 rcUnderline.top += ptOffset.y;
645 rcUnderline.bottom += ptOffset.y; 645 rcUnderline.bottom += ptOffset.y;
646 AddRectToPageObjects(pObjectHolder, color, rcUnderline); 646 AddRectToPageObjects(pObjectHolder, color, rcUnderline);
647 } 647 }
648 } 648 }
649 } 649 }
650 } 650 }
651 } 651 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698