aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/codec/SkCodec.h
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2015-03-02 12:31:12 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-02 12:31:12 -0800
commitee1a726aed980016a9371ffa4768e0844c360eb2 (patch)
treed8095a07602a0b66d4a16744e5f9171d9e8ed9c6 /include/codec/SkCodec.h
parentca358852b4fed656d11107b2aaf28318a4518b49 (diff)
Revert of Add SkCodec, including PNG implementation. (patchset #24 id:460001 of https://codereview.chromium.org/930283002/)
Reason for revert: Breaking windows bots all over the place :( Original issue's description: > Add SkCodec, including PNG implementation. > > DM: > Add a flag to use SkCodec instead of SkImageDecoder. > > SkCodec: > Base class for codecs, allowing creation from an SkStream or an SkData. > An SkCodec, on creation, knows properties of the data like its width and height. Further calls can be used to generate the image. > TODO: Add scanline iterator > > SkPngCodec: > New decoder for png. Wraps libpng. The code has been repurposed from SkImageDecoder_libpng. > TODO: Handle other destination colortypes > TODO: Substitute the transpose color > TODO: Allow silencing warnings > TODO: Use RGB instead of filler? > TODO: sRGB > > SkSwizzler: > Simplified version of SkScaledSampler. Unlike the sampler, this object does no sampling. > TODO: Implement other swizzles. > > BUG=skia:3257 > > Committed: https://skia.googlesource.com/skia/+/ca358852b4fed656d11107b2aaf28318a4518b49 TBR=reed@google.com,djsollen@google.com,msarett@google.com,mtklein@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia:3257 Review URL: https://codereview.chromium.org/972743003
Diffstat (limited to 'include/codec/SkCodec.h')
-rw-r--r--include/codec/SkCodec.h92
1 files changed, 0 insertions, 92 deletions
diff --git a/include/codec/SkCodec.h b/include/codec/SkCodec.h
deleted file mode 100644
index beb9cb97b3..0000000000
--- a/include/codec/SkCodec.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright 2015 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#ifndef SkCodec_DEFINED
-#define SkCodec_DEFINED
-
-#include "SkImageGenerator.h"
-#include "SkImageInfo.h"
-#include "SkSize.h"
-#include "SkTemplates.h"
-#include "SkTypes.h"
-
-class SkData;
-class SkStream;
-
-/**
- * Abstraction layer directly on top of an image codec.
- */
-class SkCodec : public SkImageGenerator {
-public:
- /**
- * If this stream represents an encoded image that we know how to decode,
- * return an SkCodec that can decode it. Otherwise return NULL.
- *
- * If NULL is returned, the stream is deleted immediately. Otherwise, the
- * SkCodec takes ownership of it, and will delete it when done with it.
- */
- static SkCodec* NewFromStream(SkStream*);
-
- /**
- * If this data represents an encoded image that we know how to decode,
- * return an SkCodec that can decode it. Otherwise return NULL.
- *
- * Will take a ref if it returns a codec, else will not affect the data.
- */
- static SkCodec* NewFromData(SkData*);
-
- /**
- * Return a size that approximately supports the desired scale factor.
- * The codec may not be able to scale efficiently to the exact scale
- * factor requested, so return a size that approximates that scale.
- *
- * FIXME: Move to SkImageGenerator?
- */
- SkISize getScaledDimensions(float desiredScale) const;
-
-protected:
- SkCodec(const SkImageInfo&, SkStream*);
-
- /**
- * The SkAlphaType is a conservative answer. i.e. it is possible that it
- * initially returns a non-opaque answer, but completing the decode
- * reveals that the image is actually opaque.
- */
- bool onGetInfo(SkImageInfo* info) SK_OVERRIDE {
- *info = fInfo;
- return true;
- }
-
- // Helper for subclasses.
- const SkImageInfo& getOriginalInfo() { return fInfo; }
-
- virtual SkISize onGetScaledDimensions(float /* desiredScale */) const {
- // By default, scaling is not supported.
- return fInfo.dimensions();
- }
-
- /**
- * If the stream was previously read, attempt to rewind.
- * @returns:
- * true
- * - if the stream needed to be rewound, and the rewind
- * succeeded.
- * - if the stream did not need to be rewound.
- * false
- * - if the stream needed to be rewound, and rewind failed.
- * Subclasses MUST call this function before reading the stream (e.g. in
- * onGetPixels). If it returns false, onGetPixels should return
- * kCouldNotRewind.
- */
- bool SK_WARN_UNUSED_RESULT rewindIfNeeded();
-
-private:
- const SkImageInfo fInfo;
- SkAutoTDelete<SkStream> fStream;
- bool fNeedsRewind;
-};
-#endif // SkCodec_DEFINED