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

Side by Side Diff: src/images/SkImageDecoder_libwebp.cpp

Issue 248613004: Fast path for blurred round rects -- blur a small 9patch rect on the CPU (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: merge fully with Mike's new reorg" Created 6 years, 7 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 | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010, The Android Open Source Project 2 * Copyright 2010, The Android Open Source Project
3 * 3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License. 5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at 6 * You may obtain a copy of the License at
7 * 7 *
8 * http://www.apache.org/licenses/LICENSE-2.0 8 * http://www.apache.org/licenses/LICENSE-2.0
9 * 9 *
10 * Unless required by applicable law or agreed to in writing, software 10 * Unless required by applicable law or agreed to in writing, software
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 const uint8_t* SK_RESTRICT src = (const uint8_t*)in; 552 const uint8_t* SK_RESTRICT src = (const uint8_t*)in;
553 for (int i = 0; i < width; ++i) { 553 for (int i = 0; i < width; ++i) {
554 const uint32_t c = ctable[*src++]; 554 const uint32_t c = ctable[*src++];
555 rgb[0] = SkGetPackedR32(c); 555 rgb[0] = SkGetPackedR32(c);
556 rgb[1] = SkGetPackedG32(c); 556 rgb[1] = SkGetPackedG32(c);
557 rgb[2] = SkGetPackedB32(c); 557 rgb[2] = SkGetPackedB32(c);
558 rgb += 3; 558 rgb += 3;
559 } 559 }
560 } 560 }
561 561
562 static void Alpha8_To_RGB(const uint8_t* in, uint8_t* rgb, int width,
563 const SkPMColor* SK_RESTRICT ctable) {
564 const uint8_t* SK_RESTRICT src = (const uint8_t*)in;
565 for (int i = 0; i < width; ++i) {
566 rgb[0] = rgb[1] = rgb[2] = *src++;
567 rgb += 3;
568 }
569 }
570
571 static ScanlineImporter ChooseImporter(const SkBitmap::Config& config, 562 static ScanlineImporter ChooseImporter(const SkBitmap::Config& config,
572 bool hasAlpha, 563 bool hasAlpha,
573 int* bpp) { 564 int* bpp) {
574 switch (config) { 565 switch (config) {
575 case SkBitmap::kARGB_8888_Config: 566 case SkBitmap::kARGB_8888_Config:
576 if (hasAlpha) { 567 if (hasAlpha) {
577 *bpp = 4; 568 *bpp = 4;
578 return ARGB_8888_To_RGBA; 569 return ARGB_8888_To_RGBA;
579 } else { 570 } else {
580 *bpp = 3; 571 *bpp = 3;
581 return ARGB_8888_To_RGB; 572 return ARGB_8888_To_RGB;
582 } 573 }
583 case SkBitmap::kARGB_4444_Config: 574 case SkBitmap::kARGB_4444_Config:
584 if (hasAlpha) { 575 if (hasAlpha) {
585 *bpp = 4; 576 *bpp = 4;
586 return ARGB_4444_To_RGBA; 577 return ARGB_4444_To_RGBA;
587 } else { 578 } else {
588 *bpp = 3; 579 *bpp = 3;
589 return ARGB_4444_To_RGB; 580 return ARGB_4444_To_RGB;
590 } 581 }
591 case SkBitmap::kRGB_565_Config: 582 case SkBitmap::kRGB_565_Config:
592 *bpp = 3; 583 *bpp = 3;
593 return RGB_565_To_RGB; 584 return RGB_565_To_RGB;
594 case SkBitmap::kIndex8_Config: 585 case SkBitmap::kIndex8_Config:
595 *bpp = 3; 586 *bpp = 3;
596 return Index8_To_RGB; 587 return Index8_To_RGB;
597 case SkBitmap::kA8_Config:
598 *bpp = 3;
599 return Alpha8_To_RGB;
600 default: 588 default:
601 return NULL; 589 return NULL;
602 } 590 }
603 } 591 }
604 592
605 static int stream_writer(const uint8_t* data, size_t data_size, 593 static int stream_writer(const uint8_t* data, size_t data_size,
606 const WebPPicture* const picture) { 594 const WebPPicture* const picture) {
607 SkWStream* const stream = (SkWStream*)picture->custom_ptr; 595 SkWStream* const stream = (SkWStream*)picture->custom_ptr;
608 return stream->write(data, data_size) ? 1 : 0; 596 return stream->write(data, data_size) ? 1 : 0;
609 } 597 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 return SkImageDecoder::kUnknown_Format; 686 return SkImageDecoder::kUnknown_Format;
699 } 687 }
700 688
701 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { 689 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) {
702 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L; 690 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L;
703 } 691 }
704 692
705 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); 693 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory);
706 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); 694 static SkImageDecoder_FormatReg gFormatReg(get_format_webp);
707 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); 695 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory);
OLDNEW
« no previous file with comments | « src/effects/SkBlurMaskFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698