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

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

Issue 1406223002: Create an SkAndroidCodec API separate from SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Win bot fix 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
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkAndroidCodec.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef SkScaledCodec_DEFINED
8 #define SkScaledCodec_DEFINED
9
10 #include "SkCodec.h"
11
12 class SkStream;
13
14 /**
15 * This class implements scaling, by sampling scanlines in the y direction.
16 * x-wise sampling is implemented in the swizzler, when getScanlines() is called .
17 */
18 class SkScaledCodec : public SkCodec {
19 public:
20 static SkCodec* NewFromStream(SkStream*);
21 static SkCodec* NewFromData(SkData*);
22
23 virtual ~SkScaledCodec();
24
25 static void ComputeSampleSize(const SkISize& dstDim, const SkISize& srcDim,
26 int* sampleSizeX, int* sampleSizeY);
27
28 protected:
29 bool onRewind() override;
30
31 /**
32 * Recommend a set of destination dimensions given a requested scale
33 */
34 SkISize onGetScaledDimensions(float desiredScale) const override;
35 bool onDimensionsSupported(const SkISize&) override;
36
37 Result onGetPixels(const SkImageInfo&, void*, size_t, const Options&, SkPMCo lor*, int*, int*)
38 override;
39 SkEncodedFormat onGetEncodedFormat() const override {
40 return fCodec->getEncodedFormat();
41 }
42
43 bool onReallyHasAlpha() const override {
44 return fCodec->reallyHasAlpha();
45 }
46
47 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const override;
48
49 SkScanlineOrder onGetScanlineOrder() const override;
50
51 private:
52
53 SkAutoTDelete<SkCodec> fCodec;
54
55 explicit SkScaledCodec(SkCodec*);
56
57 typedef SkCodec INHERITED;
58 };
59 #endif // SkScaledCodec_DEFINED
OLDNEW
« no previous file with comments | « include/codec/SkCodec.h ('k') | src/codec/SkAndroidCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698