Revert of change pixel-serializer to support reencoding existing data (patchset #5 id:80001 of https://codereview.chromium.org/1373683003/ )
Reason for revert:
Need to somehow get access to encoders in chrome -- link error on the roll since SkImageEncoder is not built as part of chrome.
Original issue's description:
> change pixel-serializer to support reencoding existing data
>
> Trying to evolve this interface so it can
> - support rich set of backend-encoders (including ones like ETC1 that can cheaply convert to KXT
> - allow for encoding images as well as bitmaps (e.g. for picture serialization)
> - perhaps replace SkImageEncoder as an API (assuming we create a factory that returns a serializer given a format)
>
> BUG=skia:
>
> Committed: https://skia.googlesource.com/skia/+/13f48dc85aa68a60da66aaf39c93d527d11d1278
TBR=scroggo@google.com,msarett@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:
Review URL: https://codereview.chromium.org/1371983003
diff --git a/tests/KtxTest.cpp b/tests/KtxTest.cpp
index 0ad2496..e0d9a27 100644
--- a/tests/KtxTest.cpp
+++ b/tests/KtxTest.cpp
@@ -8,7 +8,6 @@
#include "Resources.h"
#include "SkBitmap.h"
#include "SkData.h"
-#include "SkImage.h"
#include "SkImageGenerator.h"
#include "SkForceLinking.h"
#include "SkImageDecoder.h"
@@ -150,11 +149,14 @@
return;
}
- SkAutoTUnref<SkImage> image(SkImage::NewFromEncoded(fileData));
- REPORTER_ASSERT(reporter, image.get());
+ bool installDiscardablePixelRefSuccess =
+ SkDEPRECATED_InstallDiscardablePixelRef(fileData, &etcBitmap);
+ REPORTER_ASSERT(reporter, installDiscardablePixelRefSuccess);
- SkAutoDataUnref newKtxData(image->encode(SkImageEncoder::kKTX_Type, 0));
- REPORTER_ASSERT(reporter, newKtxData.get());
+ // Write the bitmap out to a KTX file.
+ SkData *ktxDataPtr = SkImageEncoder::EncodeData(etcBitmap, SkImageEncoder::kKTX_Type, 0);
+ SkAutoDataUnref newKtxData(ktxDataPtr);
+ REPORTER_ASSERT(reporter, ktxDataPtr);
// See is this data is identical to data in existing ktx file.
SkString ktxFilename = GetResourcePath("mandrill_128.ktx");