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

Side by Side Diff: tools/SkBitmapRegionSampler.h

Issue 1415243007: Rename SkBitmapRegionDecoder and Create function (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « tools/SkBitmapRegionDecoderInterface.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapRegionDecoderInterface.h" 9 #include "SkBitmapRegionDecoder.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
11 #include "SkTemplates.h" 11 #include "SkTemplates.h"
12 12
13 /* 13 /*
14 * This class aims to duplicate the current implementation of 14 * This class aims to duplicate the current implementation of
15 * SkBitmapRegionDecoder in Android. 15 * SkBitmapRegionDecoder in Android.
16 */ 16 */
17 class SkBitmapRegionSampler : public SkBitmapRegionDecoderInterface { 17 class SkBitmapRegionSampler : public SkBitmapRegionDecoder {
18 public: 18 public:
19 19
20 /* 20 /*
21 * Takes ownership of pointer to decoder 21 * Takes ownership of pointer to decoder
22 */ 22 */
23 SkBitmapRegionSampler(SkImageDecoder* decoder, int width, int height); 23 SkBitmapRegionSampler(SkImageDecoder* decoder, int width, int height);
24 24
25 bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator, 25 bool decodeRegion(SkBitmap* bitmap, SkBitmap::Allocator* allocator,
26 const SkIRect& desiredSubset, int sampleSize, 26 const SkIRect& desiredSubset, int sampleSize,
27 SkColorType colorType, bool requireUnpremul) override; 27 SkColorType colorType, bool requireUnpremul) override;
28 28
29 bool conversionSupported(SkColorType colorType) override { 29 bool conversionSupported(SkColorType colorType) override {
30 // SkBitmapRegionSampler does not allow the client to check if the conve rsion 30 // SkBitmapRegionSampler does not allow the client to check if the conve rsion
31 // is supported. We will return true as a default. If the conversion i s in 31 // is supported. We will return true as a default. If the conversion i s in
32 // fact not supported, decodeRegion() will ignore the prefColorType and choose 32 // fact not supported, decodeRegion() will ignore the prefColorType and choose
33 // its own color type. We catch this and fail non-fatally in our test c ode. 33 // its own color type. We catch this and fail non-fatally in our test c ode.
34 return true; 34 return true;
35 } 35 }
36 36
37 SkEncodedFormat getEncodedFormat() override { return (SkEncodedFormat) fDeco der->getFormat(); } 37 SkEncodedFormat getEncodedFormat() override { return (SkEncodedFormat) fDeco der->getFormat(); }
38 38
39 private: 39 private:
40 40
41 SkAutoTDelete<SkImageDecoder> fDecoder; 41 SkAutoTDelete<SkImageDecoder> fDecoder;
42 42
43 typedef SkBitmapRegionDecoderInterface INHERITED; 43 typedef SkBitmapRegionDecoder INHERITED;
44 44
45 }; 45 };
OLDNEW
« no previous file with comments | « tools/SkBitmapRegionDecoderInterface.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698