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 SkBitmapRegionDecoderPriv_DEFINED | 8 #ifndef SkBitmapRegionDecoderPriv_DEFINED |
9 #define SkBitmapRegionDecoderPriv_DEFINED | 9 #define SkBitmapRegionDecoderPriv_DEFINED |
10 | 10 |
11 inline float get_scale_from_sample_size(uint32_t sampleSize) { | |
12 return 1.0f / (float) sampleSize; | |
13 } | |
14 | |
15 enum SubsetType { | 11 enum SubsetType { |
16 kFullyInside_SubsetType, | 12 kFullyInside_SubsetType, |
17 kPartiallyInside_SubsetType, | 13 kPartiallyInside_SubsetType, |
18 kOutside_SubsetType, | 14 kOutside_SubsetType, |
19 }; | 15 }; |
20 | 16 |
21 /* | 17 /* |
22 * Corrects image subset offsets and dimensions in order to perform a valid deco
de. | 18 * Corrects image subset offsets and dimensions in order to perform a valid deco
de. |
23 * Also indicates if the image subset should be placed at an offset within the | 19 * Also indicates if the image subset should be placed at an offset within the |
24 * output bitmap. | 20 * output bitmap. |
(...skipping 29 matching lines...) Expand all Loading... |
54 subset->setXYWH(left, top, width, height); | 50 subset->setXYWH(left, top, width, height); |
55 if ((*outX != 0) || (*outY != 0) || (width != subset->width()) || | 51 if ((*outX != 0) || (*outY != 0) || (width != subset->width()) || |
56 (height != subset->height())) { | 52 (height != subset->height())) { |
57 return SubsetType::kPartiallyInside_SubsetType; | 53 return SubsetType::kPartiallyInside_SubsetType; |
58 } | 54 } |
59 | 55 |
60 return SubsetType::kFullyInside_SubsetType; | 56 return SubsetType::kFullyInside_SubsetType; |
61 } | 57 } |
62 | 58 |
63 #endif // SkBitmapRegionDecoderPriv_DEFINED | 59 #endif // SkBitmapRegionDecoderPriv_DEFINED |
OLD | NEW |