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

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

Issue 113193003: Revert of remvoe duplicate impl for SkImageInfo flattening (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: 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 | « 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
11 #include "SkDiscardableMemory.h" 11 #include "SkDiscardableMemory.h"
12 #include "SkImageGenerator.h" 12 #include "SkImageGenerator.h"
13 #include "SkImageInfo.h" 13 #include "SkImageInfo.h"
14 #include "SkPixelRef.h" 14 #include "SkPixelRef.h"
15 15
16 class SkDiscardablePixelRef : public SkPixelRef { 16 class SkDiscardablePixelRef : public SkPixelRef {
17 public: 17 public:
18 SK_DECLARE_UNFLATTENABLE_OBJECT() 18 SK_DECLARE_UNFLATTENABLE_OBJECT()
19 19
20 protected: 20 protected:
21 ~SkDiscardablePixelRef(); 21 ~SkDiscardablePixelRef();
22 22 virtual void* onLockPixels(SkColorTable**) SK_OVERRIDE;
23 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE;
24 virtual void onUnlockPixels() SK_OVERRIDE; 23 virtual void onUnlockPixels() SK_OVERRIDE;
25 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; } 24 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE { return false; }
26 25
27 virtual SkData* onRefEncodedData() SK_OVERRIDE { 26 virtual SkData* onRefEncodedData() SK_OVERRIDE {
28 return fGenerator->refEncodedData(); 27 return fGenerator->refEncodedData();
29 } 28 }
30 29
31 private: 30 private:
32 SkImageGenerator* const fGenerator; 31 SkImageGenerator* const fGenerator;
33 SkDiscardableMemory::Factory* const fDMFactory; 32 SkDiscardableMemory::Factory* const fDMFactory;
33 const SkImageInfo fInfo;
34 const size_t fSize; // size of memory to be allocated
34 const size_t fRowBytes; 35 const size_t fRowBytes;
35 // These const members should not change over the life of the 36 // These const members should not change over the life of the
36 // PixelRef, since the SkBitmap doesn't expect them to change. 37 // PixelRef, since the SkBitmap doesn't expect them to change.
37 38
38 SkDiscardableMemory* fDiscardableMemory; 39 SkDiscardableMemory* fDiscardableMemory;
39 40
40 /* Takes ownership of SkImageGenerator. */ 41 /* Takes ownership of SkImageGenerator. */
41 SkDiscardablePixelRef(SkImageGenerator* generator, 42 SkDiscardablePixelRef(SkImageGenerator* generator,
42 const SkImageInfo& info, 43 const SkImageInfo& info,
44 size_t size,
43 size_t rowBytes, 45 size_t rowBytes,
44 SkDiscardableMemory::Factory* factory); 46 SkDiscardableMemory::Factory* factory);
45
46 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*, 47 friend bool SkInstallDiscardablePixelRef(SkImageGenerator*,
47 SkBitmap*, 48 SkBitmap*,
48 SkDiscardableMemory::Factory*); 49 SkDiscardableMemory::Factory*);
49
50 typedef SkPixelRef INHERITED; 50 typedef SkPixelRef INHERITED;
51 }; 51 };
52
53 #endif // SkDiscardablePixelRef_DEFINED 52 #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