Index: src/codec/SkJpegCodec.h |
diff --git a/src/codec/SkJpegCodec.h b/src/codec/SkJpegCodec.h |
index 1844269e6b3eff13a2e53dd636a8845e299c8739..505411a14468bd7b2bb6471f2daedaaf49c307ed 100644 |
--- a/src/codec/SkJpegCodec.h |
+++ b/src/codec/SkJpegCodec.h |
@@ -59,7 +59,18 @@ protected: |
SkScanlineDecoder* onGetScanlineDecoder(const SkImageInfo& dstInfo, const Options& options, |
SkPMColor ctable[], int* ctableCount) override; |
+ /* |
+ * Checks if we can patially natively scale to the desiredScale, and partially natively scales |
+ * the dimensions if possible. |
+ * Returns the new sampleSize, which is used to finish scaling to the desiredScale |
+ * Ex: desiredScale = 1/6. Natively can scale by 1/2. New sampleSize = 3, as there is still |
+ * 1/3 scaling left to do, which is done by sampling. |
+ * Returns -1 if partial native scaling is not supported. |
+ */ |
+ int onPartiallyNativelyScale(float desiredScale) override; |
+ |
private: |
+ SkAutoTDelete<SkSwizzler> fSwizzler; |
/* |
* Read enough of the stream to initialize the SkJpegCodec. |
@@ -94,6 +105,11 @@ private: |
*/ |
SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, JpegDecoderMgr* decoderMgr); |
+ // Helper to set up swizzler. |
+ Result initializeSwizzler(const SkImageInfo& requestedInfo, void* dst, |
+ size_t rowBytes, const Options&, SkPMColor*, |
+ int* ctableCount, int dstWidth); |
+ |
/* |
* Handles rewinding the input stream if it is necessary |
*/ |
@@ -107,10 +123,10 @@ private: |
bool setOutputColorSpace(const SkImageInfo& dst); |
/* |
- * Checks if we can scale to the requested dimensions and scales the dimensions |
- * if possible |
+ * Checks if we can natively scale to the requested dimensions and natively scales the |
+ * dimensions if possible |
*/ |
- bool scaleToDimensions(uint32_t width, uint32_t height); |
+ bool nativelyScaleToDimensions(uint32_t width, uint32_t height); |
/* |
* Create the swizzler based on the encoded format |
@@ -119,7 +135,8 @@ private: |
const Options& options); |
SkAutoTDelete<JpegDecoderMgr> fDecoderMgr; |
- |
+ int fPartialDenom; |
+ int fPartialNum; |
friend class SkJpegScanlineDecoder; |
typedef SkCodec INHERITED; |