Chromium Code Reviews| Index: tools/SkCodecTools.h |
| diff --git a/tools/SkCodecTools.h b/tools/SkCodecTools.h |
| index 285d3a21dee1e3a9bcc3cb215fb0c401430796af..431495ef47eb37d3c94290f78037f848fa648949 100644 |
| --- a/tools/SkCodecTools.h |
| +++ b/tools/SkCodecTools.h |
| @@ -8,16 +8,12 @@ |
| #ifndef SkCodecTools_DEFINED |
| #define SkCodecTools_DEFINED |
| +#include "SkBitmapRegionDecoderInterface.h" |
| + |
| inline float get_scale_from_sample_size(uint32_t sampleSize) { |
| return 1.0f / (float) sampleSize; |
| } |
| -enum SubsetType { |
| - kFullyInside_SubsetType, |
| - kPartiallyInside_SubsetType, |
| - kOutside_SubsetType, |
| -}; |
| - |
| /* |
| * Corrects image subset offsets and dimensions in order to perform a valid decode. |
| * Also indicates if the image subset should be placed at an offset within the |
| @@ -34,8 +30,8 @@ enum SubsetType { |
| * @return An indication of how the subset is contained in the image. |
| * If the return value is kInvalid, values of output variables are undefined. |
| */ |
| -inline SubsetType adjust_subset_rect(const SkISize& imageDims, SkIRect* subset, int* outX, |
| - int* outY) { |
| +inline SkBitmapRegionDecoderInterface::SubsetType adjust_subset_rect(const SkISize& imageDims, |
|
scroggo
2015/10/27 15:00:51
Should this be a method on SkBitmapRegionDecoderIn
|
| + SkIRect* subset, int* outX, int* outY) { |
| // These must be at least zero, we can't start decoding the image at a negative coordinate. |
| int left = SkTMax(0, subset->fLeft); |
| int top = SkTMax(0, subset->fTop); |
| @@ -48,16 +44,16 @@ inline SubsetType adjust_subset_rect(const SkISize& imageDims, SkIRect* subset, |
| int width = SkTMin(imageDims.width() - left, subset->width() - *outX); |
| int height = SkTMin(imageDims.height() - top, subset->height() - *outY); |
| if (width <= 0 || height <= 0) { |
| - return SubsetType::kOutside_SubsetType; |
| + return SkBitmapRegionDecoderInterface::kOutside_SubsetType; |
| } |
| subset->setXYWH(left, top, width, height); |
| if ((*outX != 0) || (*outY != 0) || (width != subset->width()) || |
| (height != subset->height())) { |
| - return SubsetType::kPartiallyInside_SubsetType; |
| + return SkBitmapRegionDecoderInterface::kPartiallyInside_SubsetType; |
| } |
| - return SubsetType::kFullyInside_SubsetType; |
| + return SkBitmapRegionDecoderInterface::kFullyInside_SubsetType; |
| } |
| #endif // SkCodecTools_DEFINED |