OLD | NEW |
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 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 class SkWEBPImageEncoder : public SkImageEncoder { | 514 class SkWEBPImageEncoder : public SkImageEncoder { |
515 protected: | 515 protected: |
516 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK
_OVERRIDE; | 516 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK
_OVERRIDE; |
517 | 517 |
518 private: | 518 private: |
519 typedef SkImageEncoder INHERITED; | 519 typedef SkImageEncoder INHERITED; |
520 }; | 520 }; |
521 | 521 |
522 bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm, | 522 bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm, |
523 int quality) { | 523 int quality) { |
524 const SkBitmap::Config config = bm.getConfig(); | 524 const SkBitmap::Config config = bm.config(); |
525 const ScanlineImporter scanline_import = ChooseImporter(config); | 525 const ScanlineImporter scanline_import = ChooseImporter(config); |
526 if (NULL == scanline_import) { | 526 if (NULL == scanline_import) { |
527 return false; | 527 return false; |
528 } | 528 } |
529 | 529 |
530 SkAutoLockPixels alp(bm); | 530 SkAutoLockPixels alp(bm); |
531 SkAutoLockColors ctLocker; | 531 SkAutoLockColors ctLocker; |
532 if (NULL == bm.getPixels()) { | 532 if (NULL == bm.getPixels()) { |
533 return false; | 533 return false; |
534 } | 534 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 return SkImageDecoder::kUnknown_Format; | 590 return SkImageDecoder::kUnknown_Format; |
591 } | 591 } |
592 | 592 |
593 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { | 593 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { |
594 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; | 594 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL
L; |
595 } | 595 } |
596 | 596 |
597 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); | 597 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); |
598 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); | 598 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); |
599 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); | 599 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); |
OLD | NEW |