Home | History | Annotate | Download | only in ports
      1 
      2 /*
      3  * Copyright 2006 The Android Open Source Project
      4  *
      5  * Use of this source code is governed by a BSD-style license that can be
      6  * found in the LICENSE file.
      7  */
      8 
      9 #include "SkBitmap.h"
     10 #include "SkImage.h"
     11 #include "SkImageDecoder.h"
     12 #include "SkImageEncoder.h"
     13 #include "SkMovie.h"
     14 #include "SkPixelSerializer.h"
     15 #include "SkStream.h"
     16 
     17 class SkColorTable;
     18 class SkPngChunkReader;
     19 
     20 // Empty implementations for SkImageDecoder.
     21 
     22 SkImageDecoder::SkImageDecoder() {}
     23 
     24 SkImageDecoder::~SkImageDecoder() {}
     25 
     26 SkImageDecoder* SkImageDecoder::Factory(SkStreamRewindable*) {
     27     return nullptr;
     28 }
     29 
     30 void SkImageDecoder::copyFieldsToOther(SkImageDecoder* ) {}
     31 
     32 bool SkImageDecoder::DecodeFile(const char[], SkBitmap*, SkColorType, Mode, Format*) {
     33     return false;
     34 }
     35 
     36 SkImageDecoder::Result SkImageDecoder::decode(SkStream*, SkBitmap*, SkColorType, Mode) {
     37     return kFailure;
     38 }
     39 
     40 bool SkImageDecoder::DecodeStream(SkStreamRewindable*, SkBitmap*, SkColorType, Mode, Format*) {
     41     return false;
     42 }
     43 
     44 bool SkImageDecoder::DecodeMemory(const void*, size_t, SkBitmap*, SkColorType, Mode, Format*) {
     45     return false;
     46 }
     47 
     48 bool SkImageDecoder::decodeYUV8Planes(SkStream*, SkISize[3], void*[3],
     49                                       size_t[3], SkYUVColorSpace*) {
     50     return false;
     51 }
     52 
     53 SkImageDecoder::Format SkImageDecoder::getFormat() const {
     54     return kUnknown_Format;
     55 }
     56 
     57 SkImageDecoder::Format SkImageDecoder::GetStreamFormat(SkStreamRewindable*) {
     58     return kUnknown_Format;
     59 }
     60 
     61 const char* SkImageDecoder::GetFormatName(Format) {
     62     return nullptr;
     63 }
     64 
     65 SkPngChunkReader* SkImageDecoder::setPeeker(SkPngChunkReader*) {
     66     return nullptr;
     67 }
     68 
     69 SkBitmap::Allocator* SkImageDecoder::setAllocator(SkBitmap::Allocator*) {
     70     return nullptr;
     71 }
     72 
     73 void SkImageDecoder::setSampleSize(int) {}
     74 
     75 bool SkImageDecoder::allocPixelRef(SkBitmap*, SkColorTable*) const {
     76     return false;
     77 }
     78 
     79 /////////////////////////////////////////////////////////////////////////
     80 
     81 // Empty implementation for SkMovie.
     82 
     83 SkMovie* SkMovie::DecodeStream(SkStreamRewindable* stream) {
     84     return nullptr;
     85 }
     86 
     87 /////////////////////////////////////////////////////////////////////////
     88 
     89 // Empty implementations for SkImageEncoder.
     90 
     91 SkImageEncoder* SkImageEncoder::Create(Type t) {
     92     return nullptr;
     93 }
     94 
     95 bool SkImageEncoder::EncodeFile(const char file[], const SkBitmap&, Type, int quality) {
     96     return false;
     97 }
     98 
     99 bool SkImageEncoder::EncodeStream(SkWStream*, const SkBitmap&, SkImageEncoder::Type, int) {
    100     return false;
    101 }
    102 
    103 SkData* SkImageEncoder::EncodeData(const SkBitmap&, Type, int quality) {
    104     return nullptr;
    105 }
    106 
    107 SkData* SkImageEncoder::EncodeData(const SkImageInfo&, const void* pixels, size_t rowBytes,
    108                                    Type, int quality) {
    109     return nullptr;
    110 }
    111 
    112 SkData* SkImageEncoder::EncodeData(const SkPixmap&, Type, int) {
    113     return nullptr;
    114 }
    115 
    116 bool SkImageEncoder::encodeStream(SkWStream*, const SkBitmap&, int) {
    117     return false;
    118 }
    119 
    120 SkData* SkImageEncoder::encodeData(const SkBitmap&, int) {
    121     return nullptr;
    122 }
    123 
    124 bool SkImageEncoder::encodeFile(const char file[], const SkBitmap& bm, int quality) {
    125     return false;
    126 }
    127 
    128 namespace {
    129 class ImageEncoderPixelSerializer final : public SkPixelSerializer {
    130 protected:
    131     bool onUseEncodedData(const void*, size_t) override { return true; }
    132     SkData* onEncode(const SkPixmap&) override { return nullptr; }
    133 };
    134 }  // namespace
    135 
    136 SkPixelSerializer* SkImageEncoder::CreatePixelSerializer() {
    137     return new ImageEncoderPixelSerializer;
    138 }
    139 
    140 /////////////////////////////////////////////////////////////////////////
    141