| 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 #ifndef SkScaledCodec_DEFINED | 7 #ifndef SkScaledCodec_DEFINED |
| 8 #define SkScaledCodec_DEFINED | 8 #define SkScaledCodec_DEFINED |
| 9 | 9 |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| 11 #include "SkScanlineDecoder.h" | |
| 12 | 11 |
| 13 class SkScanlineDecoder; | |
| 14 class SkStream; | 12 class SkStream; |
| 15 | 13 |
| 16 /** | 14 /** |
| 17 * This class implements scaling, by sampling scanlines in the y direction. | 15 * This class implements scaling, by sampling scanlines in the y direction. |
| 18 * x-wise sampling is implemented in the swizzler, when getScanlines() is called
. | 16 * x-wise sampling is implemented in the swizzler, when getScanlines() is called
. |
| 19 */ | 17 */ |
| 20 class SkScaledCodec : public SkCodec { | 18 class SkScaledCodec : public SkCodec { |
| 21 public: | 19 public: |
| 22 static SkCodec* NewFromStream(SkStream*); | 20 static SkCodec* NewFromStream(SkStream*); |
| 23 static SkCodec* NewFromData(SkData*); | 21 static SkCodec* NewFromData(SkData*); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 45 | 43 |
| 46 protected: | 44 protected: |
| 47 /** | 45 /** |
| 48 * Recommend a set of destination dimensions given a requested scale | 46 * Recommend a set of destination dimensions given a requested scale |
| 49 */ | 47 */ |
| 50 SkISize onGetScaledDimensions(float desiredScale) const override; | 48 SkISize onGetScaledDimensions(float desiredScale) const override; |
| 51 | 49 |
| 52 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*) | 50 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*) |
| 53 override; | 51 override; |
| 54 SkEncodedFormat onGetEncodedFormat() const override { | 52 SkEncodedFormat onGetEncodedFormat() const override { |
| 55 return fScanlineDecoder->getEncodedFormat(); | 53 return fCodec->getEncodedFormat(); |
| 56 } | 54 } |
| 57 | 55 |
| 58 bool onReallyHasAlpha() const override { | 56 bool onReallyHasAlpha() const override { |
| 59 return fScanlineDecoder->reallyHasAlpha(); | 57 return fCodec->reallyHasAlpha(); |
| 60 } | 58 } |
| 61 | 59 |
| 62 private: | 60 private: |
| 63 | 61 |
| 64 SkAutoTDelete<SkScanlineDecoder> fScanlineDecoder; | 62 SkAutoTDelete<SkCodec> fCodec; |
| 65 | 63 |
| 66 explicit SkScaledCodec(SkScanlineDecoder*); | 64 explicit SkScaledCodec(SkCodec*); |
| 67 | 65 |
| 68 typedef SkCodec INHERITED; | 66 typedef SkCodec INHERITED; |
| 69 }; | 67 }; |
| 70 #endif // SkScaledCodec_DEFINED | 68 #endif // SkScaledCodec_DEFINED |
| OLD | NEW |