OLD | NEW |
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 #ifndef SkBitmapRegionDecoder_DEFINED | 8 #ifndef SkBitmapRegionDecoder_DEFINED |
9 #define SkBitmapRegionDecoder_DEFINED | 9 #define SkBitmapRegionDecoder_DEFINED |
10 | 10 |
11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkStream.h" | 12 #include "SkStream.h" |
13 | 13 |
14 /* | 14 /* |
15 * This class aims to provide an interface to test multiple implementations of | 15 * This class aims to provide an interface to test multiple implementations of |
16 * SkBitmapRegionDecoder. | 16 * SkBitmapRegionDecoder. |
17 */ | 17 */ |
18 class SkBitmapRegionDecoderInterface { | 18 class SkBitmapRegionDecoderInterface { |
19 public: | 19 public: |
20 | 20 |
21 enum Strategy { | 21 enum Strategy { |
22 kCanvas_Strategy, // Draw to the canvas, uses SkCodec | 22 kCanvas_Strategy, // Draw to the canvas, uses SkCodec |
23 kOriginal_Strategy, // Sampling, uses SkImageDecoder | 23 kOriginal_Strategy, // Sampling, uses SkImageDecoder |
24 // TODO (msarett): Add strategy for SkScaledCodec | 24 kAndroidCodec_Strategy, // Uses SkAndroidCodec for scaling and subsettin
g |
25 }; | 25 }; |
26 | 26 |
27 /* | 27 /* |
28 * @param stream Encoded image stream, takes ownership | 28 * @param stream Encoded image stream, takes ownership |
29 * @param strategy Strategy used for scaling and subsetting | 29 * @param strategy Strategy used for scaling and subsetting |
30 * @return Tries to create an SkBitmapRegionDecoder, returns NULL | 30 * @return Tries to create an SkBitmapRegionDecoder, returns NULL |
31 * on failure | 31 * on failure |
32 */ | 32 */ |
33 static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder( | 33 static SkBitmapRegionDecoderInterface* CreateBitmapRegionDecoder( |
34 SkStreamRewindable* stream, Strategy strategy); | 34 SkStreamRewindable* stream, Strategy strategy); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 : fWidth(width) | 73 : fWidth(width) |
74 , fHeight(height) | 74 , fHeight(height) |
75 {} | 75 {} |
76 | 76 |
77 private: | 77 private: |
78 const int fWidth; | 78 const int fWidth; |
79 const int fHeight; | 79 const int fHeight; |
80 }; | 80 }; |
81 | 81 |
82 #endif | 82 #endif |
OLD | NEW |