Revert of Create an SkCodecImageGenerator (patchset #10 id:260001 of https://codereview.chromium.org/1487683004/ )

Reason for revert:
Core doesn't know about Codec.

Original issue's description:
> Create an SkCodecImageGenerator
>
> BUG=skia:
>
> patch from issue 1396323007 at patchset 120001 (http://crrev.com/1396323007#ps120001)
> GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1487683004
>
> Committed: https://skia.googlesource.com/skia/+/e1102ce1d3d0895e840e756e155ec56b5a1a7540

TBR=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:

Review URL: https://codereview.chromium.org/1582373003
This commit is contained in:
msarett 2016-01-14 12:20:45 -08:00 committed by Commit bot
parent 721772ec49
commit 8afddabeaf
5 changed files with 0 additions and 104 deletions

View File

@ -18,7 +18,6 @@
'include_dirs': [ 'include_dirs': [
'../include/c', '../include/c',
'../include/codec',
'../include/config', '../include/config',
'../include/core', '../include/core',
'../include/pathops', '../include/pathops',

View File

@ -67,7 +67,6 @@
'<(skia_src_path)/core/SkChecksum.cpp', '<(skia_src_path)/core/SkChecksum.cpp',
'<(skia_src_path)/core/SkChunkAlloc.cpp', '<(skia_src_path)/core/SkChunkAlloc.cpp',
'<(skia_src_path)/core/SkClipStack.cpp', '<(skia_src_path)/core/SkClipStack.cpp',
'<(skia_src_path)/core/SkCodecImageGenerator.cpp',
'<(skia_src_path)/core/SkColor.cpp', '<(skia_src_path)/core/SkColor.cpp',
'<(skia_src_path)/core/SkColorFilter.cpp', '<(skia_src_path)/core/SkColorFilter.cpp',
'<(skia_src_path)/core/SkColorFilterShader.cpp', '<(skia_src_path)/core/SkColorFilterShader.cpp',

View File

@ -1,46 +0,0 @@
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkCodecImageGenerator.h"
SkImageGenerator* SkCodecImageGenerator::NewFromEncodedCodec(SkData* data) {
SkCodec* codec = SkCodec::NewFromData(data);
if (nullptr == codec) {
return nullptr;
}
return new SkCodecImageGenerator(codec, data);
}
SkCodecImageGenerator::SkCodecImageGenerator(SkCodec* codec, SkData* data)
: INHERITED(codec->getInfo())
, fCodec(codec)
, fData(SkRef(data))
{}
SkData* SkCodecImageGenerator::onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) {
return SkRef(fData.get());
}
bool SkCodecImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes,
SkPMColor ctable[], int* ctableCount) {
SkCodec::Result result = fCodec->getPixels(info, pixels, rowBytes, nullptr, ctable,
ctableCount);
switch (result) {
case SkCodec::kSuccess:
case SkCodec::kIncompleteInput:
return true;
default:
return false;
}
}
bool SkCodecImageGenerator::onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
SkYUVColorSpace* colorSpace) {
return false;
}

View File

@ -1,43 +0,0 @@
/*
* Copyright 2015 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkCodec.h"
#include "SkData.h"
#include "SkImageGenerator.h"
class SkCodecImageGenerator : public SkImageGenerator {
public:
/*
* If this data represents an encoded image that we know how to decode,
* return an SkCodecImageGenerator. Otherwise return nullptr.
*
* Refs the data if an image generator can be returned. Otherwise does
* not affect the data.
*/
static SkImageGenerator* NewFromEncodedCodec(SkData* data);
protected:
SkData* onRefEncodedData(SK_REFENCODEDDATA_CTXPARAM) override;
bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor ctable[],
int* ctableCount) override;
bool onGetYUV8Planes(SkISize sizes[3], void* planes[3], size_t rowBytes[3],
SkYUVColorSpace* colorSpace) override;
private:
/*
* Takes ownership of codec
* Refs the data
*/
SkCodecImageGenerator(SkCodec* codec, SkData* data);
SkAutoTDelete<SkCodec> fCodec;
SkAutoTUnref<SkData> fData;
typedef SkImageGenerator INHERITED;
};

View File

@ -9,7 +9,6 @@
#include "SkAndroidCodec.h" #include "SkAndroidCodec.h"
#include "SkBitmap.h" #include "SkBitmap.h"
#include "SkCodec.h" #include "SkCodec.h"
#include "SkCodecImageGenerator.h"
#include "SkData.h" #include "SkData.h"
#include "SkImageDecoder.h" #include "SkImageDecoder.h"
#include "SkMD5.h" #include "SkMD5.h"
@ -380,18 +379,6 @@ static void check(skiatest::Reporter* r,
&scaledCodecDigest, &codecDigest); &scaledCodecDigest, &codecDigest);
} }
// Test SkCodecImageGenerator
if (!isIncomplete) {
SkAutoTDelete<SkStream> stream(resource(path));
SkAutoTUnref<SkData> fullData(SkData::NewFromStream(stream, stream->getLength()));
SkAutoTDelete<SkImageGenerator> gen(SkCodecImageGenerator::NewFromEncodedCodec(fullData));
SkBitmap bm;
bm.allocPixels(info);
SkAutoLockPixels autoLockPixels(bm);
REPORTER_ASSERT(r, gen->getPixels(info, bm.getPixels(), bm.rowBytes()));
compare_to_good_digest(r, codecDigest, bm);
}
// If we've just tested incomplete decodes, let's run the same test again on full decodes. // If we've just tested incomplete decodes, let's run the same test again on full decodes.
if (isIncomplete) { if (isIncomplete) {
check(r, path, size, supportsScanlineDecoding, supportsSubsetDecoding, false); check(r, path, size, supportsScanlineDecoding, supportsSubsetDecoding, false);