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

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

Issue 806653007: Fix up all the easy virtual ... SK_OVERRIDE cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 11 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/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkImageDecoder_pkm.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 /* 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 SkWEBPImageDecoder() { 97 SkWEBPImageDecoder() {
98 fInputStream = NULL; 98 fInputStream = NULL;
99 fOrigWidth = 0; 99 fOrigWidth = 0;
100 fOrigHeight = 0; 100 fOrigHeight = 0;
101 fHasAlpha = 0; 101 fHasAlpha = 0;
102 } 102 }
103 virtual ~SkWEBPImageDecoder() { 103 virtual ~SkWEBPImageDecoder() {
104 SkSafeUnref(fInputStream); 104 SkSafeUnref(fInputStream);
105 } 105 }
106 106
107 virtual Format getFormat() const SK_OVERRIDE { 107 Format getFormat() const SK_OVERRIDE {
108 return kWEBP_Format; 108 return kWEBP_Format;
109 } 109 }
110 110
111 protected: 111 protected:
112 virtual bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *h eight) SK_OVERRIDE; 112 bool onBuildTileIndex(SkStreamRewindable *stream, int *width, int *height) S K_OVERRIDE;
113 virtual bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRI DE; 113 bool onDecodeSubset(SkBitmap* bitmap, const SkIRect& rect) SK_OVERRIDE;
114 virtual Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE; 114 Result onDecode(SkStream* stream, SkBitmap* bm, Mode) SK_OVERRIDE;
115 115
116 private: 116 private:
117 /** 117 /**
118 * Called when determining the output config to request to webp. 118 * Called when determining the output config to request to webp.
119 * If the image does not have alpha, there is no need to premultiply. 119 * If the image does not have alpha, there is no need to premultiply.
120 * If the caller wants unpremultiplied colors, that is respected. 120 * If the caller wants unpremultiplied colors, that is respected.
121 */ 121 */
122 bool shouldPremultiply() const { 122 bool shouldPremultiply() const {
123 return SkToBool(fHasAlpha) && !this->getRequireUnpremultipliedColors(); 123 return SkToBool(fHasAlpha) && !this->getRequireUnpremultipliedColors();
124 } 124 }
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } 581 }
582 582
583 static int stream_writer(const uint8_t* data, size_t data_size, 583 static int stream_writer(const uint8_t* data, size_t data_size,
584 const WebPPicture* const picture) { 584 const WebPPicture* const picture) {
585 SkWStream* const stream = (SkWStream*)picture->custom_ptr; 585 SkWStream* const stream = (SkWStream*)picture->custom_ptr;
586 return stream->write(data, data_size) ? 1 : 0; 586 return stream->write(data, data_size) ? 1 : 0;
587 } 587 }
588 588
589 class SkWEBPImageEncoder : public SkImageEncoder { 589 class SkWEBPImageEncoder : public SkImageEncoder {
590 protected: 590 protected:
591 virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK _OVERRIDE; 591 bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality) SK_OVERRID E;
592 592
593 private: 593 private:
594 typedef SkImageEncoder INHERITED; 594 typedef SkImageEncoder INHERITED;
595 }; 595 };
596 596
597 bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm, 597 bool SkWEBPImageEncoder::onEncode(SkWStream* stream, const SkBitmap& bm,
598 int quality) { 598 int quality) {
599 const bool hasAlpha = !bm.isOpaque(); 599 const bool hasAlpha = !bm.isOpaque();
600 int bpp = -1; 600 int bpp = -1;
601 const ScanlineImporter scanline_import = ChooseImporter(bm.colorType(), hasA lpha, &bpp); 601 const ScanlineImporter scanline_import = ChooseImporter(bm.colorType(), hasA lpha, &bpp);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 return SkImageDecoder::kUnknown_Format; 673 return SkImageDecoder::kUnknown_Format;
674 } 674 }
675 675
676 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) { 676 static SkImageEncoder* sk_libwebp_efactory(SkImageEncoder::Type t) {
677 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L; 677 return (SkImageEncoder::kWEBP_Type == t) ? SkNEW(SkWEBPImageEncoder) : NUL L;
678 } 678 }
679 679
680 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory); 680 static SkImageDecoder_DecodeReg gDReg(sk_libwebp_dfactory);
681 static SkImageDecoder_FormatReg gFormatReg(get_format_webp); 681 static SkImageDecoder_FormatReg gFormatReg(get_format_webp);
682 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory); 682 static SkImageEncoder_EncodeReg gEReg(sk_libwebp_efactory);
OLDNEW
« no previous file with comments | « src/images/SkImageDecoder_libpng.cpp ('k') | src/images/SkImageDecoder_pkm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698