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

Side by Side Diff: src/lazy/SkDiscardablePixelRef.h

Issue 68973005: Expand pixelref to return SkImageInfo and rowbytes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add SK_SUPPORT_LEGACY_ONLOCKPIXELS so we can land in stages for Chrome 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkDiscardablePixelRef_DEFINED 8 #ifndef SkDiscardablePixelRef_DEFINED
9 #define SkDiscardablePixelRef_DEFINED 9 #define SkDiscardablePixelRef_DEFINED
10 10
(...skipping 19 matching lines...) Expand all
30 * installed into destination is destroyed, it will call 30 * installed into destination is destroyed, it will call
31 * SkDELETE() on the generator. Therefore, generator should be 31 * SkDELETE() on the generator. Therefore, generator should be
32 * allocated with SkNEW() or SkNEW_ARGS(). 32 * allocated with SkNEW() or SkNEW_ARGS().
33 */ 33 */
34 static bool Install(SkImageGenerator* generator, SkBitmap* destination); 34 static bool Install(SkImageGenerator* generator, SkBitmap* destination);
35 35
36 SK_DECLARE_UNFLATTENABLE_OBJECT() 36 SK_DECLARE_UNFLATTENABLE_OBJECT()
37 37
38 protected: 38 protected:
39 ~SkDiscardablePixelRef(); 39 ~SkDiscardablePixelRef();
40 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; 40
41 virtual bool onGetInfo(SkImageInfo*) SK_OVERRIDE;
42 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
41 virtual void onUnlockPixels() SK_OVERRIDE; 43 virtual void onUnlockPixels() SK_OVERRIDE;
42 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } 44 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
43 45
44 virtual SkData* onRefEncodedData() SK_OVERRIDE { 46 virtual SkData* onRefEncodedData() SK_OVERRIDE {
45 return fGenerator->refEncodedData(); 47 return fGenerator->refEncodedData();
46 } 48 }
47 49
48 private: 50 private:
49 SkImageGenerator* const fGenerator; 51 SkImageGenerator* const fGenerator;
50 const SkImageInfo fInfo; 52 const SkImageInfo fInfo;
51 const size_t fSize; // size of memory to be allocated 53 const size_t fSize; // size of memory to be allocated
52 const size_t fRowBytes; 54 const size_t fRowBytes;
53 // These const members should not change over the life of the 55 // These const members should not change over the life of the
54 // PixelRef, since the SkBitmap doesn't expect them to change. 56 // PixelRef, since the SkBitmap doesn't expect them to change.
55 57
56 SkDiscardableMemory* fDiscardableMemory; 58 SkDiscardableMemory* fDiscardableMemory;
57 59
58 /* Takes ownership of SkImageGenerator. */ 60 /* Takes ownership of SkImageGenerator. */
59 SkDiscardablePixelRef(SkImageGenerator* generator, 61 SkDiscardablePixelRef(SkImageGenerator* generator,
60 const SkImageInfo& info, 62 const SkImageInfo& info,
61 size_t size, 63 size_t size,
62 size_t rowBytes); 64 size_t rowBytes);
63 }; 65 };
64 #endif // SkDiscardablePixelRef_DEFINED 66 #endif // SkDiscardablePixelRef_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698