chromium/ui/gfx/codec/png_codec.cc

// Copyright 2012 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "ui/gfx/codec/png_codec.h"

#include <stdint.h>

#include "base/logging.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/strings/string_util.h"
#include "third_party/skia/include/codec/SkPngDecoder.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"
#include "third_party/skia/include/encode/SkPngEncoder.h"
#include "third_party/zlib/zlib.h"
#include "ui/gfx/codec/vector_wstream.h"
#include "ui/gfx/geometry/size.h"

namespace gfx {

// Decoder --------------------------------------------------------------------

static bool PrepareForPNGDecode(const unsigned char* input,
                                size_t input_size,
                                PNGCodec::ColorFormat format,
                                std::unique_ptr<SkCodec>* codec,
                                SkImageInfo* image_info) {}

// static
bool PNGCodec::Decode(const unsigned char* input,
                      size_t input_size,
                      ColorFormat format,
                      std::vector<unsigned char>* output,
                      int* w,
                      int* h) {}

// static
bool PNGCodec::Decode(const unsigned char* input,
                      size_t input_size,
                      SkBitmap* bitmap) {}

// Encoder --------------------------------------------------------------------

namespace {

void AddComments(SkPngEncoder::Options& options,
                 const std::vector<PNGCodec::Comment>& comments) {}

bool EncodeSkPixmap(const SkPixmap& src,
                    const std::vector<PNGCodec::Comment>& comments,
                    std::vector<unsigned char>* output,
                    int zlib_level,
                    bool disable_filters) {}

bool EncodeSkPixmap(const SkPixmap& src,
                    bool discard_transparency,
                    const std::vector<PNGCodec::Comment>& comments,
                    std::vector<unsigned char>* output,
                    int zlib_level,
                    bool disable_filters) {}

bool EncodeSkBitmap(const SkBitmap& input,
                    bool discard_transparency,
                    std::vector<unsigned char>* output,
                    int zlib_level,
                    bool disable_filters) {}

}  // namespace

// static
bool PNGCodec::Encode(const unsigned char* input,
                      ColorFormat format,
                      const Size& size,
                      int row_byte_width,
                      bool discard_transparency,
                      const std::vector<Comment>& comments,
                      std::vector<unsigned char>* output) {}

// static
bool PNGCodec::EncodeBGRASkBitmap(const SkBitmap& input,
                                  bool discard_transparency,
                                  std::vector<unsigned char>* output) {}

// static
bool PNGCodec::EncodeA8SkBitmap(const SkBitmap& input,
                                std::vector<unsigned char>* output) {}

// static
bool PNGCodec::FastEncodeBGRASkBitmap(const SkBitmap& input,
                                      bool discard_transparency,
                                      std::vector<unsigned char>* output) {}

PNGCodec::Comment::Comment(const std::string& k, const std::string& t)
    :{}

PNGCodec::Comment::~Comment() = default;

}  // namespace gfx