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

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

Issue 110593003: Add onNewLockPixels, that returns rowbytes and relies on info in pixelref (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 11 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 | « src/lazy/SkCachingPixelRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('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 * 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 10 matching lines...) Expand all
21 * Since SkColorTable is reference-counted, we do not support indexed 21 * Since SkColorTable is reference-counted, we do not support indexed
22 * color with this class; there would be no way for the discardable 22 * color with this class; there would be no way for the discardable
23 * memory system to unref the color table. 23 * memory system to unref the color table.
24 */ 24 */
25 class SkDiscardablePixelRef : public SkPixelRef { 25 class SkDiscardablePixelRef : public SkPixelRef {
26 public: 26 public:
27 SK_DECLARE_UNFLATTENABLE_OBJECT() 27 SK_DECLARE_UNFLATTENABLE_OBJECT()
28 28
29 protected: 29 protected:
30 ~SkDiscardablePixelRef(); 30 ~SkDiscardablePixelRef();
31 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE; 31
32 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
32 virtual void onUnlockPixels() SK_OVERRIDE; 33 virtual void onUnlockPixels() SK_OVERRIDE;
33 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } 34 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
34 35
35 virtual SkData* onRefEncodedData() SK_OVERRIDE { 36 virtual SkData* onRefEncodedData() SK_OVERRIDE {
36 return fGenerator->refEncodedData(); 37 return fGenerator->refEncodedData();
37 } 38 }
38 39
39 private: 40 private:
40 SkImageGenerator* const fGenerator; 41 SkImageGenerator* const fGenerator;
41 SkDiscardableMemory::Factory* const fDMFactory; 42 SkDiscardableMemory::Factory* const fDMFactory;
42 const size_t fRowBytes; 43 const size_t fRowBytes;
43 // These const members should not change over the life of the 44 // These const members should not change over the life of the
44 // PixelRef, since the SkBitmap doesn't expect them to change. 45 // PixelRef, since the SkBitmap doesn't expect them to change.
45 46
46 SkDiscardableMemory* fDiscardableMemory; 47 SkDiscardableMemory* fDiscardableMemory;
47 48
48 /* Takes ownership of SkImageGenerator. */ 49 /* Takes ownership of SkImageGenerator. */
49 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*, 50 SkDiscardablePixelRef(const SkImageInfo&, SkImageGenerator*,
50 size_t rowBytes, 51 size_t rowBytes,
51 SkDiscardableMemory::Factory* factory); 52 SkDiscardableMemory::Factory* factory);
53
52 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, 54 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*,
53 SkBitmap*, 55 SkBitmap*,
54 SkDiscardableMemory::Factory*); 56 SkDiscardableMemory::Factory*);
57
55 typedef SkPixelRef INHERITED; 58 typedef SkPixelRef INHERITED;
56 }; 59 };
60
57 #endif // SkDiscardablePixelRef_DEFINED 61 #endif // SkDiscardablePixelRef_DEFINED
OLDNEW
« no previous file with comments | « src/lazy/SkCachingPixelRef.cpp ('k') | src/lazy/SkDiscardablePixelRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698