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

Side by Side Diff: core/src/fxge/dib/fx_dib_convert.cpp

Issue 1739623002: Rename some functions that start with underscore. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 4 years, 9 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/src/fxcodec/lgif/fx_gif.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('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 // 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/include/fxcodec/fx_codec.h" 7 #include "core/include/fxcodec/fx_codec.h"
8 #include "core/include/fxge/fx_dib.h" 8 #include "core/include/fxge/fx_dib.h"
9 #include "core/include/fxge/fx_ge.h" 9 #include "core/include/fxge/fx_ge.h"
10 10
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 _Qsort(m_aLut, m_cLut, 0, m_lut - 1); 246 _Qsort(m_aLut, m_cLut, 0, m_lut - 1);
247 FX_DWORD* win_mac_pal = NULL; 247 FX_DWORD* win_mac_pal = NULL;
248 if (pal_type == FXDIB_PALETTE_WIN) { 248 if (pal_type == FXDIB_PALETTE_WIN) {
249 win_mac_pal = (FX_DWORD*)g_dwWinPalette; 249 win_mac_pal = (FX_DWORD*)g_dwWinPalette;
250 } else if (pal_type == FXDIB_PALETTE_MAC) { 250 } else if (pal_type == FXDIB_PALETTE_MAC) {
251 win_mac_pal = (FX_DWORD*)g_dwMacPalette; 251 win_mac_pal = (FX_DWORD*)g_dwMacPalette;
252 } 252 }
253 _Obtain_Pal(m_aLut, m_cLut, m_pPalette, pal_type, win_mac_pal, m_lut); 253 _Obtain_Pal(m_aLut, m_cLut, m_pPalette, pal_type, win_mac_pal, m_lut);
254 return TRUE; 254 return TRUE;
255 } 255 }
256 FX_BOOL _ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf, 256 FX_BOOL ConvertBuffer_1bppMask2Gray(uint8_t* dest_buf,
257 int dest_pitch, 257 int dest_pitch,
258 int width, 258 int width,
259 int height, 259 int height,
260 const CFX_DIBSource* pSrcBitmap, 260 const CFX_DIBSource* pSrcBitmap,
261 int src_left, 261 int src_left,
262 int src_top) { 262 int src_top) {
263 uint8_t set_gray, reset_gray; 263 uint8_t set_gray, reset_gray;
264 set_gray = 0xff; 264 set_gray = 0xff;
265 reset_gray = 0x00; 265 reset_gray = 0x00;
266 for (int row = 0; row < height; row++) { 266 for (int row = 0; row < height; row++) {
267 uint8_t* dest_scan = dest_buf + row * dest_pitch; 267 uint8_t* dest_scan = dest_buf + row * dest_pitch;
268 FXSYS_memset(dest_scan, reset_gray, width); 268 FXSYS_memset(dest_scan, reset_gray, width);
269 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); 269 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
270 for (int col = src_left; col < src_left + width; col++) { 270 for (int col = src_left; col < src_left + width; col++) {
271 if (src_scan[col / 8] & (1 << (7 - col % 8))) { 271 if (src_scan[col / 8] & (1 << (7 - col % 8))) {
272 *dest_scan = set_gray; 272 *dest_scan = set_gray;
273 } 273 }
274 dest_scan++; 274 dest_scan++;
275 } 275 }
276 } 276 }
277 return TRUE; 277 return TRUE;
278 } 278 }
279 FX_BOOL _ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf, 279 FX_BOOL ConvertBuffer_8bppMask2Gray(uint8_t* dest_buf,
280 int dest_pitch, 280 int dest_pitch,
281 int width, 281 int width,
282 int height, 282 int height,
283 const CFX_DIBSource* pSrcBitmap, 283 const CFX_DIBSource* pSrcBitmap,
284 int src_left, 284 int src_left,
285 int src_top) { 285 int src_top) {
286 for (int row = 0; row < height; row++) { 286 for (int row = 0; row < height; row++) {
287 uint8_t* dest_scan = dest_buf + row * dest_pitch; 287 uint8_t* dest_scan = dest_buf + row * dest_pitch;
288 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; 288 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
289 FXSYS_memcpy(dest_scan, src_scan, width); 289 FXSYS_memcpy(dest_scan, src_scan, width);
290 } 290 }
291 return TRUE; 291 return TRUE;
292 } 292 }
293 FX_BOOL _ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf, 293 FX_BOOL ConvertBuffer_1bppPlt2Gray(uint8_t* dest_buf,
294 int dest_pitch, 294 int dest_pitch,
295 int width, 295 int width,
296 int height, 296 int height,
297 const CFX_DIBSource* pSrcBitmap, 297 const CFX_DIBSource* pSrcBitmap,
298 int src_left, 298 int src_left,
299 int src_top, 299 int src_top,
300 void* pIccTransform) { 300 void* pIccTransform) {
301 FX_DWORD* src_plt = pSrcBitmap->GetPalette(); 301 FX_DWORD* src_plt = pSrcBitmap->GetPalette();
302 uint8_t gray[2]; 302 uint8_t gray[2];
303 if (pIccTransform) { 303 if (pIccTransform) {
304 FX_DWORD plt[2]; 304 FX_DWORD plt[2];
305 if (pSrcBitmap->IsCmykImage()) { 305 if (pSrcBitmap->IsCmykImage()) {
306 plt[0] = FXCMYK_TODIB(src_plt[0]); 306 plt[0] = FXCMYK_TODIB(src_plt[0]);
307 plt[1] = FXCMYK_TODIB(src_plt[1]); 307 plt[1] = FXCMYK_TODIB(src_plt[1]);
308 } else { 308 } else {
309 uint8_t* bgr_ptr = (uint8_t*)plt; 309 uint8_t* bgr_ptr = (uint8_t*)plt;
310 bgr_ptr[0] = FXARGB_B(src_plt[0]); 310 bgr_ptr[0] = FXARGB_B(src_plt[0]);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); 345 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
346 for (int col = src_left; col < src_left + width; col++) { 346 for (int col = src_left; col < src_left + width; col++) {
347 if (src_scan[col / 8] & (1 << (7 - col % 8))) { 347 if (src_scan[col / 8] & (1 << (7 - col % 8))) {
348 *dest_scan = gray[1]; 348 *dest_scan = gray[1];
349 } 349 }
350 dest_scan++; 350 dest_scan++;
351 } 351 }
352 } 352 }
353 return TRUE; 353 return TRUE;
354 } 354 }
355 FX_BOOL _ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf, 355 FX_BOOL ConvertBuffer_8bppPlt2Gray(uint8_t* dest_buf,
356 int dest_pitch, 356 int dest_pitch,
357 int width, 357 int width,
358 int height, 358 int height,
359 const CFX_DIBSource* pSrcBitmap, 359 const CFX_DIBSource* pSrcBitmap,
360 int src_left, 360 int src_left,
361 int src_top, 361 int src_top,
362 void* pIccTransform) { 362 void* pIccTransform) {
363 FX_DWORD* src_plt = pSrcBitmap->GetPalette(); 363 FX_DWORD* src_plt = pSrcBitmap->GetPalette();
364 uint8_t gray[256]; 364 uint8_t gray[256];
365 if (pIccTransform) { 365 if (pIccTransform) {
366 FX_DWORD plt[256]; 366 FX_DWORD plt[256];
367 if (pSrcBitmap->IsCmykImage()) { 367 if (pSrcBitmap->IsCmykImage()) {
368 for (int i = 0; i < 256; i++) { 368 for (int i = 0; i < 256; i++) {
369 plt[i] = FXCMYK_TODIB(src_plt[i]); 369 plt[i] = FXCMYK_TODIB(src_plt[i]);
370 } 370 }
371 } else { 371 } else {
372 uint8_t* bgr_ptr = (uint8_t*)plt; 372 uint8_t* bgr_ptr = (uint8_t*)plt;
(...skipping 24 matching lines...) Expand all
397 } 397 }
398 for (int row = 0; row < height; row++) { 398 for (int row = 0; row < height; row++) {
399 uint8_t* dest_scan = dest_buf + row * dest_pitch; 399 uint8_t* dest_scan = dest_buf + row * dest_pitch;
400 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; 400 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
401 for (int col = 0; col < width; col++) { 401 for (int col = 0; col < width; col++) {
402 *dest_scan++ = gray[*src_scan++]; 402 *dest_scan++ = gray[*src_scan++];
403 } 403 }
404 } 404 }
405 return TRUE; 405 return TRUE;
406 } 406 }
407 FX_BOOL _ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf, 407 FX_BOOL ConvertBuffer_RgbOrCmyk2Gray(uint8_t* dest_buf,
408 int dest_pitch, 408 int dest_pitch,
409 int width, 409 int width,
410 int height, 410 int height,
411 const CFX_DIBSource* pSrcBitmap, 411 const CFX_DIBSource* pSrcBitmap,
412 int src_left, 412 int src_left,
413 int src_top, 413 int src_top,
414 void* pIccTransform) { 414 void* pIccTransform) {
415 int Bpp = pSrcBitmap->GetBPP() / 8; 415 int Bpp = pSrcBitmap->GetBPP() / 8;
416 if (pIccTransform) { 416 if (pIccTransform) {
417 ICodec_IccModule* pIccModule = 417 ICodec_IccModule* pIccModule =
418 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 418 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
419 if (Bpp == 3 || pSrcBitmap->IsCmykImage()) { 419 if (Bpp == 3 || pSrcBitmap->IsCmykImage()) {
420 for (int row = 0; row < height; row++) { 420 for (int row = 0; row < height; row++) {
421 uint8_t* dest_scan = dest_buf + row * dest_pitch; 421 uint8_t* dest_scan = dest_buf + row * dest_pitch;
422 const uint8_t* src_scan = 422 const uint8_t* src_scan =
423 pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; 423 pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
424 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 424 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp; 459 pSrcBitmap->GetScanline(src_top + row) + src_left * Bpp;
460 for (int col = 0; col < width; col++) { 460 for (int col = 0; col < width; col++) {
461 *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]); 461 *dest_scan++ = FXRGB2GRAY(src_scan[2], src_scan[1], src_scan[0]);
462 src_scan += Bpp; 462 src_scan += Bpp;
463 } 463 }
464 } 464 }
465 } 465 }
466 } 466 }
467 return TRUE; 467 return TRUE;
468 } 468 }
469 inline void _ConvertBuffer_IndexCopy(uint8_t* dest_buf, 469 inline void ConvertBuffer_IndexCopy(uint8_t* dest_buf,
470 int dest_pitch, 470 int dest_pitch,
471 int width, 471 int width,
472 int height, 472 int height,
473 const CFX_DIBSource* pSrcBitmap, 473 const CFX_DIBSource* pSrcBitmap,
474 int src_left, 474 int src_left,
475 int src_top) { 475 int src_top) {
476 if (pSrcBitmap->GetBPP() == 1) { 476 if (pSrcBitmap->GetBPP() == 1) {
477 for (int row = 0; row < height; row++) { 477 for (int row = 0; row < height; row++) {
478 uint8_t* dest_scan = dest_buf + row * dest_pitch; 478 uint8_t* dest_scan = dest_buf + row * dest_pitch;
479 FXSYS_memset(dest_scan, 0, width); 479 FXSYS_memset(dest_scan, 0, width);
480 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); 480 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
481 for (int col = src_left; col < src_left + width; col++) { 481 for (int col = src_left; col < src_left + width; col++) {
482 if (src_scan[col / 8] & (1 << (7 - col % 8))) { 482 if (src_scan[col / 8] & (1 << (7 - col % 8))) {
483 *dest_scan = 1; 483 *dest_scan = 1;
484 } 484 }
485 dest_scan++; 485 dest_scan++;
486 } 486 }
487 } 487 }
488 } else { 488 } else {
489 for (int row = 0; row < height; row++) { 489 for (int row = 0; row < height; row++) {
490 uint8_t* dest_scan = dest_buf + row * dest_pitch; 490 uint8_t* dest_scan = dest_buf + row * dest_pitch;
491 const uint8_t* src_scan = 491 const uint8_t* src_scan =
492 pSrcBitmap->GetScanline(src_top + row) + src_left; 492 pSrcBitmap->GetScanline(src_top + row) + src_left;
493 FXSYS_memcpy(dest_scan, src_scan, width); 493 FXSYS_memcpy(dest_scan, src_scan, width);
494 } 494 }
495 } 495 }
496 } 496 }
497 FX_BOOL _ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf, 497 FX_BOOL ConvertBuffer_Plt2PltRgb8(uint8_t* dest_buf,
498 int dest_pitch, 498 int dest_pitch,
499 int width, 499 int width,
500 int height, 500 int height,
501 const CFX_DIBSource* pSrcBitmap, 501 const CFX_DIBSource* pSrcBitmap,
502 int src_left, 502 int src_left,
503 int src_top, 503 int src_top,
504 FX_DWORD* dst_plt, 504 FX_DWORD* dst_plt,
505 void* pIccTransform) { 505 void* pIccTransform) {
506 _ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap, 506 ConvertBuffer_IndexCopy(dest_buf, dest_pitch, width, height, pSrcBitmap,
507 src_left, src_top); 507 src_left, src_top);
508 FX_DWORD* src_plt = pSrcBitmap->GetPalette(); 508 FX_DWORD* src_plt = pSrcBitmap->GetPalette();
509 int plt_size = pSrcBitmap->GetPaletteSize(); 509 int plt_size = pSrcBitmap->GetPaletteSize();
510 if (pIccTransform) { 510 if (pIccTransform) {
511 FX_DWORD plt[256]; 511 FX_DWORD plt[256];
512 uint8_t* bgr_ptr = (uint8_t*)plt; 512 uint8_t* bgr_ptr = (uint8_t*)plt;
513 if (pSrcBitmap->IsCmykImage()) { 513 if (pSrcBitmap->IsCmykImage()) {
514 for (int i = 0; i < plt_size; i++) { 514 for (int i = 0; i < plt_size; i++) {
515 plt[i] = FXCMYK_TODIB(src_plt[i]); 515 plt[i] = FXCMYK_TODIB(src_plt[i]);
516 } 516 }
517 } else { 517 } else {
(...skipping 20 matching lines...) Expand all
538 FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]), 538 FXSYS_GetCValue(src_plt[i]), FXSYS_GetMValue(src_plt[i]),
539 FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b); 539 FXSYS_GetYValue(src_plt[i]), FXSYS_GetKValue(src_plt[i]), r, g, b);
540 dst_plt[i] = FXARGB_MAKE(0xff, r, g, b); 540 dst_plt[i] = FXARGB_MAKE(0xff, r, g, b);
541 } 541 }
542 } else { 542 } else {
543 FXSYS_memcpy(dst_plt, src_plt, plt_size * 4); 543 FXSYS_memcpy(dst_plt, src_plt, plt_size * 4);
544 } 544 }
545 } 545 }
546 return TRUE; 546 return TRUE;
547 } 547 }
548 inline FX_BOOL _ConvertBuffer_Rgb2PltRgb8_NoTransform( 548 FX_BOOL ConvertBuffer_Rgb2PltRgb8_NoTransform(uint8_t* dest_buf,
549 uint8_t* dest_buf, 549 int dest_pitch,
550 int dest_pitch, 550 int width,
551 int width, 551 int height,
552 int height, 552 const CFX_DIBSource* pSrcBitmap,
553 const CFX_DIBSource* pSrcBitmap, 553 int src_left,
554 int src_left, 554 int src_top,
555 int src_top, 555 FX_DWORD* dst_plt) {
556 FX_DWORD* dst_plt) {
557 int bpp = pSrcBitmap->GetBPP() / 8; 556 int bpp = pSrcBitmap->GetBPP() / 8;
558 int row, col; 557 int row, col;
559 CFX_Palette palette; 558 CFX_Palette palette;
560 palette.BuildPalette(pSrcBitmap, FXDIB_PALETTE_LOC); 559 palette.BuildPalette(pSrcBitmap, FXDIB_PALETTE_LOC);
561 FX_DWORD* cLut = palette.GetColorLut(); 560 FX_DWORD* cLut = palette.GetColorLut();
562 FX_DWORD* aLut = palette.GetAmountLut(); 561 FX_DWORD* aLut = palette.GetAmountLut();
563 if (!cLut || !aLut) { 562 if (!cLut || !aLut) {
564 return FALSE; 563 return FALSE;
565 } 564 }
566 int lut = palette.Getlut(); 565 int lut = palette.Getlut();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 for (int i = lut_1; i >= 0; i--) 600 for (int i = lut_1; i >= 0; i--)
602 if (clrindex == cLut[i]) { 601 if (clrindex == cLut[i]) {
603 *(dest_scan + col) = (uint8_t)(aLut[i]); 602 *(dest_scan + col) = (uint8_t)(aLut[i]);
604 break; 603 break;
605 } 604 }
606 } 605 }
607 } 606 }
608 FXSYS_memcpy(dst_plt, pPalette, sizeof(FX_DWORD) * 256); 607 FXSYS_memcpy(dst_plt, pPalette, sizeof(FX_DWORD) * 256);
609 return TRUE; 608 return TRUE;
610 } 609 }
611 FX_BOOL _ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf, 610 FX_BOOL ConvertBuffer_Rgb2PltRgb8(uint8_t* dest_buf,
612 int dest_pitch, 611 int dest_pitch,
613 int width, 612 int width,
614 int height, 613 int height,
615 const CFX_DIBSource* pSrcBitmap, 614 const CFX_DIBSource* pSrcBitmap,
616 int src_left, 615 int src_left,
617 int src_top, 616 int src_top,
618 FX_DWORD* dst_plt, 617 FX_DWORD* dst_plt,
619 void* pIccTransform) { 618 void* pIccTransform) {
620 #ifdef PDF_ENABLE_XFA 619 FX_BOOL ret = ConvertBuffer_Rgb2PltRgb8_NoTransform(
621 ICodec_IccModule* pIccModule = NULL;
622 if (pIccTransform) {
623 pIccModule = CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
624 }
625 #endif // PDF_ENABLE_XFA
626 FX_BOOL ret = _ConvertBuffer_Rgb2PltRgb8_NoTransform(
627 dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top, 620 dest_buf, dest_pitch, width, height, pSrcBitmap, src_left, src_top,
628 dst_plt); 621 dst_plt);
629 if (ret && pIccTransform) { 622 if (ret && pIccTransform) {
630 ICodec_IccModule* pIccModule = 623 ICodec_IccModule* pIccModule =
631 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 624 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
632 for (int i = 0; i < 256; i++) { 625 for (int i = 0; i < 256; i++) {
633 FX_ARGB* plt = dst_plt + i; 626 FX_ARGB* plt = dst_plt + i;
634 FX_ARGB plt_entry = FXARGB_TODIB(*plt); 627 FX_ARGB plt_entry = FXARGB_TODIB(*plt);
635 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&plt_entry, 628 pIccModule->TranslateScanline(pIccTransform, (uint8_t*)&plt_entry,
636 (const uint8_t*)&plt_entry, 1); 629 (const uint8_t*)&plt_entry, 1);
637 *plt = FXARGB_TODIB(plt_entry); 630 *plt = FXARGB_TODIB(plt_entry);
638 } 631 }
639 } 632 }
640 return ret; 633 return ret;
641 } 634 }
642 FX_BOOL _ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format, 635 FX_BOOL ConvertBuffer_1bppMask2Rgb(FXDIB_Format dst_format,
643 uint8_t* dest_buf, 636 uint8_t* dest_buf,
644 int dest_pitch, 637 int dest_pitch,
645 int width, 638 int width,
646 int height, 639 int height,
647 const CFX_DIBSource* pSrcBitmap, 640 const CFX_DIBSource* pSrcBitmap,
648 int src_left, 641 int src_left,
649 int src_top) { 642 int src_top) {
650 int comps = (dst_format & 0xff) / 8; 643 int comps = (dst_format & 0xff) / 8;
651 uint8_t set_gray, reset_gray; 644 uint8_t set_gray, reset_gray;
652 set_gray = 0xff; 645 set_gray = 0xff;
653 reset_gray = 0x00; 646 reset_gray = 0x00;
654 for (int row = 0; row < height; row++) { 647 for (int row = 0; row < height; row++) {
655 uint8_t* dest_scan = dest_buf + row * dest_pitch; 648 uint8_t* dest_scan = dest_buf + row * dest_pitch;
656 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row); 649 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row);
657 for (int col = src_left; col < src_left + width; col++) { 650 for (int col = src_left; col < src_left + width; col++) {
658 if (src_scan[col / 8] & (1 << (7 - col % 8))) { 651 if (src_scan[col / 8] & (1 << (7 - col % 8))) {
659 dest_scan[0] = set_gray; 652 dest_scan[0] = set_gray;
660 dest_scan[1] = set_gray; 653 dest_scan[1] = set_gray;
661 dest_scan[2] = set_gray; 654 dest_scan[2] = set_gray;
662 } else { 655 } else {
663 dest_scan[0] = reset_gray; 656 dest_scan[0] = reset_gray;
664 dest_scan[1] = reset_gray; 657 dest_scan[1] = reset_gray;
665 dest_scan[2] = reset_gray; 658 dest_scan[2] = reset_gray;
666 } 659 }
667 dest_scan += comps; 660 dest_scan += comps;
668 } 661 }
669 } 662 }
670 return TRUE; 663 return TRUE;
671 } 664 }
672 FX_BOOL _ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format, 665 FX_BOOL ConvertBuffer_8bppMask2Rgb(FXDIB_Format dst_format,
673 uint8_t* dest_buf, 666 uint8_t* dest_buf,
674 int dest_pitch, 667 int dest_pitch,
675 int width, 668 int width,
676 int height, 669 int height,
677 const CFX_DIBSource* pSrcBitmap, 670 const CFX_DIBSource* pSrcBitmap,
678 int src_left, 671 int src_left,
679 int src_top) { 672 int src_top) {
680 int comps = (dst_format & 0xff) / 8; 673 int comps = (dst_format & 0xff) / 8;
681 for (int row = 0; row < height; row++) { 674 for (int row = 0; row < height; row++) {
682 uint8_t* dest_scan = dest_buf + row * dest_pitch; 675 uint8_t* dest_scan = dest_buf + row * dest_pitch;
683 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left; 676 const uint8_t* src_scan = pSrcBitmap->GetScanline(src_top + row) + src_left;
684 uint8_t src_pixel; 677 uint8_t src_pixel;
685 for (int col = 0; col < width; col++) { 678 for (int col = 0; col < width; col++) {
686 src_pixel = *src_scan++; 679 src_pixel = *src_scan++;
687 *dest_scan++ = src_pixel; 680 *dest_scan++ = src_pixel;
688 *dest_scan++ = src_pixel; 681 *dest_scan++ = src_pixel;
689 *dest_scan = src_pixel; 682 *dest_scan = src_pixel;
690 dest_scan += comps - 2; 683 dest_scan += comps - 2;
691 } 684 }
692 } 685 }
693 return TRUE; 686 return TRUE;
694 } 687 }
695 FX_BOOL _ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format, 688 FX_BOOL ConvertBuffer_1bppPlt2Rgb(FXDIB_Format dst_format,
696 uint8_t* dest_buf, 689 uint8_t* dest_buf,
697 int dest_pitch, 690 int dest_pitch,
698 int width, 691 int width,
699 int height, 692 int height,
700 const CFX_DIBSource* pSrcBitmap, 693 const CFX_DIBSource* pSrcBitmap,
701 int src_left, 694 int src_left,
702 int src_top, 695 int src_top,
703 void* pIccTransform) { 696 void* pIccTransform) {
704 int comps = (dst_format & 0xff) / 8; 697 int comps = (dst_format & 0xff) / 8;
705 FX_DWORD* src_plt = pSrcBitmap->GetPalette(); 698 FX_DWORD* src_plt = pSrcBitmap->GetPalette();
706 FX_DWORD plt[2]; 699 FX_DWORD plt[2];
707 uint8_t* bgr_ptr = (uint8_t*)plt; 700 uint8_t* bgr_ptr = (uint8_t*)plt;
708 if (pSrcBitmap->IsCmykImage()) { 701 if (pSrcBitmap->IsCmykImage()) {
709 plt[0] = FXCMYK_TODIB(src_plt[0]); 702 plt[0] = FXCMYK_TODIB(src_plt[0]);
710 plt[1] = FXCMYK_TODIB(src_plt[1]); 703 plt[1] = FXCMYK_TODIB(src_plt[1]);
711 } else { 704 } else {
712 bgr_ptr[0] = FXARGB_B(src_plt[0]); 705 bgr_ptr[0] = FXARGB_B(src_plt[0]);
713 bgr_ptr[1] = FXARGB_G(src_plt[0]); 706 bgr_ptr[1] = FXARGB_G(src_plt[0]);
(...skipping 30 matching lines...) Expand all
744 } else { 737 } else {
745 *dest_scan++ = bgr_ptr[0]; 738 *dest_scan++ = bgr_ptr[0];
746 *dest_scan++ = bgr_ptr[1]; 739 *dest_scan++ = bgr_ptr[1];
747 *dest_scan = bgr_ptr[2]; 740 *dest_scan = bgr_ptr[2];
748 } 741 }
749 dest_scan += comps - 2; 742 dest_scan += comps - 2;
750 } 743 }
751 } 744 }
752 return TRUE; 745 return TRUE;
753 } 746 }
754 FX_BOOL _ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format, 747 FX_BOOL ConvertBuffer_8bppPlt2Rgb(FXDIB_Format dst_format,
755 uint8_t* dest_buf, 748 uint8_t* dest_buf,
756 int dest_pitch, 749 int dest_pitch,
757 int width, 750 int width,
758 int height, 751 int height,
759 const CFX_DIBSource* pSrcBitmap, 752 const CFX_DIBSource* pSrcBitmap,
760 int src_left, 753 int src_left,
761 int src_top, 754 int src_top,
762 void* pIccTransform) { 755 void* pIccTransform) {
763 int comps = (dst_format & 0xff) / 8; 756 int comps = (dst_format & 0xff) / 8;
764 FX_DWORD* src_plt = pSrcBitmap->GetPalette(); 757 FX_DWORD* src_plt = pSrcBitmap->GetPalette();
765 FX_DWORD plt[256]; 758 FX_DWORD plt[256];
766 uint8_t* bgr_ptr = (uint8_t*)plt; 759 uint8_t* bgr_ptr = (uint8_t*)plt;
767 if (!pSrcBitmap->IsCmykImage()) { 760 if (!pSrcBitmap->IsCmykImage()) {
768 for (int i = 0; i < 256; i++) { 761 for (int i = 0; i < 256; i++) {
769 *bgr_ptr++ = FXARGB_B(src_plt[i]); 762 *bgr_ptr++ = FXARGB_B(src_plt[i]);
770 *bgr_ptr++ = FXARGB_G(src_plt[i]); 763 *bgr_ptr++ = FXARGB_G(src_plt[i]);
771 *bgr_ptr++ = FXARGB_R(src_plt[i]); 764 *bgr_ptr++ = FXARGB_R(src_plt[i]);
772 } 765 }
(...skipping 27 matching lines...) Expand all
800 for (int col = 0; col < width; col++) { 793 for (int col = 0; col < width; col++) {
801 uint8_t* src_pixel = bgr_ptr + 3 * (*src_scan++); 794 uint8_t* src_pixel = bgr_ptr + 3 * (*src_scan++);
802 *dest_scan++ = *src_pixel++; 795 *dest_scan++ = *src_pixel++;
803 *dest_scan++ = *src_pixel++; 796 *dest_scan++ = *src_pixel++;
804 *dest_scan = *src_pixel++; 797 *dest_scan = *src_pixel++;
805 dest_scan += comps - 2; 798 dest_scan += comps - 2;
806 } 799 }
807 } 800 }
808 return TRUE; 801 return TRUE;
809 } 802 }
810 FX_BOOL _ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf, 803 FX_BOOL ConvertBuffer_24bppRgb2Rgb24(uint8_t* dest_buf,
811 int dest_pitch, 804 int dest_pitch,
812 int width, 805 int width,
813 int height, 806 int height,
814 const CFX_DIBSource* pSrcBitmap, 807 const CFX_DIBSource* pSrcBitmap,
815 int src_left, 808 int src_left,
816 int src_top, 809 int src_top,
817 void* pIccTransform) { 810 void* pIccTransform) {
818 if (pIccTransform) { 811 if (pIccTransform) {
819 ICodec_IccModule* pIccModule = 812 ICodec_IccModule* pIccModule =
820 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 813 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
821 for (int row = 0; row < height; row++) { 814 for (int row = 0; row < height; row++) {
822 uint8_t* dest_scan = dest_buf + row * dest_pitch; 815 uint8_t* dest_scan = dest_buf + row * dest_pitch;
823 const uint8_t* src_scan = 816 const uint8_t* src_scan =
824 pSrcBitmap->GetScanline(src_top + row) + src_left * 3; 817 pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
825 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width); 818 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, width);
826 } 819 }
827 } else { 820 } else {
828 for (int row = 0; row < height; row++) { 821 for (int row = 0; row < height; row++) {
829 uint8_t* dest_scan = dest_buf + row * dest_pitch; 822 uint8_t* dest_scan = dest_buf + row * dest_pitch;
830 const uint8_t* src_scan = 823 const uint8_t* src_scan =
831 pSrcBitmap->GetScanline(src_top + row) + src_left * 3; 824 pSrcBitmap->GetScanline(src_top + row) + src_left * 3;
832 FXSYS_memcpy(dest_scan, src_scan, width * 3); 825 FXSYS_memcpy(dest_scan, src_scan, width * 3);
833 } 826 }
834 } 827 }
835 return TRUE; 828 return TRUE;
836 } 829 }
837 FX_BOOL _ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf, 830 FX_BOOL ConvertBuffer_32bppRgb2Rgb24(uint8_t* dest_buf,
838 int dest_pitch, 831 int dest_pitch,
839 int width, 832 int width,
840 int height, 833 int height,
841 const CFX_DIBSource* pSrcBitmap, 834 const CFX_DIBSource* pSrcBitmap,
842 int src_left, 835 int src_left,
843 int src_top, 836 int src_top,
844 void* pIccTransform) { 837 void* pIccTransform) {
845 for (int row = 0; row < height; row++) { 838 for (int row = 0; row < height; row++) {
846 uint8_t* dest_scan = dest_buf + row * dest_pitch; 839 uint8_t* dest_scan = dest_buf + row * dest_pitch;
847 const uint8_t* src_scan = 840 const uint8_t* src_scan =
848 pSrcBitmap->GetScanline(src_top + row) + src_left * 4; 841 pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
849 for (int col = 0; col < width; col++) { 842 for (int col = 0; col < width; col++) {
850 *dest_scan++ = *src_scan++; 843 *dest_scan++ = *src_scan++;
851 *dest_scan++ = *src_scan++; 844 *dest_scan++ = *src_scan++;
852 *dest_scan++ = *src_scan++; 845 *dest_scan++ = *src_scan++;
853 src_scan++; 846 src_scan++;
854 } 847 }
855 } 848 }
856 if (pIccTransform) { 849 if (pIccTransform) {
857 ICodec_IccModule* pIccModule = 850 ICodec_IccModule* pIccModule =
858 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 851 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
859 for (int row = 0; row < height; row++) { 852 for (int row = 0; row < height; row++) {
860 uint8_t* dest_scan = dest_buf + row * dest_pitch; 853 uint8_t* dest_scan = dest_buf + row * dest_pitch;
861 pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width); 854 pIccModule->TranslateScanline(pIccTransform, dest_scan, dest_scan, width);
862 } 855 }
863 } 856 }
864 return TRUE; 857 return TRUE;
865 } 858 }
866 FX_BOOL _ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf, 859 FX_BOOL ConvertBuffer_Rgb2Rgb32(uint8_t* dest_buf,
867 int dest_pitch, 860 int dest_pitch,
868 int width, 861 int width,
869 int height, 862 int height,
870 const CFX_DIBSource* pSrcBitmap, 863 const CFX_DIBSource* pSrcBitmap,
871 int src_left, 864 int src_left,
872 int src_top, 865 int src_top,
873 void* pIccTransform) { 866 void* pIccTransform) {
874 int comps = pSrcBitmap->GetBPP() / 8; 867 int comps = pSrcBitmap->GetBPP() / 8;
875 if (pIccTransform) { 868 if (pIccTransform) {
876 ICodec_IccModule* pIccModule = 869 ICodec_IccModule* pIccModule =
877 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 870 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
878 for (int row = 0; row < height; row++) { 871 for (int row = 0; row < height; row++) {
879 uint8_t* dest_scan = dest_buf + row * dest_pitch; 872 uint8_t* dest_scan = dest_buf + row * dest_pitch;
880 const uint8_t* src_scan = 873 const uint8_t* src_scan =
881 pSrcBitmap->GetScanline(src_top + row) + src_left * comps; 874 pSrcBitmap->GetScanline(src_top + row) + src_left * comps;
882 for (int col = 0; col < width; col++) { 875 for (int col = 0; col < width; col++) {
883 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); 876 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
(...skipping 10 matching lines...) Expand all
894 *dest_scan++ = *src_scan++; 887 *dest_scan++ = *src_scan++;
895 *dest_scan++ = *src_scan++; 888 *dest_scan++ = *src_scan++;
896 *dest_scan++ = *src_scan++; 889 *dest_scan++ = *src_scan++;
897 dest_scan++; 890 dest_scan++;
898 src_scan += comps - 3; 891 src_scan += comps - 3;
899 } 892 }
900 } 893 }
901 } 894 }
902 return TRUE; 895 return TRUE;
903 } 896 }
904 FX_BOOL _ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf, 897 FX_BOOL ConvertBuffer_32bppCmyk2Rgb32(uint8_t* dest_buf,
905 int dest_pitch, 898 int dest_pitch,
906 int width, 899 int width,
907 int height, 900 int height,
908 const CFX_DIBSource* pSrcBitmap, 901 const CFX_DIBSource* pSrcBitmap,
909 int src_left, 902 int src_left,
910 int src_top, 903 int src_top,
911 void* pIccTransform) { 904 void* pIccTransform) {
912 if (pIccTransform) { 905 if (pIccTransform) {
913 ICodec_IccModule* pIccModule = 906 ICodec_IccModule* pIccModule =
914 CFX_GEModule::Get()->GetCodecModule()->GetIccModule(); 907 CFX_GEModule::Get()->GetCodecModule()->GetIccModule();
915 for (int row = 0; row < height; row++) { 908 for (int row = 0; row < height; row++) {
916 uint8_t* dest_scan = dest_buf + row * dest_pitch; 909 uint8_t* dest_scan = dest_buf + row * dest_pitch;
917 const uint8_t* src_scan = 910 const uint8_t* src_scan =
918 pSrcBitmap->GetScanline(src_top + row) + src_left * 4; 911 pSrcBitmap->GetScanline(src_top + row) + src_left * 4;
919 for (int col = 0; col < width; col++) { 912 for (int col = 0; col < width; col++) {
920 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1); 913 pIccModule->TranslateScanline(pIccTransform, dest_scan, src_scan, 1);
921 dest_scan += 4; 914 dest_scan += 4;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 switch (dest_format) { 948 switch (dest_format) {
956 case FXDIB_Invalid: 949 case FXDIB_Invalid:
957 case FXDIB_1bppCmyk: 950 case FXDIB_1bppCmyk:
958 case FXDIB_1bppMask: 951 case FXDIB_1bppMask:
959 case FXDIB_1bppRgb: 952 case FXDIB_1bppRgb:
960 ASSERT(FALSE); 953 ASSERT(FALSE);
961 return FALSE; 954 return FALSE;
962 case FXDIB_8bppMask: { 955 case FXDIB_8bppMask: {
963 if ((src_format & 0xff) == 1) { 956 if ((src_format & 0xff) == 1) {
964 if (pSrcBitmap->GetPalette()) { 957 if (pSrcBitmap->GetPalette()) {
965 return _ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, 958 return ConvertBuffer_1bppPlt2Gray(dest_buf, dest_pitch, width, height,
966 height, pSrcBitmap, src_left, 959 pSrcBitmap, src_left, src_top,
967 src_top, pIccTransform); 960 pIccTransform);
968 } 961 }
969 return _ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, width, height, 962 return ConvertBuffer_1bppMask2Gray(dest_buf, dest_pitch, width, height,
970 pSrcBitmap, src_left, src_top); 963 pSrcBitmap, src_left, src_top);
971 } 964 }
972 if ((src_format & 0xff) == 8) { 965 if ((src_format & 0xff) == 8) {
973 if (pSrcBitmap->GetPalette()) { 966 if (pSrcBitmap->GetPalette()) {
974 return _ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, 967 return ConvertBuffer_8bppPlt2Gray(dest_buf, dest_pitch, width, height,
975 height, pSrcBitmap, src_left, 968 pSrcBitmap, src_left, src_top,
976 src_top, pIccTransform); 969 pIccTransform);
977 } 970 }
978 return _ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, width, height, 971 return ConvertBuffer_8bppMask2Gray(dest_buf, dest_pitch, width, height,
979 pSrcBitmap, src_left, src_top); 972 pSrcBitmap, src_left, src_top);
980 } 973 }
981 if ((src_format & 0xff) >= 24) { 974 if ((src_format & 0xff) >= 24) {
982 return _ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, 975 return ConvertBuffer_RgbOrCmyk2Gray(dest_buf, dest_pitch, width, height,
983 height, pSrcBitmap, src_left, 976 pSrcBitmap, src_left, src_top,
984 src_top, pIccTransform); 977 pIccTransform);
985 } 978 }
986 return FALSE; 979 return FALSE;
987 } 980 }
988 case FXDIB_8bppRgb: 981 case FXDIB_8bppRgb:
989 case FXDIB_8bppRgba: { 982 case FXDIB_8bppRgba: {
990 if ((src_format & 0xff) == 8 && !pSrcBitmap->GetPalette()) { 983 if ((src_format & 0xff) == 8 && !pSrcBitmap->GetPalette()) {
991 return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width, 984 return ConvertBuffer(FXDIB_8bppMask, dest_buf, dest_pitch, width,
992 height, pSrcBitmap, src_left, src_top, d_pal, 985 height, pSrcBitmap, src_left, src_top, d_pal,
993 pIccTransform); 986 pIccTransform);
994 } 987 }
995 d_pal = FX_Alloc(FX_DWORD, 256); 988 d_pal = FX_Alloc(FX_DWORD, 256);
996 if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) && 989 if (((src_format & 0xff) == 1 || (src_format & 0xff) == 8) &&
997 pSrcBitmap->GetPalette()) { 990 pSrcBitmap->GetPalette()) {
998 return _ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height, 991 return ConvertBuffer_Plt2PltRgb8(dest_buf, dest_pitch, width, height,
999 pSrcBitmap, src_left, src_top, d_pal, 992 pSrcBitmap, src_left, src_top, d_pal,
1000 pIccTransform); 993 pIccTransform);
1001 } 994 }
1002 if ((src_format & 0xff) >= 24) { 995 if ((src_format & 0xff) >= 24) {
1003 return _ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height, 996 return ConvertBuffer_Rgb2PltRgb8(dest_buf, dest_pitch, width, height,
1004 pSrcBitmap, src_left, src_top, d_pal, 997 pSrcBitmap, src_left, src_top, d_pal,
1005 pIccTransform); 998 pIccTransform);
1006 } 999 }
1007 return FALSE; 1000 return FALSE;
1008 } 1001 }
1009 case FXDIB_Rgb: 1002 case FXDIB_Rgb:
1010 case FXDIB_Rgba: { 1003 case FXDIB_Rgba: {
1011 if ((src_format & 0xff) == 1) { 1004 if ((src_format & 0xff) == 1) {
1012 if (pSrcBitmap->GetPalette()) { 1005 if (pSrcBitmap->GetPalette()) {
1013 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, 1006 return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
1014 width, height, pSrcBitmap, src_left, 1007 width, height, pSrcBitmap, src_left,
1015 src_top, pIccTransform); 1008 src_top, pIccTransform);
1016 } 1009 }
1017 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch, 1010 return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
1018 width, height, pSrcBitmap, src_left, 1011 width, height, pSrcBitmap, src_left,
1019 src_top); 1012 src_top);
1020 } 1013 }
1021 if ((src_format & 0xff) == 8) { 1014 if ((src_format & 0xff) == 8) {
1022 if (pSrcBitmap->GetPalette()) { 1015 if (pSrcBitmap->GetPalette()) {
1023 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, 1016 return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
1024 width, height, pSrcBitmap, src_left, 1017 width, height, pSrcBitmap, src_left,
1025 src_top, pIccTransform); 1018 src_top, pIccTransform);
1026 } 1019 }
1027 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch, 1020 return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
1028 width, height, pSrcBitmap, src_left, 1021 width, height, pSrcBitmap, src_left,
1029 src_top); 1022 src_top);
1030 } 1023 }
1031 if ((src_format & 0xff) == 24) { 1024 if ((src_format & 0xff) == 24) {
1032 return _ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, width, 1025 return ConvertBuffer_24bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
1033 height, pSrcBitmap, src_left, 1026 pSrcBitmap, src_left, src_top,
1034 src_top, pIccTransform); 1027 pIccTransform);
1035 } 1028 }
1036 if ((src_format & 0xff) == 32) { 1029 if ((src_format & 0xff) == 32) {
1037 return _ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, 1030 return ConvertBuffer_32bppRgb2Rgb24(dest_buf, dest_pitch, width, height,
1038 height, pSrcBitmap, src_left, 1031 pSrcBitmap, src_left, src_top,
1039 src_top, pIccTransform); 1032 pIccTransform);
1040 } 1033 }
1041 return FALSE; 1034 return FALSE;
1042 } 1035 }
1043 case FXDIB_Argb: 1036 case FXDIB_Argb:
1044 case FXDIB_Rgb32: { 1037 case FXDIB_Rgb32: {
1045 if ((src_format & 0xff) == 1) { 1038 if ((src_format & 0xff) == 1) {
1046 if (pSrcBitmap->GetPalette()) { 1039 if (pSrcBitmap->GetPalette()) {
1047 return _ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch, 1040 return ConvertBuffer_1bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
1048 width, height, pSrcBitmap, src_left, 1041 width, height, pSrcBitmap, src_left,
1049 src_top, pIccTransform); 1042 src_top, pIccTransform);
1050 } 1043 }
1051 return _ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch, 1044 return ConvertBuffer_1bppMask2Rgb(dest_format, dest_buf, dest_pitch,
1052 width, height, pSrcBitmap, src_left, 1045 width, height, pSrcBitmap, src_left,
1053 src_top); 1046 src_top);
1054 } 1047 }
1055 if ((src_format & 0xff) == 8) { 1048 if ((src_format & 0xff) == 8) {
1056 if (pSrcBitmap->GetPalette()) { 1049 if (pSrcBitmap->GetPalette()) {
1057 return _ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch, 1050 return ConvertBuffer_8bppPlt2Rgb(dest_format, dest_buf, dest_pitch,
1058 width, height, pSrcBitmap, src_left, 1051 width, height, pSrcBitmap, src_left,
1059 src_top, pIccTransform); 1052 src_top, pIccTransform);
1060 } 1053 }
1061 return _ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch, 1054 return ConvertBuffer_8bppMask2Rgb(dest_format, dest_buf, dest_pitch,
1062 width, height, pSrcBitmap, src_left, 1055 width, height, pSrcBitmap, src_left,
1063 src_top); 1056 src_top);
1064 } 1057 }
1065 if ((src_format & 0xff) >= 24) { 1058 if ((src_format & 0xff) >= 24) {
1066 if (src_format & 0x0400) { 1059 if (src_format & 0x0400) {
1067 return _ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pitch, width, 1060 return ConvertBuffer_32bppCmyk2Rgb32(dest_buf, dest_pitch, width,
1068 height, pSrcBitmap, src_left, 1061 height, pSrcBitmap, src_left,
1069 src_top, pIccTransform); 1062 src_top, pIccTransform);
1070 } 1063 }
1071 return _ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height, 1064 return ConvertBuffer_Rgb2Rgb32(dest_buf, dest_pitch, width, height,
1072 pSrcBitmap, src_left, src_top, 1065 pSrcBitmap, src_left, src_top,
1073 pIccTransform); 1066 pIccTransform);
1074 } 1067 }
1075 return FALSE; 1068 return FALSE;
1076 } 1069 }
1077 default: 1070 default:
1078 return FALSE; 1071 return FALSE;
1079 } 1072 }
1080 return FALSE; 1073 return FALSE;
1081 } 1074 }
1082 CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, 1075 CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format,
1083 const FX_RECT* pClip, 1076 const FX_RECT* pClip,
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 if (!m_bExtBuf) { 1217 if (!m_bExtBuf) {
1225 FX_Free(m_pBuffer); 1218 FX_Free(m_pBuffer);
1226 } 1219 }
1227 m_bExtBuf = FALSE; 1220 m_bExtBuf = FALSE;
1228 m_pBuffer = dest_buf; 1221 m_pBuffer = dest_buf;
1229 m_bpp = (uint8_t)dest_format; 1222 m_bpp = (uint8_t)dest_format;
1230 m_AlphaFlag = (uint8_t)(dest_format >> 8); 1223 m_AlphaFlag = (uint8_t)(dest_format >> 8);
1231 m_Pitch = dest_pitch; 1224 m_Pitch = dest_pitch;
1232 return TRUE; 1225 return TRUE;
1233 } 1226 }
OLDNEW
« no previous file with comments | « core/src/fxcodec/lgif/fx_gif.cpp ('k') | fpdfsdk/src/fsdk_baseannot.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698