| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkOpts.h" | 10 #include "SkOpts.h" |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 | 341 |
| 342 // This function must not be called if we are sampling. If we are not | 342 // This function must not be called if we are sampling. If we are not |
| 343 // sampling, deltaSrc should equal bpp. | 343 // sampling, deltaSrc should equal bpp. |
| 344 SkASSERT(deltaSrc == bpp); | 344 SkASSERT(deltaSrc == bpp); |
| 345 | 345 |
| 346 // Note that there is no need to distinguish between rgb and bgr. | 346 // Note that there is no need to distinguish between rgb and bgr. |
| 347 // Each color channel will get the same value. | 347 // Each color channel will get the same value. |
| 348 SkOpts::grayA_to_rgbA((uint32_t*) dst, src + offset, width); | 348 SkOpts::grayA_to_rgbA((uint32_t*) dst, src + offset, width); |
| 349 } | 349 } |
| 350 | 350 |
| 351 // kBGRX | 351 // kBGR |
| 352 | 352 |
| 353 static void swizzle_bgrx_to_n32( | 353 static void swizzle_bgr_to_565( |
| 354 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 354 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 355 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 355 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 356 | 356 |
| 357 src += offset; | |
| 358 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | |
| 359 for (int x = 0; x < dstWidth; x++) { | |
| 360 dst[x] = SkPackARGB32NoCheck(0xFF, src[2], src[1], src[0]); | |
| 361 src += deltaSrc; | |
| 362 } | |
| 363 } | |
| 364 | |
| 365 static void swizzle_bgrx_to_565( | |
| 366 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | |
| 367 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | |
| 368 | |
| 369 src += offset; | 357 src += offset; |
| 370 uint16_t* SK_RESTRICT dst = (uint16_t*)dstRow; | 358 uint16_t* SK_RESTRICT dst = (uint16_t*)dstRow; |
| 371 for (int x = 0; x < dstWidth; x++) { | 359 for (int x = 0; x < dstWidth; x++) { |
| 372 dst[x] = SkPack888ToRGB16(src[2], src[1], src[0]); | 360 dst[x] = SkPack888ToRGB16(src[2], src[1], src[0]); |
| 373 src += deltaSrc; | 361 src += deltaSrc; |
| 374 } | 362 } |
| 375 } | 363 } |
| 376 | 364 |
| 377 // kBGRA | 365 // kRGB |
| 378 | 366 |
| 379 static void swizzle_bgra_to_n32_unpremul( | 367 static void swizzle_rgb_to_rgba( |
| 380 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 368 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 381 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 369 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 382 | 370 |
| 383 src += offset; | 371 src += offset; |
| 384 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 372 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
| 385 for (int x = 0; x < dstWidth; x++) { | 373 for (int x = 0; x < dstWidth; x++) { |
| 386 uint8_t alpha = src[3]; | 374 dst[x] = SkPackARGB_as_RGBA(0xFF, src[0], src[1], src[2]); |
| 387 dst[x] = SkPackARGB32NoCheck(alpha, src[2], src[1], src[0]); | |
| 388 src += deltaSrc; | 375 src += deltaSrc; |
| 389 } | 376 } |
| 390 } | 377 } |
| 391 | 378 |
| 392 static void fast_swizzle_bgra_to_n32_unpremul( | 379 static void swizzle_rgb_to_bgra( |
| 393 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, | |
| 394 const SkPMColor ctable[]) { | |
| 395 | |
| 396 // This function must not be called if we are sampling. If we are not | |
| 397 // sampling, deltaSrc should equal bpp. | |
| 398 SkASSERT(deltaSrc == bpp); | |
| 399 | |
| 400 #ifdef SK_PMCOLOR_IS_RGBA | |
| 401 SkOpts::RGBA_to_BGRA((uint32_t*) dst, src + offset, width); | |
| 402 #else | |
| 403 memcpy(dst, src + offset, width * bpp); | |
| 404 #endif | |
| 405 } | |
| 406 | |
| 407 static void swizzle_bgra_to_n32_premul( | |
| 408 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 380 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 409 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 381 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 410 | 382 |
| 411 src += offset; | 383 src += offset; |
| 412 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 384 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
| 413 for (int x = 0; x < dstWidth; x++) { | 385 for (int x = 0; x < dstWidth; x++) { |
| 414 uint8_t alpha = src[3]; | 386 dst[x] = SkPackARGB_as_BGRA(0xFF, src[0], src[1], src[2]); |
| 415 dst[x] = SkPremultiplyARGBInline(alpha, src[2], src[1], src[0]); | |
| 416 src += deltaSrc; | 387 src += deltaSrc; |
| 417 } | 388 } |
| 418 } | 389 } |
| 419 | 390 |
| 420 static void fast_swizzle_bgra_to_n32_premul( | 391 static void fast_swizzle_rgb_to_rgba( |
| 421 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, | 392 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
| 422 const SkPMColor ctable[]) { | 393 int offset, const SkPMColor ctable[]) { |
| 423 | 394 |
| 424 // This function must not be called if we are sampling. If we are not | 395 // This function must not be called if we are sampling. If we are not |
| 425 // sampling, deltaSrc should equal bpp. | 396 // sampling, deltaSrc should equal bpp. |
| 426 SkASSERT(deltaSrc == bpp); | 397 SkASSERT(deltaSrc == bpp); |
| 427 | 398 |
| 428 #ifdef SK_PMCOLOR_IS_RGBA | 399 SkOpts::RGB_to_RGB1((uint32_t*) dst, src + offset, width); |
| 429 SkOpts::RGBA_to_bgrA((uint32_t*) dst, src + offset, width); | |
| 430 #else | |
| 431 SkOpts::RGBA_to_rgbA((uint32_t*) dst, src + offset, width); | |
| 432 #endif | |
| 433 } | 400 } |
| 434 | 401 |
| 435 // kRGB | 402 static void fast_swizzle_rgb_to_bgra( |
| 436 | |
| 437 static void swizzle_rgb_to_n32( | |
| 438 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | |
| 439 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | |
| 440 | |
| 441 src += offset; | |
| 442 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | |
| 443 for (int x = 0; x < dstWidth; x++) { | |
| 444 dst[x] = SkPackARGB32NoCheck(0xFF, src[0], src[1], src[2]); | |
| 445 src += deltaSrc; | |
| 446 } | |
| 447 } | |
| 448 | |
| 449 static void fast_swizzle_rgb_to_n32( | |
| 450 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, | 403 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
| 451 int offset, const SkPMColor ctable[]) { | 404 int offset, const SkPMColor ctable[]) { |
| 452 | 405 |
| 453 // This function must not be called if we are sampling. If we are not | 406 // This function must not be called if we are sampling. If we are not |
| 454 // sampling, deltaSrc should equal bpp. | 407 // sampling, deltaSrc should equal bpp. |
| 455 SkASSERT(deltaSrc == bpp); | 408 SkASSERT(deltaSrc == bpp); |
| 456 | 409 |
| 457 #ifdef SK_PMCOLOR_IS_RGBA | |
| 458 SkOpts::RGB_to_RGB1((uint32_t*) dst, src + offset, width); | |
| 459 #else | |
| 460 SkOpts::RGB_to_BGR1((uint32_t*) dst, src + offset, width); | 410 SkOpts::RGB_to_BGR1((uint32_t*) dst, src + offset, width); |
| 461 #endif | |
| 462 } | 411 } |
| 463 | 412 |
| 464 static void swizzle_rgb_to_565( | 413 static void swizzle_rgb_to_565( |
| 465 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 414 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 466 int bytesPerPixel, int deltaSrc, int offset, const SkPMColor ctable[]) { | 415 int bytesPerPixel, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 467 | 416 |
| 468 src += offset; | 417 src += offset; |
| 469 uint16_t* SK_RESTRICT dst = (uint16_t*)dstRow; | 418 uint16_t* SK_RESTRICT dst = (uint16_t*)dstRow; |
| 470 for (int x = 0; x < dstWidth; x++) { | 419 for (int x = 0; x < dstWidth; x++) { |
| 471 dst[x] = SkPack888ToRGB16(src[0], src[1], src[2]); | 420 dst[x] = SkPack888ToRGB16(src[0], src[1], src[2]); |
| 472 src += deltaSrc; | 421 src += deltaSrc; |
| 473 } | 422 } |
| 474 } | 423 } |
| 475 | 424 |
| 476 // kRGBA | 425 // kRGBA |
| 477 | 426 |
| 478 static void swizzle_rgba_to_n32_premul( | 427 static void swizzle_rgba_to_rgba_premul( |
| 479 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 428 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 480 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 429 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 481 | 430 |
| 482 src += offset; | 431 src += offset; |
| 483 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 432 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
| 484 for (int x = 0; x < dstWidth; x++) { | 433 for (int x = 0; x < dstWidth; x++) { |
| 485 unsigned alpha = src[3]; | 434 dst[x] = premultiply_argb_as_rgba(src[3], src[0], src[1], src[2]); |
| 486 dst[x] = SkPremultiplyARGBInline(alpha, src[0], src[1], src[2]); | |
| 487 src += deltaSrc; | 435 src += deltaSrc; |
| 488 } | 436 } |
| 489 } | 437 } |
| 490 | 438 |
| 491 static void fast_swizzle_rgba_to_n32_premul( | 439 static void swizzle_rgba_to_bgra_premul( |
| 440 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 441 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 442 |
| 443 src += offset; |
| 444 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
| 445 for (int x = 0; x < dstWidth; x++) { |
| 446 dst[x] = premultiply_argb_as_bgra(src[3], src[0], src[1], src[2]); |
| 447 src += deltaSrc; |
| 448 } |
| 449 } |
| 450 |
| 451 static void fast_swizzle_rgba_to_rgba_premul( |
| 492 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, | 452 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
| 493 int offset, const SkPMColor ctable[]) { | 453 int offset, const SkPMColor ctable[]) { |
| 494 | 454 |
| 495 // This function must not be called if we are sampling. If we are not | 455 // This function must not be called if we are sampling. If we are not |
| 496 // sampling, deltaSrc should equal bpp. | 456 // sampling, deltaSrc should equal bpp. |
| 497 SkASSERT(deltaSrc == bpp); | 457 SkASSERT(deltaSrc == bpp); |
| 498 | 458 |
| 499 #ifdef SK_PMCOLOR_IS_RGBA | |
| 500 SkOpts::RGBA_to_rgbA((uint32_t*) dst, src + offset, width); | 459 SkOpts::RGBA_to_rgbA((uint32_t*) dst, src + offset, width); |
| 501 #else | |
| 502 SkOpts::RGBA_to_bgrA((uint32_t*) dst, src + offset, width); | |
| 503 #endif | |
| 504 } | 460 } |
| 505 | 461 |
| 506 static void swizzle_rgba_to_n32_unpremul( | 462 static void fast_swizzle_rgba_to_bgra_premul( |
| 463 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
| 464 int offset, const SkPMColor ctable[]) { |
| 465 |
| 466 // This function must not be called if we are sampling. If we are not |
| 467 // sampling, deltaSrc should equal bpp. |
| 468 SkASSERT(deltaSrc == bpp); |
| 469 |
| 470 SkOpts::RGBA_to_bgrA((uint32_t*) dst, src + offset, width); |
| 471 } |
| 472 |
| 473 static void swizzle_rgba_to_bgra_unpremul( |
| 507 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 474 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 508 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 475 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 509 | 476 |
| 510 src += offset; | 477 src += offset; |
| 511 uint32_t* SK_RESTRICT dst = reinterpret_cast<uint32_t*>(dstRow); | 478 uint32_t* SK_RESTRICT dst = reinterpret_cast<uint32_t*>(dstRow); |
| 512 for (int x = 0; x < dstWidth; x++) { | 479 for (int x = 0; x < dstWidth; x++) { |
| 513 unsigned alpha = src[3]; | 480 unsigned alpha = src[3]; |
| 514 dst[x] = SkPackARGB32NoCheck(alpha, src[0], src[1], src[2]); | 481 dst[x] = SkPackARGB_as_BGRA(alpha, src[0], src[1], src[2]); |
| 515 src += deltaSrc; | 482 src += deltaSrc; |
| 516 } | 483 } |
| 517 } | 484 } |
| 518 | 485 |
| 519 static void fast_swizzle_rgba_to_n32_unpremul( | 486 static void fast_swizzle_rgba_to_bgra_unpremul( |
| 520 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, | 487 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, |
| 521 const SkPMColor ctable[]) { | 488 const SkPMColor ctable[]) { |
| 522 | 489 |
| 523 // This function must not be called if we are sampling. If we are not | 490 // This function must not be called if we are sampling. If we are not |
| 524 // sampling, deltaSrc should equal bpp. | 491 // sampling, deltaSrc should equal bpp. |
| 525 SkASSERT(deltaSrc == bpp); | 492 SkASSERT(deltaSrc == bpp); |
| 526 | 493 |
| 527 #ifdef SK_PMCOLOR_IS_RGBA | |
| 528 memcpy(dst, src + offset, width * bpp); | |
| 529 #else | |
| 530 SkOpts::RGBA_to_BGRA((uint32_t*) dst, src + offset, width); | 494 SkOpts::RGBA_to_BGRA((uint32_t*) dst, src + offset, width); |
| 531 #endif | |
| 532 } | 495 } |
| 533 | 496 |
| 534 // kCMYK | 497 // kCMYK |
| 535 // | 498 // |
| 536 // CMYK is stored as four bytes per pixel. | 499 // CMYK is stored as four bytes per pixel. |
| 537 // | 500 // |
| 538 // We will implement a crude conversion from CMYK -> RGB using formulas | 501 // We will implement a crude conversion from CMYK -> RGB using formulas |
| 539 // from easyrgb.com. | 502 // from easyrgb.com. |
| 540 // | 503 // |
| 541 // CMYK -> CMY | 504 // CMYK -> CMY |
| (...skipping 27 matching lines...) Expand all Loading... |
| 569 // B = Y * K * 255 | 532 // B = Y * K * 255 |
| 570 // | 533 // |
| 571 // As a final note, we have treated the CMYK values as if they were on | 534 // As a final note, we have treated the CMYK values as if they were on |
| 572 // a scale from 0-1, when in fact they are 8-bit ints scaling from 0-255. | 535 // a scale from 0-1, when in fact they are 8-bit ints scaling from 0-255. |
| 573 // We must divide each CMYK component by 255 to obtain the true conversion | 536 // We must divide each CMYK component by 255 to obtain the true conversion |
| 574 // we should perform. | 537 // we should perform. |
| 575 // CMYK -> RGB | 538 // CMYK -> RGB |
| 576 // R = C * K / 255 | 539 // R = C * K / 255 |
| 577 // G = M * K / 255 | 540 // G = M * K / 255 |
| 578 // B = Y * K / 255 | 541 // B = Y * K / 255 |
| 579 static void swizzle_cmyk_to_n32( | 542 static void swizzle_cmyk_to_rgba( |
| 580 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 543 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 581 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 544 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 582 | 545 |
| 546 src += offset; |
| 547 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
| 548 for (int x = 0; x < dstWidth; x++) { |
| 549 const uint8_t r = SkMulDiv255Round(src[0], src[3]); |
| 550 const uint8_t g = SkMulDiv255Round(src[1], src[3]); |
| 551 const uint8_t b = SkMulDiv255Round(src[2], src[3]); |
| 552 |
| 553 dst[x] = SkPackARGB_as_RGBA(0xFF, r, g, b); |
| 554 src += deltaSrc; |
| 555 } |
| 556 } |
| 557 |
| 558 static void swizzle_cmyk_to_bgra( |
| 559 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 560 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 561 |
| 583 src += offset; | 562 src += offset; |
| 584 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; | 563 SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
| 585 for (int x = 0; x < dstWidth; x++) { | 564 for (int x = 0; x < dstWidth; x++) { |
| 586 const uint8_t r = SkMulDiv255Round(src[0], src[3]); | 565 const uint8_t r = SkMulDiv255Round(src[0], src[3]); |
| 587 const uint8_t g = SkMulDiv255Round(src[1], src[3]); | 566 const uint8_t g = SkMulDiv255Round(src[1], src[3]); |
| 588 const uint8_t b = SkMulDiv255Round(src[2], src[3]); | 567 const uint8_t b = SkMulDiv255Round(src[2], src[3]); |
| 589 | 568 |
| 590 dst[x] = SkPackARGB32NoCheck(0xFF, r, g, b); | 569 dst[x] = SkPackARGB_as_BGRA(0xFF, r, g, b); |
| 591 src += deltaSrc; | 570 src += deltaSrc; |
| 592 } | 571 } |
| 593 } | 572 } |
| 594 | 573 |
| 595 static void fast_swizzle_cmyk_to_n32( | 574 static void fast_swizzle_cmyk_to_rgba( |
| 596 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, | 575 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, |
| 597 const SkPMColor ctable[]) { | 576 const SkPMColor ctable[]) { |
| 598 | 577 |
| 599 // This function must not be called if we are sampling. If we are not | 578 // This function must not be called if we are sampling. If we are not |
| 600 // sampling, deltaSrc should equal bpp. | 579 // sampling, deltaSrc should equal bpp. |
| 601 SkASSERT(deltaSrc == bpp); | 580 SkASSERT(deltaSrc == bpp); |
| 602 | 581 |
| 603 #ifdef SK_PMCOLOR_IS_RGBA | |
| 604 SkOpts::inverted_CMYK_to_RGB1((uint32_t*) dst, src + offset, width); | 582 SkOpts::inverted_CMYK_to_RGB1((uint32_t*) dst, src + offset, width); |
| 605 #else | 583 } |
| 584 |
| 585 static void fast_swizzle_cmyk_to_bgra( |
| 586 void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int off
set, |
| 587 const SkPMColor ctable[]) { |
| 588 |
| 589 // This function must not be called if we are sampling. If we are not |
| 590 // sampling, deltaSrc should equal bpp. |
| 591 SkASSERT(deltaSrc == bpp); |
| 592 |
| 606 SkOpts::inverted_CMYK_to_BGR1((uint32_t*) dst, src + offset, width); | 593 SkOpts::inverted_CMYK_to_BGR1((uint32_t*) dst, src + offset, width); |
| 607 #endif | |
| 608 } | 594 } |
| 609 | 595 |
| 610 static void swizzle_cmyk_to_565( | 596 static void swizzle_cmyk_to_565( |
| 611 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, | 597 void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
| 612 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { | 598 int bpp, int deltaSrc, int offset, const SkPMColor ctable[]) { |
| 613 | 599 |
| 614 src += offset; | 600 src += offset; |
| 615 uint16_t* SK_RESTRICT dst = (uint16_t*)dstRow; | 601 uint16_t* SK_RESTRICT dst = (uint16_t*)dstRow; |
| 616 for (int x = 0; x < dstWidth; x++) { | 602 for (int x = 0; x < dstWidth; x++) { |
| 617 const uint8_t r = SkMulDiv255Round(src[0], src[3]); | 603 const uint8_t r = SkMulDiv255Round(src[0], src[3]); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 // This may miss opportunities to skip when the output is premultiplied, | 640 // This may miss opportunities to skip when the output is premultiplied, |
| 655 // e.g. for a src pixel 0x00FFFFFF which is not zero but becomes zero after
premultiplication. | 641 // e.g. for a src pixel 0x00FFFFFF which is not zero but becomes zero after
premultiplication. |
| 656 while (dstWidth > 0 && *src32 == 0x00000000) { | 642 while (dstWidth > 0 && *src32 == 0x00000000) { |
| 657 dstWidth--; | 643 dstWidth--; |
| 658 dst32++; | 644 dst32++; |
| 659 src32 += deltaSrc/4; | 645 src32 += deltaSrc/4; |
| 660 } | 646 } |
| 661 proc(dst32, (const uint8_t*)src32, dstWidth, bpp, deltaSrc, 0, ctable); | 647 proc(dst32, (const uint8_t*)src32, dstWidth, bpp, deltaSrc, 0, ctable); |
| 662 } | 648 } |
| 663 | 649 |
| 664 SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, | 650 SkSwizzler* SkSwizzler::CreateSwizzler(const SkEncodedInfo& encodedInfo, |
| 665 const SkPMColor* ctable, | 651 const SkPMColor* ctable, |
| 666 const SkImageInfo& dstInfo, | 652 const SkImageInfo& dstInfo, |
| 667 const SkCodec::Options& options, | 653 const SkCodec::Options& options, |
| 668 const SkIRect* frame) { | 654 const SkIRect* frame) { |
| 669 if (dstInfo.colorType() == kUnknown_SkColorType || kUnknown == sc) { | 655 if (SkEncodedInfo::kPalette_Color == encodedInfo.color() && nullptr == ctabl
e) { |
| 670 return nullptr; | 656 return nullptr; |
| 671 } | 657 } |
| 672 if ((kIndex == sc || kIndex4 == sc || kIndex2 == sc || kIndex1 == sc) | 658 |
| 673 && nullptr == ctable) { | |
| 674 return nullptr; | |
| 675 } | |
| 676 RowProc fastProc = nullptr; | 659 RowProc fastProc = nullptr; |
| 677 RowProc proc = nullptr; | 660 RowProc proc = nullptr; |
| 678 SkCodec::ZeroInitialized zeroInit = options.fZeroInitialized; | 661 SkCodec::ZeroInitialized zeroInit = options.fZeroInitialized; |
| 679 switch (sc) { | 662 bool premultiply = (SkEncodedInfo::kOpaque_Alpha != encodedInfo.alpha()) && |
| 680 case kBit: | 663 (kPremul_SkAlphaType == dstInfo.alphaType()); |
| 681 switch (dstInfo.colorType()) { | 664 switch (encodedInfo.color()) { |
| 682 case kN32_SkColorType: | 665 case SkEncodedInfo::kGray_Color: |
| 683 proc = &swizzle_bit_to_n32; | 666 switch (encodedInfo.bitsPerComponent()) { |
| 684 break; | 667 case 1: |
| 685 case kIndex_8_SkColorType: | 668 switch (dstInfo.colorType()) { |
| 686 proc = &swizzle_bit_to_index; | 669 case kRGBA_8888_SkColorType: |
| 687 break; | 670 case kBGRA_8888_SkColorType: |
| 688 case kRGB_565_SkColorType: | 671 proc = &swizzle_bit_to_n32; |
| 689 proc = &swizzle_bit_to_565; | 672 break; |
| 690 break; | 673 case kIndex_8_SkColorType: |
| 691 case kGray_8_SkColorType: | 674 proc = &swizzle_bit_to_index; |
| 692 proc = &swizzle_bit_to_grayscale; | 675 break; |
| 693 break; | 676 case kRGB_565_SkColorType: |
| 694 default: | 677 proc = &swizzle_bit_to_565; |
| 695 break; | 678 break; |
| 696 } | 679 case kGray_8_SkColorType: |
| 697 break; | 680 proc = &swizzle_bit_to_grayscale; |
| 698 case kIndex1: | 681 break; |
| 699 case kIndex2: | 682 default: |
| 700 case kIndex4: | 683 return nullptr; |
| 701 switch (dstInfo.colorType()) { | 684 } |
| 702 case kN32_SkColorType: | 685 break; |
| 703 proc = &swizzle_small_index_to_n32; | 686 case 8: |
| 704 break; | 687 switch (dstInfo.colorType()) { |
| 705 case kRGB_565_SkColorType: | 688 case kRGBA_8888_SkColorType: |
| 706 proc = &swizzle_small_index_to_565; | 689 case kBGRA_8888_SkColorType: |
| 707 break; | 690 proc = &swizzle_gray_to_n32; |
| 708 case kIndex_8_SkColorType: | 691 fastProc = &fast_swizzle_gray_to_n32; |
| 709 proc = &swizzle_small_index_to_index; | 692 break; |
| 710 break; | 693 case kGray_8_SkColorType: |
| 711 default: | 694 proc = &sample1; |
| 712 break; | 695 fastProc = © |
| 713 } | 696 break; |
| 714 break; | 697 case kRGB_565_SkColorType: |
| 715 case kIndex: | 698 proc = &swizzle_gray_to_565; |
| 716 switch (dstInfo.colorType()) { | 699 break; |
| 717 case kN32_SkColorType: | 700 default: |
| 718 // We assume the color premultiplied ctable (or not) as desi
red. | 701 return nullptr; |
| 719 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 702 } |
| 720 proc = &swizzle_index_to_n32_skipZ; | 703 break; |
| 721 break; | 704 default: |
| 722 } else { | 705 return nullptr; |
| 723 proc = &swizzle_index_to_n32; | 706 } |
| 724 break; | 707 break; |
| 725 } | 708 case SkEncodedInfo::kGrayAlpha_Color: |
| 726 break; | 709 switch (dstInfo.colorType()) { |
| 727 case kRGB_565_SkColorType: | 710 case kRGBA_8888_SkColorType: |
| 728 proc = &swizzle_index_to_565; | 711 case kBGRA_8888_SkColorType: |
| 729 break; | 712 if (premultiply) { |
| 730 case kIndex_8_SkColorType: | 713 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 731 proc = &sample1; | 714 proc = &SkipLeadingGrayAlphaZerosThen<swizzle_grayal
pha_to_n32_premul>; |
| 732 fastProc = © | 715 fastProc = &SkipLeadingGrayAlphaZerosThen |
| 733 break; | 716 <fast_swizzle_grayalpha_to_n32_premul>; |
| 734 default: | 717 } else { |
| 735 break; | 718 proc = &swizzle_grayalpha_to_n32_premul; |
| 736 } | 719 fastProc = &fast_swizzle_grayalpha_to_n32_premul; |
| 737 break; | 720 } |
| 738 case kGray: | 721 } else { |
| 739 switch (dstInfo.colorType()) { | |
| 740 case kN32_SkColorType: | |
| 741 proc = &swizzle_gray_to_n32; | |
| 742 fastProc = &fast_swizzle_gray_to_n32; | |
| 743 break; | |
| 744 case kGray_8_SkColorType: | |
| 745 proc = &sample1; | |
| 746 fastProc = © | |
| 747 break; | |
| 748 case kRGB_565_SkColorType: | |
| 749 proc = &swizzle_gray_to_565; | |
| 750 break; | |
| 751 default: | |
| 752 break; | |
| 753 } | |
| 754 break; | |
| 755 case kGrayAlpha: | |
| 756 switch (dstInfo.colorType()) { | |
| 757 case kN32_SkColorType: | |
| 758 if (dstInfo.alphaType() == kUnpremul_SkAlphaType) { | |
| 759 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 722 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 760 proc = &SkipLeadingGrayAlphaZerosThen | 723 proc = &SkipLeadingGrayAlphaZerosThen |
| 761 <swizzle_grayalpha_to_n32_unpremul>; | 724 <swizzle_grayalpha_to_n32_unpremul>; |
| 762 fastProc = &SkipLeadingGrayAlphaZerosThen | 725 fastProc = &SkipLeadingGrayAlphaZerosThen |
| 763 <fast_swizzle_grayalpha_to_n32_unpremul>; | 726 <fast_swizzle_grayalpha_to_n32_unpremul>; |
| 764 } else { | 727 } else { |
| 765 proc = &swizzle_grayalpha_to_n32_unpremul; | 728 proc = &swizzle_grayalpha_to_n32_unpremul; |
| 766 fastProc = &fast_swizzle_grayalpha_to_n32_unpremul; | 729 fastProc = &fast_swizzle_grayalpha_to_n32_unpremul; |
| 767 } | 730 } |
| 768 } else { | 731 } |
| 769 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 732 break; |
| 770 proc = &SkipLeadingGrayAlphaZerosThen<swizzle_grayal
pha_to_n32_premul>; | 733 default: |
| 771 fastProc = &SkipLeadingGrayAlphaZerosThen | 734 return nullptr; |
| 772 <fast_swizzle_grayalpha_to_n32_premul>; | 735 } |
| 773 } else { | 736 break; |
| 774 proc = &swizzle_grayalpha_to_n32_premul; | 737 case SkEncodedInfo::kPalette_Color: |
| 775 fastProc = &fast_swizzle_grayalpha_to_n32_premul; | 738 // We assumes that the color table is premultiplied and swizzled |
| 776 } | 739 // as desired. |
| 777 } | 740 switch (encodedInfo.bitsPerComponent()) { |
| 778 break; | 741 case 1: |
| 779 default: | 742 case 2: |
| 780 break; | 743 case 4: |
| 781 } | 744 switch (dstInfo.colorType()) { |
| 782 break; | 745 case kRGBA_8888_SkColorType: |
| 783 case kBGR: | 746 case kBGRA_8888_SkColorType: |
| 784 case kBGRX: | 747 proc = &swizzle_small_index_to_n32; |
| 785 switch (dstInfo.colorType()) { | 748 break; |
| 786 case kN32_SkColorType: | 749 case kRGB_565_SkColorType: |
| 787 proc = &swizzle_bgrx_to_n32; | 750 proc = &swizzle_small_index_to_565; |
| 788 break; | 751 break; |
| 789 case kRGB_565_SkColorType: | 752 case kIndex_8_SkColorType: |
| 790 proc = &swizzle_bgrx_to_565; | 753 proc = &swizzle_small_index_to_index; |
| 791 break; | 754 break; |
| 792 default: | 755 default: |
| 793 break; | 756 return nullptr; |
| 794 } | 757 } |
| 795 break; | 758 break; |
| 796 case kBGRA: | 759 case 8: |
| 797 switch (dstInfo.colorType()) { | 760 switch (dstInfo.colorType()) { |
| 798 case kN32_SkColorType: | 761 case kRGBA_8888_SkColorType: |
| 799 if (dstInfo.alphaType() == kUnpremul_SkAlphaType) { | 762 case kBGRA_8888_SkColorType: |
| 800 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 763 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 801 proc = &SkipLeading8888ZerosThen<swizzle_bgra_to_n32
_unpremul>; | 764 proc = &swizzle_index_to_n32_skipZ; |
| 802 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_bg
ra_to_n32_unpremul>; | 765 } else { |
| 803 } else { | 766 proc = &swizzle_index_to_n32; |
| 804 proc = &swizzle_bgra_to_n32_unpremul; | 767 } |
| 805 fastProc = &fast_swizzle_bgra_to_n32_unpremul; | 768 break; |
| 806 } | 769 case kRGB_565_SkColorType: |
| 807 } else { | 770 proc = &swizzle_index_to_565; |
| 808 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 771 break; |
| 809 proc = &SkipLeading8888ZerosThen<swizzle_bgra_to_n32
_premul>; | 772 case kIndex_8_SkColorType: |
| 810 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_bg
ra_to_n32_premul>; | 773 proc = &sample1; |
| 811 } else { | 774 fastProc = © |
| 812 proc = &swizzle_bgra_to_n32_premul; | 775 break; |
| 813 fastProc = &fast_swizzle_bgra_to_n32_premul; | 776 default: |
| 814 } | 777 return nullptr; |
| 815 } | 778 } |
| 816 break; | 779 break; |
| 817 default: | 780 default: |
| 818 break; | 781 return nullptr; |
| 819 } | 782 } |
| 820 break; | 783 break; |
| 821 case kRGB: | 784 case SkEncodedInfo::kRGB_Color: |
| 822 switch (dstInfo.colorType()) { | 785 switch (dstInfo.colorType()) { |
| 823 case kN32_SkColorType: | 786 case kRGBA_8888_SkColorType: |
| 824 proc = &swizzle_rgb_to_n32; | 787 proc = &swizzle_rgb_to_rgba; |
| 825 fastProc = &fast_swizzle_rgb_to_n32; | 788 fastProc = &fast_swizzle_rgb_to_rgba; |
| 789 break; |
| 790 case kBGRA_8888_SkColorType: |
| 791 proc = &swizzle_rgb_to_bgra; |
| 792 fastProc = &fast_swizzle_rgb_to_bgra; |
| 826 break; | 793 break; |
| 827 case kRGB_565_SkColorType: | 794 case kRGB_565_SkColorType: |
| 828 proc = &swizzle_rgb_to_565; | 795 proc = &swizzle_rgb_to_565; |
| 829 break; | 796 break; |
| 830 default: | 797 default: |
| 831 break; | 798 return nullptr; |
| 832 } | 799 } |
| 833 break; | 800 break; |
| 834 case kRGBA: | 801 case SkEncodedInfo::kRGBA_Color: |
| 835 switch (dstInfo.colorType()) { | 802 switch (dstInfo.colorType()) { |
| 836 case kN32_SkColorType: | 803 case kRGBA_8888_SkColorType: |
| 837 if (dstInfo.alphaType() == kUnpremul_SkAlphaType) { | 804 if (premultiply) { |
| 838 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 805 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 839 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_n32
_unpremul>; | 806 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgb
a_premul>; |
| 840 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rg
ba_to_n32_unpremul>; | 807 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rg
ba_to_rgba_premul>; |
| 841 } else { | 808 } else { |
| 842 proc = &swizzle_rgba_to_n32_unpremul; | 809 proc = &swizzle_rgba_to_rgba_premul; |
| 843 fastProc = &fast_swizzle_rgba_to_n32_unpremul; | 810 fastProc = &fast_swizzle_rgba_to_rgba_premul; |
| 844 } | 811 } |
| 845 } else { | 812 } else { |
| 846 if (SkCodec::kYes_ZeroInitialized == zeroInit) { | 813 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 847 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_n32
_premul>; | 814 proc = &SkipLeading8888ZerosThen<sample4>; |
| 848 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rg
ba_to_n32_premul>; | 815 fastProc = &SkipLeading8888ZerosThen<copy>; |
| 849 } else { | 816 } else { |
| 850 proc = &swizzle_rgba_to_n32_premul; | 817 proc = &sample4; |
| 851 fastProc = &fast_swizzle_rgba_to_n32_premul; | 818 fastProc = © |
| 852 } | 819 } |
| 853 } | 820 } |
| 854 break; | 821 break; |
| 855 default: | 822 case kBGRA_8888_SkColorType: |
| 856 break; | 823 if (premultiply) { |
| 857 } | 824 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 858 break; | 825 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgr
a_premul>; |
| 859 case kCMYK: | 826 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rg
ba_to_bgra_premul>; |
| 860 switch (dstInfo.colorType()) { | 827 } else { |
| 861 case kN32_SkColorType: | 828 proc = &swizzle_rgba_to_bgra_premul; |
| 862 proc = &swizzle_cmyk_to_n32; | 829 fastProc = &fast_swizzle_rgba_to_bgra_premul; |
| 863 fastProc = &fast_swizzle_cmyk_to_n32; | 830 } |
| 831 } else { |
| 832 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 833 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgr
a_unpremul>; |
| 834 fastProc = &SkipLeading8888ZerosThen |
| 835 <fast_swizzle_rgba_to_bgra_unpremul>; |
| 836 } else { |
| 837 proc = &swizzle_rgba_to_bgra_unpremul; |
| 838 fastProc = &fast_swizzle_rgba_to_bgra_unpremul; |
| 839 } |
| 840 } |
| 841 break; |
| 842 default: |
| 843 return nullptr; |
| 844 } |
| 845 break; |
| 846 case SkEncodedInfo::kBGR_Color: |
| 847 switch (dstInfo.colorType()) { |
| 848 case kBGRA_8888_SkColorType: |
| 849 proc = &swizzle_rgb_to_rgba; |
| 850 fastProc = &fast_swizzle_rgb_to_rgba; |
| 851 break; |
| 852 case kRGBA_8888_SkColorType: |
| 853 proc = &swizzle_rgb_to_bgra; |
| 854 fastProc = &fast_swizzle_rgb_to_bgra; |
| 855 break; |
| 856 case kRGB_565_SkColorType: |
| 857 proc = &swizzle_bgr_to_565; |
| 858 break; |
| 859 default: |
| 860 return nullptr; |
| 861 } |
| 862 break; |
| 863 case SkEncodedInfo::kBGRX_Color: |
| 864 switch (dstInfo.colorType()) { |
| 865 case kBGRA_8888_SkColorType: |
| 866 proc = &swizzle_rgb_to_rgba; |
| 867 break; |
| 868 case kRGBA_8888_SkColorType: |
| 869 proc = &swizzle_rgb_to_bgra; |
| 870 break; |
| 871 case kRGB_565_SkColorType: |
| 872 proc = &swizzle_bgr_to_565; |
| 873 break; |
| 874 default: |
| 875 return nullptr; |
| 876 } |
| 877 break; |
| 878 case SkEncodedInfo::kBGRA_Color: |
| 879 switch (dstInfo.colorType()) { |
| 880 case kBGRA_8888_SkColorType: |
| 881 if (premultiply) { |
| 882 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 883 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_rgb
a_premul>; |
| 884 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rg
ba_to_rgba_premul>; |
| 885 } else { |
| 886 proc = &swizzle_rgba_to_rgba_premul; |
| 887 fastProc = &fast_swizzle_rgba_to_rgba_premul; |
| 888 } |
| 889 } else { |
| 890 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 891 proc = &SkipLeading8888ZerosThen<sample4>; |
| 892 fastProc = &SkipLeading8888ZerosThen<copy>; |
| 893 } else { |
| 894 proc = &sample4; |
| 895 fastProc = © |
| 896 } |
| 897 } |
| 898 break; |
| 899 case kRGBA_8888_SkColorType: |
| 900 if (premultiply) { |
| 901 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 902 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgr
a_premul>; |
| 903 fastProc = &SkipLeading8888ZerosThen<fast_swizzle_rg
ba_to_bgra_premul>; |
| 904 } else { |
| 905 proc = &swizzle_rgba_to_bgra_premul; |
| 906 fastProc = &fast_swizzle_rgba_to_bgra_premul; |
| 907 } |
| 908 } else { |
| 909 if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
| 910 proc = &SkipLeading8888ZerosThen<swizzle_rgba_to_bgr
a_unpremul>; |
| 911 fastProc = &SkipLeading8888ZerosThen |
| 912 <fast_swizzle_rgba_to_bgra_unpremul>; |
| 913 } else { |
| 914 proc = &swizzle_rgba_to_bgra_unpremul; |
| 915 fastProc = &fast_swizzle_rgba_to_bgra_unpremul; |
| 916 } |
| 917 } |
| 918 break; |
| 919 default: |
| 920 return nullptr; |
| 921 } |
| 922 break; |
| 923 case SkEncodedInfo::kInvertedCMYK_Color: |
| 924 switch (dstInfo.colorType()) { |
| 925 case kRGBA_8888_SkColorType: |
| 926 proc = &swizzle_cmyk_to_rgba; |
| 927 fastProc = &fast_swizzle_cmyk_to_rgba; |
| 928 break; |
| 929 case kBGRA_8888_SkColorType: |
| 930 proc = &swizzle_cmyk_to_bgra; |
| 931 fastProc = &fast_swizzle_cmyk_to_bgra; |
| 864 break; | 932 break; |
| 865 case kRGB_565_SkColorType: | 933 case kRGB_565_SkColorType: |
| 866 proc = &swizzle_cmyk_to_565; | 934 proc = &swizzle_cmyk_to_565; |
| 867 break; | 935 break; |
| 868 default: | 936 default: |
| 869 break; | 937 return nullptr; |
| 870 } | 938 } |
| 871 break; | 939 break; |
| 872 case kNoOp8: | 940 case SkEncodedInfo::kUnknown_Color: |
| 873 proc = &sample1; | 941 // Use kUnknown to indicate that we don't need to swizzle. The |
| 874 fastProc = © | 942 // encoded format already matches the output format. |
| 875 break; | 943 switch (dstInfo.colorType()) { |
| 876 case kNoOp16: | 944 case kRGB_565_SkColorType: |
| 877 proc = sample2; | 945 proc = &sample2; |
| 878 fastProc = © | 946 fastProc = © |
| 879 break; | 947 break; |
| 880 case kNoOp32: | 948 default: |
| 881 proc = &sample4; | 949 return nullptr; |
| 882 fastProc = © | 950 } |
| 883 break; | 951 break; |
| 884 default: | 952 default: |
| 885 break; | 953 return nullptr; |
| 886 } | 954 } |
| 887 | 955 |
| 888 // Store bpp in bytes if it is an even multiple, otherwise use bits | 956 // Store bpp in bytes if it is an even multiple, otherwise use bits |
| 889 int srcBPP = SkIsAlign8(BitsPerPixel(sc)) ? BytesPerPixel(sc) : BitsPerPixel
(sc); | 957 uint8_t bitsPerPixel = encodedInfo.bitsPerPixel(); |
| 958 int srcBPP = SkIsAlign8(bitsPerPixel) ? encodedInfo.bytesPerPixel() : bitsPe
rPixel; |
| 890 int dstBPP = SkColorTypeBytesPerPixel(dstInfo.colorType()); | 959 int dstBPP = SkColorTypeBytesPerPixel(dstInfo.colorType()); |
| 891 | 960 |
| 892 int srcOffset = 0; | 961 int srcOffset = 0; |
| 893 int srcWidth = dstInfo.width(); | 962 int srcWidth = dstInfo.width(); |
| 894 int dstOffset = 0; | 963 int dstOffset = 0; |
| 895 int dstWidth = srcWidth; | 964 int dstWidth = srcWidth; |
| 896 if (options.fSubset) { | 965 if (options.fSubset) { |
| 897 // We do not currently support subset decodes for image types that may h
ave | 966 // We do not currently support subset decodes for image types that may h
ave |
| 898 // frames (gif). | 967 // frames (gif). |
| 899 SkASSERT(!frame); | 968 SkASSERT(!frame); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 947 } | 1016 } |
| 948 | 1017 |
| 949 return fAllocatedWidth; | 1018 return fAllocatedWidth; |
| 950 } | 1019 } |
| 951 | 1020 |
| 952 void SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) { | 1021 void SkSwizzler::swizzle(void* dst, const uint8_t* SK_RESTRICT src) { |
| 953 SkASSERT(nullptr != dst && nullptr != src); | 1022 SkASSERT(nullptr != dst && nullptr != src); |
| 954 fActualProc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fS
rcBPP, | 1023 fActualProc(SkTAddOffset<void>(dst, fDstOffsetBytes), src, fSwizzleWidth, fS
rcBPP, |
| 955 fSampleX * fSrcBPP, fSrcOffsetUnits, fColorTable); | 1024 fSampleX * fSrcBPP, fSrcOffsetUnits, fColorTable); |
| 956 } | 1025 } |
| OLD | NEW |