skia2/include/encode/SkEncoder.h
Matt Sarett 94fd06f074 Move SkPngEncoder into public API
Bug: 713862
Change-Id: I45068ed39affe41ffe0f29bf42c5ea1d9b0247ba
Reviewed-on: https://skia-review.googlesource.com/15897
Reviewed-by: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Matt Sarett <msarett@google.com>
2017-05-09 17:46:30 +00:00

42 lines
901 B
C++

/*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkEncoder_DEFINED
#define SkEncoder_DEFINED
#include "SkPixmap.h"
#include "../private/SkTemplates.h"
class SkEncoder : SkNoncopyable {
public:
/**
* Encode |numRows| rows of input. If the caller requests more rows than are remaining
* in the src, this will encode all of the remaining rows. |numRows| must be greater
* than zero.
*/
bool encodeRows(int numRows);
virtual ~SkEncoder() {}
protected:
virtual bool onEncodeRows(int numRows) = 0;
SkEncoder(const SkPixmap& src, size_t storageBytes)
: fSrc(src)
, fCurrRow(0)
, fStorage(storageBytes)
{}
const SkPixmap& fSrc;
int fCurrRow;
SkAutoTMalloc<uint8_t> fStorage;
};
#endif