Chromium Code Reviews| Index: src/utils/SkBitmapRegionDecoder.h |
| diff --git a/src/utils/SkBitmapRegionDecoder.h b/src/utils/SkBitmapRegionDecoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..78c538d14ad26f775d81e37b3ddb831b350c5a43 |
| --- /dev/null |
| +++ b/src/utils/SkBitmapRegionDecoder.h |
| @@ -0,0 +1,51 @@ |
| +/* |
| + * Copyright 2015 Google Inc. |
| + * |
| + * Use of this source code is governed by a BSD-style license that can be |
| + * found in the LICENSE file. |
| + */ |
| + |
| +#ifndef SkBitmapRegionDecoder_DEFINED |
| +#define SkBitmapRegionDecoder_DEFINED |
| + |
| +#include "SkBitmap.h" |
| +#include "SkStream.h" |
| + |
| +/* |
| + * This class aims to provide an interface to test multiple implementations of |
| + * SkBitmapRegionDecoder. |
| + */ |
| +class SkBitmapRegionDecoder { |
| +public: |
| + |
| + enum Strategy { |
| + kCanvas_Strategy, |
| + kSample_Strategy, |
|
scroggo
2015/08/13 16:53:07
So this uses SkImageDecoder?
msarett
2015/08/13 18:10:23
Yeah - I think there will be a Sample strategy for
|
| + // TODO (msarett): Add strategy for SkScaledCodec |
| + }; |
| + |
| + static SkBitmapRegionDecoder* CreateBitmapRegionDecoder( |
| + SkStreamRewindable* stream, Strategy strategy); |
| + |
| + virtual SkBitmap* decodeRegion(int start_x, int start_y, int width, |
|
scroggo
2015/08/13 16:53:07
comments?
msarett
2015/08/13 18:10:23
Adding comments!
|
| + int height, int sampleSize, |
| + SkColorType prefColorType) = 0; |
| + |
| + int width() const { return fWidth; } |
| + int height() const { return fHeight; } |
| + |
| + virtual ~SkBitmapRegionDecoder() {} |
| + |
| +protected: |
| + |
| + SkBitmapRegionDecoder(int width, int height) |
| + : fWidth(width) |
| + , fHeight(height) |
| + {} |
| + |
| +private: |
| + int fWidth; |
|
scroggo
2015/08/13 16:53:07
Can these be const?
msarett
2015/08/13 18:10:23
Yes!
|
| + int fHeight; |
| +}; |
| + |
| +#endif |