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

Side by Side Diff: include/codec/SkScaledCodec.h

Issue 1321433002: Add subsetting to SkScaledCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@gif-scan
Patch Set: Created 5 years, 2 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
OLDNEW
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"
(...skipping 20 matching lines...) Expand all
31 if (dstInfo.height() != srcInfo.height()) { 31 if (dstInfo.height() != srcInfo.height()) {
32 return false; 32 return false;
33 } 33 }
34 // only support down sampling, dstWidth cannot be larger that srcWidth 34 // only support down sampling, dstWidth cannot be larger that srcWidth
35 if(dstInfo.width() > srcInfo.width()) { 35 if(dstInfo.width() > srcInfo.width()) {
36 return false; 36 return false;
37 } 37 }
38 return true; 38 return true;
39 } 39 }
40 40
41 static void ComputeSampleSize(const SkImageInfo& dstInfo, const SkImageInfo& srcInfo, 41 static void ComputeSampleSize(const SkISize& dstSize, const SkISize& srcSize ,
42 int* sampleSizeX, int* sampleSizeY); 42 int* sampleSizeX, int* sampleSizeY);
43 43
44 protected: 44 protected:
45 /** 45 /**
46 * Recommend a set of destination dimensions given a requested scale 46 * Recommend a set of destination dimensions given a requested scale
47 */ 47 */
48 SkISize onGetScaledDimensions(float desiredScale) const override; 48 SkISize onGetScaledDimensions(float desiredScale) const override;
49 49
50 bool onGetScaledSubsetDimensions(float desiredScale, Options* options) const override;
51
50 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo lor*, int*, int*) 52 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo lor*, int*, int*)
51 override; 53 override;
52 SkEncodedFormat onGetEncodedFormat() const override { 54 SkEncodedFormat onGetEncodedFormat() const override {
53 return fCodec->getEncodedFormat(); 55 return fCodec->getEncodedFormat();
54 } 56 }
55 57
56 bool onReallyHasAlpha() const override { 58 bool onReallyHasAlpha() const override {
57 return fCodec->reallyHasAlpha(); 59 return fCodec->reallyHasAlpha();
58 } 60 }
59 61
60 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const override; 62 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const override;
61 63
62 SkScanlineOrder onGetScanlineOrder() const override; 64 SkScanlineOrder onGetScanlineOrder() const override;
63 65
64 private: 66 private:
65 67
68 Result nativeDecode(const SkImageInfo& scaledInfo, void* dst, size_t rowByte s,
69 const SkIRect& scaledSubsetRect, ZeroInitialized zeroInit, int* rows Decoded);
70
71 Result sampledDecode(const SkImageInfo& decodeInfo, void* dst, size_t rowByt es,
72 const SkIRect& subsetRect, const SkIRect& scaledSubsetRect, int samp leX, int sampleY,
73 ZeroInitialized zeroInit, int* rowsDecoded);
74
66 SkAutoTDelete<SkCodec> fCodec; 75 SkAutoTDelete<SkCodec> fCodec;
67 76
68 explicit SkScaledCodec(SkCodec*); 77 explicit SkScaledCodec(SkCodec*);
69 78
70 typedef SkCodec INHERITED; 79 typedef SkCodec INHERITED;
71 }; 80 };
72 #endif // SkScaledCodec_DEFINED 81 #endif // SkScaledCodec_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698