OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkCodec.h" |
| 9 #include "SkColorTable.h" |
| 10 #include "SkEncodedFormat.h" |
| 11 #include "SkImageInfo.h" |
| 12 #include "SkRefCnt.h" |
| 13 #include "SkSwizzler.h" |
| 14 #include "SkCodec_libpng.h" |
| 15 #include "SkScanlineDecoder.h" |
| 16 |
| 17 class SkScanlineDecoder; |
| 18 class SkStream; |
| 19 |
| 20 class SkScaledCodec : public SkCodec { |
| 21 public: |
| 22 static SkCodec* NewFromStream(SkStream*); |
| 23 static SkCodec* NewFromData(SkData*); |
| 24 |
| 25 virtual ~SkScaledCodec(); |
| 26 |
| 27 protected: |
| 28 // Recommend a set of destination dimensions given a requested scale |
| 29 SkISize onGetScaledDimensions(float desiredScale) const override; |
| 30 |
| 31 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo
lor*, int*) |
| 32 override; |
| 33 SkEncodedFormat onGetEncodedFormat() const override{ |
| 34 return fCodec->getEncodedFormat(); |
| 35 } |
| 36 |
| 37 SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, const Op
tions& options, |
| 38 SkPMColor ctable[], int* ctableCount
) override { |
| 39 return fCodec->getScanlineDecoder(dstInfo, &options, ctable, ctableCount
); |
| 40 } |
| 41 bool onReallyHasAlpha() const override{ |
| 42 return fCodec->reallyHasAlpha(); |
| 43 } |
| 44 |
| 45 private: |
| 46 SkAutoTDelete<SkCodec> fCodec; |
| 47 |
| 48 SkScaledCodec(SkCodec*); |
| 49 |
| 50 |
| 51 typedef SkCodec INHERITED; |
| 52 }; |
OLD | NEW |