Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Side by Side Diff: include/images/SkBitmapRegionDecoder.h

Issue 12604006: Upstream Android modifications to the image encoders/decoders. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: minor fixes Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « gyp/libwebp.gyp ('k') | include/images/SkImageDecoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2011 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8
9 #ifndef SkBitmapRegionDecoder_DEFINED
10 #define SkBitmapRegionDecoder_DEFINED
11
12 #include "SkBitmap.h"
13 #include "SkImageDecoder.h"
14 #include "SkStream.h"
15
16 class SkIRect;
17
18 /**
19 * SkBitmapRegionDecoder can be used to decode a specified rect from an image.
20 * This is particularly useful when the original image is large and you only
21 * need parts of the image.
22 *
23 * However, not all image codecs on all platforms support this feature so be
24 * prepared to fallback to standard decoding if decodeRegion(...) returns false.
25 */
26 class SkBitmapRegionDecoder {
27 public:
28 SkBitmapRegionDecoder(SkImageDecoder* decoder, SkStream* stream,
29 int width, int height) {
30 fDecoder = decoder;
31 fStream = stream;
32 fWidth = width;
33 fHeight = height;
34 }
35 ~SkBitmapRegionDecoder() {
36 SkDELETE(fDecoder);
37 SkSafeUnref(fStream);
38 }
39
40 bool decodeRegion(SkBitmap* bitmap, const SkIRect& rect,
41 SkBitmap::Config pref, int sampleSize);
42
43 SkImageDecoder* getDecoder() const { return fDecoder; }
44 int getWidth() const { return fWidth; }
45 int getHeight() const { return fHeight; }
46
47 private:
48 SkImageDecoder* fDecoder;
49 SkStream* fStream;
50 int fWidth;
51 int fHeight;
52 };
53
54 #endif
OLDNEW
« no previous file with comments | « gyp/libwebp.gyp ('k') | include/images/SkImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698