| Index: Source/core/platform/graphics/DecodingImageGenerator.h
|
| diff --git a/Source/core/platform/graphics/DecodingImageGenerator.h b/Source/core/platform/graphics/DecodingImageGenerator.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..ba3dd314d56000cfcdcb128e824c4091d6f501a7
|
| --- /dev/null
|
| +++ b/Source/core/platform/graphics/DecodingImageGenerator.h
|
| @@ -0,0 +1,79 @@
|
| +/*
|
| + * Copyright (C) 2013 Google Inc. All rights reserved.
|
| + *
|
| + * Redistribution and use in source and binary forms, with or without
|
| + * modification, are permitted provided that the following conditions
|
| + * are met:
|
| + * 1. Redistributions of source code must retain the above copyright
|
| + * notice, this list of conditions and the following disclaimer.
|
| + * 2. Redistributions in binary form must reproduce the above copyright
|
| + * notice, this list of conditions and the following disclaimer in the
|
| + * documentation and/or other materials provided with the distribution.
|
| + *
|
| + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
|
| + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
| + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
| + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
|
| + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
| + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
| + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
| + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
| + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| + */
|
| +
|
| +#ifndef DecodingImageGenerator_h
|
| +#define DecodingImageGenerator_h
|
| +
|
| +#include "ImageFrameGenerator.h"
|
| +#include "third_party/skia/include/core/SkImageGenerator.h"
|
| +
|
| +/**
|
| + * Blink's implementation of the Skia SkImageGenerator interface
|
| + * (allows a SkDiscardablePixelRef to re-decode an image).
|
| + */
|
| +namespace WebCore {
|
| +
|
| +class DecodingImageGenerator : public SkImageGenerator {
|
| +public:
|
| + static bool Install(PassRefPtr<ImageFrameGenerator>, size_t index, SkBitmap* dst);
|
| +
|
| + DecodingImageGenerator(PassRefPtr<ImageFrameGenerator>, size_t index);
|
| + virtual ~DecodingImageGenerator();
|
| +
|
| + /**
|
| + * Return a ref to the encoded (i.e. compressed) representation,
|
| + * of this data.
|
| + *
|
| + * If non-NULL is returned, the caller is responsible for calling
|
| + * unref() on the data when it is finished.
|
| + */
|
| + virtual SkData* refEncodedData() SK_OVERRIDE;
|
| +
|
| + /**
|
| + * Return some information about the image, allowing the owner fo
|
| + * this object to allocate pixels.
|
| + *
|
| + * @return false if anything goes wrong.
|
| + */
|
| + virtual bool getInfo(SkImageInfo*) SK_OVERRIDE;
|
| +
|
| + /**
|
| + * Decode into the given pixels, a block of memory of size at
|
| + * least (info.fHeight - 1) * rowBytes + (info.fWidth *
|
| + * bytesPerPixel)
|
| + *
|
| + * @param SkImageInfo Should be identical to the info returned by
|
| + * getInfo so that the implementation will confirm that
|
| + * the caller knows what it is asking for (config, size).
|
| + *
|
| + * @return false if anything goes wrong.
|
| + */
|
| + virtual bool getPixels(const SkImageInfo&, void* pixels, size_t rowBytes) SK_OVERRIDE;
|
| +private:
|
| + RefPtr<ImageFrameGenerator> m_frameGenerator;
|
| + size_t m_frameIndex;
|
| +};
|
| +} // namespace WebCore
|
| +#endif // DecodingImageGenerator_h
|
|
|