skia2/tests/CodecPriv.h
Leon Scroggins 571b30f611 Reland "Remove support for decoding to kIndex_8"
Original change's description:
> > Remove support for decoding to kIndex_8
> > 
> > Fix up callsites, and remove tests that no longer make sense.
> > 
> > Bug: skia:6828
> > Change-Id: I2548c4b7528b7b1be7412563156f27b52c9d4295
> > Reviewed-on: https://skia-review.googlesource.com/21664
> > Reviewed-by: Derek Sollenberger <djsollen@google.com>
> > Commit-Queue: Leon Scroggins <scroggo@google.com>
> 
> TBR=djsollen@google.com,scroggo@google.com
> 
> Change-Id: I1bc669441f250690884e75a9a61427fdf75c6907
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: skia:6828
> Reviewed-on: https://skia-review.googlesource.com/22120
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Leon Scroggins <scroggo@google.com>

TBR=djsollen@google.com,scroggo@google.com

Bug: skia:6828
Change-Id: I36ff5a11c529d29e8adc95f43b8edc6fd1dbf5b8
Reviewed-on: https://skia-review.googlesource.com/22320
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Leon Scroggins <scroggo@google.com>
2017-07-11 18:00:31 +00:00

26 lines
739 B
C++

/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef CodecPriv_DEFINED
#define CodecPriv_DEFINED
#include "SkBitmap.h"
#include "SkCodec.h"
#include "SkData.h"
inline bool decode_memory(const void* mem, size_t size, SkBitmap* bm) {
std::unique_ptr<SkCodec> codec(SkCodec::NewFromData(SkData::MakeWithoutCopy(mem, size)));
if (!codec) {
return false;
}
bm->allocPixels(codec->getInfo());
const SkCodec::Result result = codec->getPixels(codec->getInfo(), bm->getPixels(),
bm->rowBytes());
return result == SkCodec::kSuccess || result == SkCodec::kIncompleteInput;
}
#endif // CodecPriv_DEFINED