diff options
author | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-01 15:03:42 +0000 |
---|---|---|
committer | scroggo@google.com <scroggo@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-01 15:03:42 +0000 |
commit | d4c3565aac5c83ff0008453abed4c6d6009bb394 (patch) | |
tree | 413da16430a6a58301ccbce034b8dad19a3a4712 /include | |
parent | 350b4d50ea4a9a151d8049ad1d3f411bb2f2602f (diff) |
Fixes for JPEG subset decoding.
Ensure that the stream passed to JPEG for subset decoding is
neither deleted before it is no longer needed nor deleted an
extra time.
src/images/SkJpegUtility.h:
src/images/SkJpegUtility.cpp:
Always ref and unref the stream provided to skjpeg_source_mgr.
Add some comments explaining how skjpeg_source_mgr's members
handle ownership.
Fix a warning comparing signed and unsigned numbers, converting
to size_t which is more appropriate for measuring bytes.
Remove dead code referring to fMemoryBase and fMemoryBaseSize,
which are never used.
src/images/SkImageDecoder_libjpeg.cpp:
Call the new constructor for skjpeg_source_mgr, which no longer
takes a boolean to determine ownership.
include/images/SkBitmapRegionDecoder.h
src/images/SkBitmapRegionDecoder.cpp:
This small shim has been removed, since it is not needed to use
Skia's image decoders. Its functionality will be folded into
Android.
Required for the merge to Android.
R=djsollen@google.com
Review URL: https://codereview.chromium.org/21561002
git-svn-id: http://skia.googlecode.com/svn/trunk@10483 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r-- | include/images/SkBitmapRegionDecoder.h | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/include/images/SkBitmapRegionDecoder.h b/include/images/SkBitmapRegionDecoder.h deleted file mode 100644 index 56332343cc..0000000000 --- a/include/images/SkBitmapRegionDecoder.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2011 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkBitmapRegionDecoder_DEFINED -#define SkBitmapRegionDecoder_DEFINED - -#include "SkBitmap.h" -#include "SkImageDecoder.h" -#include "SkStream.h" - -struct SkIRect; - -/** - * SkBitmapRegionDecoder can be used to decode a specified rect from an image. - * This is particularly useful when the original image is large and you only - * need parts of the image. - * - * However, not all image codecs on all platforms support this feature so be - * prepared to fallback to standard decoding if decodeRegion(...) returns false. - */ -class SkBitmapRegionDecoder { -public: - SkBitmapRegionDecoder(SkImageDecoder* decoder, SkStream* stream, - int width, int height) { - fDecoder = decoder; - fStream = stream; - fWidth = width; - fHeight = height; - } - ~SkBitmapRegionDecoder() { - SkDELETE(fDecoder); - SkSafeUnref(fStream); - } - - bool decodeRegion(SkBitmap* bitmap, const SkIRect& rect, - SkBitmap::Config pref, int sampleSize); - - SkImageDecoder* getDecoder() const { return fDecoder; } - int getWidth() const { return fWidth; } - int getHeight() const { return fHeight; } - -private: - SkImageDecoder* fDecoder; - SkStream* fStream; - int fWidth; - int fHeight; -}; - -#endif |