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

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

Issue 108723003: Revert "Revert "PixelRef now returns (nearly) everything that is currently in SkBitmap. The goal is… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix warnings, update SkImageRef_ashmem Created 7 years 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 | « include/gpu/SkGrPixelRef.h ('k') | include/images/SkImageRef_GlobalPool.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkImageRef_DEFINED 10 #ifndef SkImageRef_DEFINED
(...skipping 16 matching lines...) Expand all
27 since it may be accessed from another thread, the caller must ensure 27 since it may be accessed from another thread, the caller must ensure
28 that this imageref is the only owner of the stream. i.e. - sole 28 that this imageref is the only owner of the stream. i.e. - sole
29 ownership of the stream object is transferred to this imageref object. 29 ownership of the stream object is transferred to this imageref object.
30 30
31 @param stream The stream containing the encoded image data. This may be 31 @param stream The stream containing the encoded image data. This may be
32 retained (by calling ref()), so the caller should not 32 retained (by calling ref()), so the caller should not
33 explicitly delete it. 33 explicitly delete it.
34 @param config The preferred config of the decoded bitmap. 34 @param config The preferred config of the decoded bitmap.
35 @param sampleSize Requested sampleSize for decoding. Defaults to 1. 35 @param sampleSize Requested sampleSize for decoding. Defaults to 1.
36 */ 36 */
37 SkImageRef(SkStreamRewindable*, SkBitmap::Config config, int sampleSize = 1, 37 SkImageRef(const SkImageInfo&, SkStreamRewindable*, int sampleSize = 1,
38 SkBaseMutex* mutex = NULL); 38 SkBaseMutex* mutex = NULL);
39 virtual ~SkImageRef(); 39 virtual ~SkImageRef();
40 40
41 /** this value is passed onto the decoder. Default is true 41 /** this value is passed onto the decoder. Default is true
42 */ 42 */
43 void setDitherImage(bool dither) { fDoDither = dither; } 43 void setDitherImage(bool dither) { fDoDither = dither; }
44 44
45 /** Return true if the image can be decoded. If so, and bitmap is non-null, 45 /** Return true if the image can be decoded. If so, and bitmap is non-null,
46 call its setConfig() with the corresponding values, but explicitly will 46 call its setConfig() with the corresponding values, but explicitly will
47 not set its pixels or colortable. Use SkPixelRef::lockPixels() for that. 47 not set its pixels or colortable. Use SkPixelRef::lockPixels() for that.
(...skipping 17 matching lines...) Expand all
65 /** Override if you want to install a custom allocator. 65 /** Override if you want to install a custom allocator.
66 When this is called we will have already acquired the mutex! 66 When this is called we will have already acquired the mutex!
67 */ 67 */
68 virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable*, SkBitmap*, 68 virtual bool onDecode(SkImageDecoder* codec, SkStreamRewindable*, SkBitmap*,
69 SkBitmap::Config, SkImageDecoder::Mode); 69 SkBitmap::Config, SkImageDecoder::Mode);
70 70
71 /* Overrides from SkPixelRef 71 /* Overrides from SkPixelRef
72 When these are called, we will have already acquired the mutex! 72 When these are called, we will have already acquired the mutex!
73 */ 73 */
74 74
75 virtual void* onLockPixels(SkColorTable**); 75 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
76 // override this in your subclass to clean up when we're unlocking pixels 76 // override this in your subclass to clean up when we're unlocking pixels
77 virtual void onUnlockPixels() {} 77 virtual void onUnlockPixels() SK_OVERRIDE {}
78 78
79 SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL); 79 SkImageRef(SkFlattenableReadBuffer&, SkBaseMutex* mutex = NULL);
80 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE; 80 virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
81 81
82 SkBitmap fBitmap; 82 SkBitmap fBitmap;
83 83
84 private: 84 private:
85 SkStreamRewindable* setStream(SkStreamRewindable*); 85 SkStreamRewindable* setStream(SkStreamRewindable*);
86 // called with mutex already held. returns true if the bitmap is in the 86 // called with mutex already held. returns true if the bitmap is in the
87 // requested state (or further, i.e. has pixels) 87 // requested state (or further, i.e. has pixels)
88 bool prepareBitmap(SkImageDecoder::Mode); 88 bool prepareBitmap(SkImageDecoder::Mode);
89 89
90 SkImageDecoderFactory* fFactory; // may be null 90 SkImageDecoderFactory* fFactory; // may be null
91 SkStreamRewindable* fStream; 91 SkStreamRewindable* fStream;
92 SkBitmap::Config fConfig;
93 int fSampleSize; 92 int fSampleSize;
94 bool fDoDither; 93 bool fDoDither;
95 bool fErrorInDecoding; 94 bool fErrorInDecoding;
96 95
97 friend class SkImageRefPool; 96 friend class SkImageRefPool;
98 97
99 SkImageRef* fPrev, *fNext; 98 SkImageRef* fPrev, *fNext;
100 size_t ramUsed() const; 99 size_t ramUsed() const;
101 100
102 typedef SkPixelRef INHERITED; 101 typedef SkPixelRef INHERITED;
103 }; 102 };
104 103
105 #endif 104 #endif
OLDNEW
« no previous file with comments | « include/gpu/SkGrPixelRef.h ('k') | include/images/SkImageRef_GlobalPool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698