Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1096)

Unified Diff: dm/DMSrcSink.h

Issue 1288963002: Provides multiple implementations of Android's SkBitmapRegionDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Disable png subsets for SkImageDecoder Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.h
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index efae87138e50c6684b0ef1e65bfbbb7272aedaab..fe6c91dfadeb5228fddaa3bbb19e0b9188e0e22b 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -12,6 +12,7 @@
#include "SkBBHFactory.h"
#include "SkBBoxHierarchy.h"
#include "SkBitmap.h"
+#include "SkBitmapRegionDecoderInterface.h"
#include "SkCanvas.h"
#include "SkData.h"
#include "SkGPipe.h"
@@ -128,6 +129,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, SkBitmapRegionDecoderInterface::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;
+ SkBitmapRegionDecoderInterface::Strategy fStrategy;
+ Mode fMode;
+ CodecSrc::DstColorType fDstColorType;
+ uint32_t fSampleSize;
+};
class ImageSrc : public Src {
public:
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698