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

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

Issue 1406223002: Create an SkAndroidCodec API separate from SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
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
(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 SkSampledCodec_DEFINED
8 #define SkSampledCodec_DEFINED
9
10 #include "SkAndroidCodec.h"
11 #include "SkCodec.h"
12
13 /**
14 * This class implements the functionality of SkAndroidCodec. Scaling will
15 * be provided by sampling if it cannot be provided by fCodec.
16 */
17 class SkSampledCodec : public SkAndroidCodec {
scroggo 2015/10/16 21:13:55 I think this should be in the file SkSampledCodec.
msarett 2015/10/19 16:06:10 Agreed. I didn't want to modify and rename a file
18 public:
19
20 explicit SkSampledCodec(SkCodec*);
21
22 virtual ~SkSampledCodec() {}
23
24 protected:
25
26 SkEncodedFormat onGetEncodedFormat() const override { return fCodec->getEnco dedFormat(); };
27
28 SkISize onGetSampledDimensions(int sampleSize) const override;
29
30 bool onGetSubset(SkIRect* desiredSubset) const override { return true; }
31
32 SkISize onGetSampledSubsetDimensions(int sampleSize, const SkIRect& subset) const override;
33
34 SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pixels, si ze_t rowBytes,
35 AndroidOptions& options) override;
36
37 private:
38
39 /**
40 * This fulfills the same contract as onGetAndroidPixels().
41 *
42 * We call this function from onGetAndroidPixels() if we have determined
43 * that fCodec does not support the requested scale, and we need to
44 * provide the scale by sampling.
45 */
46 SkCodec::Result sampledDecode(const SkImageInfo& info, void* pixels, size_t rowBytes,
47 AndroidOptions& options);
48
49 SkAutoTDelete<SkCodec> fCodec;
50
51 typedef SkAndroidCodec INHERITED;
52 };
53 #endif // SkSampledCodec_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698