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

Side by Side Diff: third_party/libwebp/enc/picture.c

Issue 10496016: Add RGBX BGRX support to WEBPImportPicture (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comment nits. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « third_party/libwebp/README.chromium ('k') | third_party/libwebp/webp/encode.h » ('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 2011 Google Inc. 1 // Copyright 2011 Google Inc.
2 // 2 //
3 // This code is licensed under the same terms as WebM: 3 // This code is licensed under the same terms as WebM:
4 // Software License Agreement: http://www.webmproject.org/license/software/ 4 // Software License Agreement: http://www.webmproject.org/license/software/
5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/ 5 // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 // ----------------------------------------------------------------------------- 6 // -----------------------------------------------------------------------------
7 // 7 //
8 // WebPPicture utils: colorspace conversion, crop, ... 8 // WebPPicture utils: colorspace conversion, crop, ...
9 // 9 //
10 // Author: Skal (pascal.massimino@gmail.com) 10 // Author: Skal (pascal.massimino@gmail.com)
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 return Import(picture, rgba, rgba_stride, 4, 0, 1); 586 return Import(picture, rgba, rgba_stride, 4, 0, 1);
587 } 587 }
588 588
589 int WebPPictureImportBGRA(WebPPicture* const picture, 589 int WebPPictureImportBGRA(WebPPicture* const picture,
590 const uint8_t* const rgba, int rgba_stride) { 590 const uint8_t* const rgba, int rgba_stride) {
591 picture->colorspace |= WEBP_CSP_ALPHA_BIT; 591 picture->colorspace |= WEBP_CSP_ALPHA_BIT;
592 if (!WebPPictureAlloc(picture)) return 0; 592 if (!WebPPictureAlloc(picture)) return 0;
593 return Import(picture, rgba, rgba_stride, 4, 1, 1); 593 return Import(picture, rgba, rgba_stride, 4, 1, 1);
594 } 594 }
595 595
596 int WebPPictureImportRGBX(WebPPicture* const picture,
597 const uint8_t* const rgba, int rgba_stride) {
598 picture->colorspace &= ~WEBP_CSP_ALPHA_BIT;
599 if (!WebPPictureAlloc(picture)) return 0;
600 return Import(picture, rgba, rgba_stride, 4, 0, 0);
601 }
602
603 int WebPPictureImportBGRX(WebPPicture* const picture,
604 const uint8_t* const rgba, int rgba_stride) {
605 picture->colorspace &= ~WEBP_CSP_ALPHA_BIT;
606 if (!WebPPictureAlloc(picture)) return 0;
607 return Import(picture, rgba, rgba_stride, 4, 1, 0);
608 }
609
596 //------------------------------------------------------------------------------ 610 //------------------------------------------------------------------------------
597 // Simplest call: 611 // Simplest call:
598 612
599 typedef int (*Importer)(WebPPicture* const, const uint8_t* const, int); 613 typedef int (*Importer)(WebPPicture* const, const uint8_t* const, int);
600 614
601 static size_t Encode(const uint8_t* rgba, int width, int height, int stride, 615 static size_t Encode(const uint8_t* rgba, int width, int height, int stride,
602 Importer import, float quality_factor, uint8_t** output) { 616 Importer import, float quality_factor, uint8_t** output) {
603 size_t output_size = 0; 617 size_t output_size = 0;
604 WebPPicture pic; 618 WebPPicture pic;
605 WebPConfig config; 619 WebPConfig config;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 ENCODE_FUNC(WebPEncodeRGBA, WebPPictureImportRGBA); 655 ENCODE_FUNC(WebPEncodeRGBA, WebPPictureImportRGBA);
642 ENCODE_FUNC(WebPEncodeBGRA, WebPPictureImportBGRA); 656 ENCODE_FUNC(WebPEncodeBGRA, WebPPictureImportBGRA);
643 657
644 #undef ENCODE_FUNC 658 #undef ENCODE_FUNC
645 659
646 //------------------------------------------------------------------------------ 660 //------------------------------------------------------------------------------
647 661
648 #if defined(__cplusplus) || defined(c_plusplus) 662 #if defined(__cplusplus) || defined(c_plusplus)
649 } // extern "C" 663 } // extern "C"
650 #endif 664 #endif
OLDNEW
« no previous file with comments | « third_party/libwebp/README.chromium ('k') | third_party/libwebp/webp/encode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698