aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/CachedDecodingPixelRefTest.cpp
diff options
context:
space:
mode:
authorGravatar halcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-18 17:40:25 +0000
committerGravatar halcanary@google.com <halcanary@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-12-18 17:40:25 +0000
commitd665dc4c100f73272422dd17b4dd2c5d57a6b6de (patch)
treedf55cf5c3b0e80804328896afdcfee5b68465236 /tests/CachedDecodingPixelRefTest.cpp
parent45e01c36da864eae89775c5f0120317d6b56bca5 (diff)
Add Options to SkDecodingImageGenerator, simplify API.
Motivation: We want to remove redundant classes from Skia. To that end we want to remove SkImageRef and its subclasses and replace their uses with SkDiscardablePixelRef + SkDecodingImageGenerator. Since Android uses SkImageRef, we need to make sure that SkDecodingImageGenerator allows all of the settings that Android exposes in BitmapFactory.Options. To that end, we have created an Options struct for the SkDecodingImageGenerator which lets the client of the generator set sample size, dithering, and bitmap config. We have made the SkDecodingImageGenerator constructor private and replaced the SkDecodingImageGenerator::Install functions with a SkDecodingImageGenerator::Create functions (one for SkData and one for SkStream) which now take a SkDecodingImageGenerator::Options struct. Also added a ImageDecoderOptions test which loops through a list of sets of options and tries them on a set of 5 small encoded images. Also updated several users of SkDecodingImageGenerator::Install to follow new call signature - gm/factory.cpp, LazyDecodeBitmap.cpp, and PictureTest.cpp, CachedDecodingPixelRefTest.cpp. We also added a new ImprovedBitmapFactory Test which simulates the exact function that Android will need to modify to use this, installPixelRef() in BitmapFactory. R=reed@google.com, scroggo@google.com Review URL: https://codereview.chromium.org/93703004 git-svn-id: http://skia.googlecode.com/svn/trunk@12744 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/CachedDecodingPixelRefTest.cpp')
-rw-r--r--tests/CachedDecodingPixelRefTest.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/tests/CachedDecodingPixelRefTest.cpp b/tests/CachedDecodingPixelRefTest.cpp
index 04eddd9070..434724d0cf 100644
--- a/tests/CachedDecodingPixelRefTest.cpp
+++ b/tests/CachedDecodingPixelRefTest.cpp
@@ -146,11 +146,14 @@ static void test_three_encodings(skiatest::Reporter* reporter,
////////////////////////////////////////////////////////////////////////////////
static bool install_skCachingPixelRef(SkData* encoded, SkBitmap* dst) {
return SkCachingPixelRef::Install(
- SkNEW_ARGS(SkDecodingImageGenerator, (encoded)), dst);
+ SkDecodingImageGenerator::Create(
+ encoded, SkDecodingImageGenerator::Options()), dst);
}
static bool install_skDiscardablePixelRef(SkData* encoded, SkBitmap* dst) {
// Use system-default discardable memory.
- return SkDecodingImageGenerator::Install(encoded, dst, NULL);
+ return SkInstallDiscardablePixelRef(
+ SkDecodingImageGenerator::Create(
+ encoded, SkDecodingImageGenerator::Options()), dst, NULL);
}
////////////////////////////////////////////////////////////////////////////////
@@ -213,10 +216,12 @@ public:
}
return true;
}
+
private:
const TestType fType;
skiatest::Reporter* const fReporter;
};
+
void CheckTestImageGeneratorBitmap(skiatest::Reporter* reporter,
const SkBitmap& bm) {
REPORTER_ASSERT(reporter, TestImageGenerator::Width() == bm.width());