Chromium Code Reviews| Index: dm/DMSrcSink.h |
| diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h |
| index efae87138e50c6684b0ef1e65bfbbb7272aedaab..df00dc8874e3afb37a7dfd53ae6aa98b3985bde3 100644 |
| --- a/dm/DMSrcSink.h |
| +++ b/dm/DMSrcSink.h |
| @@ -12,6 +12,7 @@ |
| #include "SkBBHFactory.h" |
| #include "SkBBoxHierarchy.h" |
| #include "SkBitmap.h" |
| +#include "SkBitmapRegionDecoder.h" |
| #include "SkCanvas.h" |
| #include "SkData.h" |
| #include "SkGPipe.h" |
| @@ -114,6 +115,7 @@ public: |
| kGetFromCanvas_DstColorType, |
| kIndex8_Always_DstColorType, |
| kGrayscale_Always_DstColorType, |
| + kAlpha_Always_DstColorType, |
|
scroggo
2015/09/03 20:07:41
Alpha8 is used as a hack for Grayscale. Maybe we s
msarett
2015/09/03 22:10:30
Yes I think this makes sense.
|
| }; |
| CodecSrc(Path, Mode, DstColorType, float); |
| @@ -128,6 +130,34 @@ private: |
| float fScale; |
| }; |
| +// Allows for testing of various implementations of Android's BitmapRegionDecoder |
| +class BRDSrc : public Src { |
| +public: |
| + enum Mode { |
| + // Decode the entire image as one region. |
| + kFullImage_Mode, |
| + // Splits the image into multiple regions using a divisor and decodes the regions |
| + // separately. Also, this test adds a border of a few pixels to each of the regions |
| + // that it is decoding. This tests the behavior when a client asks for a region that |
| + // does not fully fit in the image. |
| + kDivisor_Mode, |
| + }; |
| + |
| + BRDSrc(Path, SkBitmapRegionDecoder::Strategy, Mode, CodecSrc::DstColorType, uint32_t); |
| + |
| + static float GetScale(uint32_t sampleSize) { return 1.0f / (float) sampleSize; } |
| + |
| + Error draw(SkCanvas*) const override; |
| + SkISize size() const override; |
| + Name name() const override; |
| + bool veto(SinkFlags) const override; |
| +private: |
| + Path fPath; |
| + SkBitmapRegionDecoder::Strategy fStrategy; |
| + Mode fMode; |
| + CodecSrc::DstColorType fDstColorType; |
| + uint32_t fSampleSize; |
| +}; |
| class ImageSrc : public Src { |
| public: |