aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar kjlubick <kjlubick@google.com>2016-02-10 11:25:07 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-10 11:25:07 -0800
commit1de415f2c33febbac668500afbbb0c9b120c125f (patch)
tree6fea38167e591a5908c024866851a294dbd8e4c5 /tests
parent026388a01864c74208ad57d1ba4f711602d101c6 (diff)
Revert of Make SkPicture/SkImageGenerator default to SkCodec (patchset #7 id:120001 of https://codereview.chromium.org/1671193002/ )
Reason for revert: Breaks Ubuntu and Mac CMAKE Original issue's description: > Make SkPicture/SkImageGenerator default to SkCodec > > Remove reference to SkImageDecoder from SkPicture. Make the default > InstallPixelRefProc passed to CreateFromStream use > SkImageGenerator::NewFromEncoded instead. > > Make SkImageGenerator::NewFromEncoded create an SkCodecImageGenerator. > Remove the old version that used SkImageDecoder. > > Remove all versions of lazy_decode_bitmap/LazyDecodeBitmap. The default > now behaves lazily. > > Update all clients to use the default. > > Move SkImageDecoderGenerator into KtxTest.cpp, and use it directly. > > BUG=skia:4691 > BUG=skia:4290 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1671193002 > > Committed: https://skia.googlesource.com/skia/+/026388a01864c74208ad57d1ba4f711602d101c6 TBR=msarett@google.com,reed@google.com,scroggo@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:4691 Review URL: https://codereview.chromium.org/1685963004
Diffstat (limited to 'tests')
-rw-r--r--tests/KtxTest.cpp5
-rw-r--r--tests/PictureTest.cpp34
2 files changed, 3 insertions, 36 deletions
diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp
index 99bae83329..84d162c0f8 100644
--- a/tests/KtxTest.cpp
+++ b/tests/KtxTest.cpp
@@ -143,9 +143,6 @@ DEF_TEST(KtxReadUnpremul, reporter) {
}
}
-// For KtxReexportPKM, below. Defined in SkImageDecoder_ktx.cpp
-extern SkImageGenerator* decoder_image_generator(SkData*);
-
/**
* Finally, make sure that if we get ETC1 data from a PKM file that we can then
* accurately write it out into a KTX file (i.e. transferring the ETC1 data from
@@ -163,7 +160,7 @@ DEF_TEST(KtxReexportPKM, reporter) {
}
bool installDiscardablePixelRefSuccess =
- SkDEPRECATED_InstallDiscardablePixelRef(decoder_image_generator(fileData), &etcBitmap);
+ SkDEPRECATED_InstallDiscardablePixelRef(fileData, &etcBitmap);
if (!installDiscardablePixelRefSuccess) {
ERRORF(reporter, "failed to create discardable pixelRef from KTX file");
return;
diff --git a/tests/PictureTest.cpp b/tests/PictureTest.cpp
index 448e079958..3d05a824a2 100644
--- a/tests/PictureTest.cpp
+++ b/tests/PictureTest.cpp
@@ -17,7 +17,6 @@
#include "SkImageEncoder.h"
#include "SkImageGenerator.h"
#include "SkLayerInfo.h"
-#include "SkMD5.h"
#include "SkPaint.h"
#include "SkPicture.h"
#include "SkPictureRecorder.h"
@@ -872,18 +871,7 @@ static void assert_one_parse_error_cb(SkError error, void* context) {
SkGetLastErrorString());
}
-static void md5(const SkBitmap& bm, SkMD5::Digest* digest) {
- SkAutoLockPixels autoLockPixels(bm);
- SkASSERT(bm.getPixels());
- SkMD5 md5;
- size_t rowLen = bm.info().bytesPerPixel() * bm.width();
- for (int y = 0; y < bm.height(); ++y) {
- md5.update(static_cast<uint8_t*>(bm.getAddr(0, y)), rowLen);
- }
- md5.finish(*digest);
-}
-
-DEF_TEST(Picture_EncodedData, reporter) {
+static void test_bitmap_with_encoded_data(skiatest::Reporter* reporter) {
// Create a bitmap that will be encoded.
SkBitmap original;
make_bm(&original, 100, 100, SK_ColorBLUE, true);
@@ -903,7 +891,6 @@ DEF_TEST(Picture_EncodedData, reporter) {
SkAutoDataUnref picture1(serialized_picture_from_bitmap(original));
SkAutoDataUnref picture2(serialized_picture_from_bitmap(bm));
REPORTER_ASSERT(reporter, picture1->equals(picture2));
-
// Now test that a parse error was generated when trying to create a new SkPicture without
// providing a function to decode the bitmap.
ErrorContext context;
@@ -916,24 +903,6 @@ DEF_TEST(Picture_EncodedData, reporter) {
REPORTER_ASSERT(reporter, pictureFromStream.get() != nullptr);
SkClearLastError();
SkSetErrorCallback(nullptr, nullptr);
-
- // Test that using the version of CreateFromStream that just takes a stream also decodes the
- // bitmap. Drawing this picture should look exactly like the original bitmap.
- SkMD5::Digest referenceDigest;
- md5(original, &referenceDigest);
-
- SkBitmap dst;
- dst.allocPixels(original.info());
- dst.eraseColor(SK_ColorRED);
- SkCanvas canvas(dst);
-
- pictureStream.rewind();
- pictureFromStream.reset(SkPicture::CreateFromStream(&pictureStream));
- canvas.drawPicture(pictureFromStream.get());
-
- SkMD5::Digest digest2;
- md5(dst, &digest2);
- REPORTER_ASSERT(reporter, referenceDigest == digest2);
}
static void test_clip_bound_opt(skiatest::Reporter* reporter) {
@@ -1205,6 +1174,7 @@ DEF_TEST(Picture, reporter) {
test_has_text(reporter);
test_images_are_found_by_willPlayBackBitmaps(reporter);
test_analysis(reporter);
+ test_bitmap_with_encoded_data(reporter);
test_clip_bound_opt(reporter);
test_clip_expansion(reporter);
test_hierarchical(reporter);