skia2/src/ports/SkImageGeneratorCG.h
Matt Sarett ebb1b5c297 Add new SkImageGenerator::getPixels() API, deprecate the old
This is fairly aggressive in that it will break any client
that is currently using SkImageGenerator with kIndex8.
I'm guessing that we don't have any clients doing that.

Bug: skia:6620
Change-Id: Ifd16f5232bb3a9f759c225315c57492d917ed9ca
Reviewed-on: https://skia-review.googlesource.com/16601
Commit-Queue: Matt Sarett <msarett@google.com>
Reviewed-by: Mike Reed <reed@google.com>
2017-05-12 16:48:17 +00:00

44 lines
1.1 KiB
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.
*/
#include "SkTypes.h"
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
#include "SkCGUtils.h"
#include "SkData.h"
#include "SkImageGenerator.h"
#include "SkTemplates.h"
class SkImageGeneratorCG : public SkImageGenerator {
public:
/*
* Refs the data if an image generator can be returned. Otherwise does
* not affect the data.
*/
static SkImageGenerator* NewFromEncodedCG(SkData* data);
protected:
SkData* onRefEncodedData() override;
bool onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options&)
override;
private:
/*
* Takes ownership of the imageSrc
* Refs the data
*/
SkImageGeneratorCG(const SkImageInfo& info, const void* imageSrc, SkData* data);
SkAutoTCallVProc<const void, CFRelease> fImageSrc;
sk_sp<SkData> fData;
typedef SkImageGenerator INHERITED;
};
#endif //defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)