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

Side by Side Diff: src/lazy/SkCachingPixelRef.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 SkCachingPixelRef_DEFINED 8 #ifndef SkCachingPixelRef_DEFINED
9 #define SkCachingPixelRef_DEFINED 9 #define SkCachingPixelRef_DEFINED
10 10
(...skipping 12 matching lines...) Expand all
23 * Decoding is handled by the pure-virtual functions onDecodeInfo() 23 * Decoding is handled by the pure-virtual functions onDecodeInfo()
24 * and onDecodePixels(). Subclasses of this class need only provide 24 * and onDecodePixels(). Subclasses of this class need only provide
25 * those two functions. 25 * those two functions.
26 */ 26 */
27 class SkCachingPixelRef : public SkPixelRef { 27 class SkCachingPixelRef : public SkPixelRef {
28 public: 28 public:
29 SkCachingPixelRef(); 29 SkCachingPixelRef();
30 virtual ~SkCachingPixelRef(); 30 virtual ~SkCachingPixelRef();
31 31
32 protected: 32 protected:
33 virtual void* onLockPixels(SkColorTable** colorTable) SK_OVERRIDE; 33 virtual bool onGetInfo(SkImageInfo*) SK_OVERRIDE;
34 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
34 virtual void onUnlockPixels() SK_OVERRIDE; 35 virtual void onUnlockPixels() SK_OVERRIDE;
35 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } 36 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
36 virtual bool onImplementsDecodeInto() SK_OVERRIDE { return true; } 37 virtual bool onImplementsDecodeInto() SK_OVERRIDE { return true; }
37 virtual bool onDecodeInto(int pow2, SkBitmap*) SK_OVERRIDE; 38 virtual bool onDecodeInto(int pow2, SkBitmap*) SK_OVERRIDE;
38 39
39 /** 40 /**
40 * Configure the supplied bitmap for this pixelRef, based on 41 * Configure the supplied bitmap for this pixelRef, based on
41 * information provided by onDecodeInfo(). Does not set the 42 * information provided by onDecodeInfo(). Does not set the
42 * bitmap's pixelRef. */ 43 * bitmap's pixelRef. */
43 bool configure(SkBitmap* bitmap); 44 bool configure(SkBitmap* bitmap);
44 45
45 /** 46 /**
46 * Cache info from onDecodeInfo(). Returns false on failure.
47 */
48 bool getInfo(SkImageInfo* info);
49
50 /**
51 * Return some information about the pixels, allowing this class 47 * Return some information about the pixels, allowing this class
52 * to allocate pixels. @return false if anything goes wrong. 48 * to allocate pixels. @return false if anything goes wrong.
53 */ 49 */
54 virtual bool onDecodeInfo(SkImageInfo* info) = 0; 50 virtual bool onDecodeInfo(SkImageInfo* info) = 0;
55 /** 51 /**
56 * Decode into the given pixels, a block of memory of size 52 * Decode into the given pixels, a block of memory of size
57 * (info.fHeight - 1) * rowBytes + (info.fWidth * bytesPerPixel) 53 * (info.fHeight - 1) * rowBytes + (info.fWidth * bytesPerPixel)
58 * 54 *
59 * @param info Should be identical to the info returned by 55 * @param info Should be identical to the info returned by
60 * onDecodeInfo so that the implementation can confirm 56 * onDecodeInfo so that the implementation can confirm
(...skipping 10 matching lines...) Expand all
71 67
72 private: 68 private:
73 bool fErrorInDecoding; 69 bool fErrorInDecoding;
74 void* fScaledCacheId; 70 void* fScaledCacheId;
75 SkImageInfo fInfo; 71 SkImageInfo fInfo;
76 72
77 typedef SkPixelRef INHERITED; 73 typedef SkPixelRef INHERITED;
78 }; 74 };
79 75
80 #endif // SkCachingPixelRef_DEFINED 76 #endif // SkCachingPixelRef_DEFINED
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698