92ed61e624
This reverts commit1e0779ba11
. Reason for revert: Flutter and Fuchsia have both been switched to new API! Original change's description: > Revert "remove dead code for legacy image encode api" > > This reverts commit41ed7f3379
. > > Reason for revert: Need this in temporarily to navigate Flutter and Fuchsia rolls. > > Original change's description: > > remove dead code for legacy image encode api > > > > Bug: skia: > > Change-Id: Ia90d776946281473c56cd93006df1b523475696a > > Reviewed-on: https://skia-review.googlesource.com/23022 > > Reviewed-by: Leon Scroggins <scroggo@google.com> > > Commit-Queue: Mike Reed <reed@google.com> > > TBR=scroggo@google.com,reed@google.com > > # Not skipping CQ checks because original CL landed > 1 day ago. > > Bug: skia: > Change-Id: I078762fc13de0c455dc6f8a5725d9529af03bffc > Reviewed-on: https://skia-review.googlesource.com/23385 > Reviewed-by: Brian Osman <brianosman@google.com> > Commit-Queue: Brian Osman <brianosman@google.com> TBR=scroggo@google.com,brianosman@google.com,reed@google.com # Not skipping CQ checks because original CL landed > 1 day ago. Bug: skia: Change-Id: I2b45facf21a97d01a81c7f311252d2f45eb1f61e Reviewed-on: https://skia-review.googlesource.com/24281 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
52 lines
1.4 KiB
C++
52 lines
1.4 KiB
C++
/*
|
|
* Copyright 2014 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkPixelSerializer_DEFINED
|
|
#define SkPixelSerializer_DEFINED
|
|
|
|
#include "SkData.h"
|
|
#include "SkPixmap.h"
|
|
#include "SkRefCnt.h"
|
|
|
|
/**
|
|
* Interface for serializing pixels, e.g. SkBitmaps in an SkPicture.
|
|
*/
|
|
class SkPixelSerializer : public SkRefCnt {
|
|
public:
|
|
virtual ~SkPixelSerializer() {}
|
|
|
|
/**
|
|
* Call to determine if the client wants to serialize the encoded data. If
|
|
* false, serialize another version (e.g. the result of encodePixels).
|
|
*/
|
|
bool useEncodedData(const void* data, size_t len) {
|
|
return this->onUseEncodedData(data, len);
|
|
}
|
|
|
|
/**
|
|
* Call to get the client's version of encoding these pixels. If it
|
|
* returns NULL, serialize the raw pixels.
|
|
*/
|
|
sk_sp<SkData> encodeToData(const SkPixmap& pixmap) {
|
|
return sk_sp<SkData>(this->onEncode(pixmap));
|
|
}
|
|
|
|
protected:
|
|
/**
|
|
* Return true if you want to serialize the encoded data, false if you want
|
|
* another version serialized (e.g. the result of this->encode()).
|
|
*/
|
|
virtual bool onUseEncodedData(const void* data, size_t len) = 0;
|
|
|
|
/**
|
|
* If you want to encode these pixels, return the encoded data as an SkData
|
|
* Return null if you want to serialize the raw pixels.
|
|
*/
|
|
virtual SkData* onEncode(const SkPixmap&) = 0;
|
|
};
|
|
#endif // SkPixelSerializer_DEFINED
|