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

Side by Side Diff: include/gpu/SkGrPixelRef.h

Issue 103033005: Revert "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 | « include/gpu/SkGr.h ('k') | include/images/SkImageRef.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 2010 Google Inc. 3 * Copyright 2010 Google Inc.
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 10
11 #ifndef SkGrPixelRef_DEFINED 11 #ifndef SkGrPixelRef_DEFINED
12 #define SkGrPixelRef_DEFINED 12 #define SkGrPixelRef_DEFINED
13 13
14 #include "SkBitmap.h" 14 #include "SkBitmap.h"
15 #include "SkPixelRef.h" 15 #include "SkPixelRef.h"
16 #include "GrTexture.h" 16 #include "GrTexture.h"
17 #include "GrRenderTarget.h" 17 #include "GrRenderTarget.h"
18 18
19 19
20 /** 20 /**
21 * Common baseclass that implements onLockPixels() by calling onReadPixels(). 21 * Common baseclass that implements onLockPixels() by calling onReadPixels().
22 * Since it has a copy, it always returns false for onLockPixelsAreWritable(). 22 * Since it has a copy, it always returns false for onLockPixelsAreWritable().
23 */ 23 */
24 class SK_API SkROLockPixelsPixelRef : public SkPixelRef { 24 class SK_API SkROLockPixelsPixelRef : public SkPixelRef {
25 public: 25 public:
26 SkROLockPixelsPixelRef(const SkImageInfo&); 26 SkROLockPixelsPixelRef();
27 virtual ~SkROLockPixelsPixelRef(); 27 virtual ~SkROLockPixelsPixelRef();
28 28
29 protected: 29 protected:
30 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; 30 // override from SkPixelRef
31 virtual void onUnlockPixels() SK_OVERRIDE; 31 virtual void* onLockPixels(SkColorTable** ptr);
32 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE; // return false; 32 virtual void onUnlockPixels();
33 virtual bool onLockPixelsAreWritable() const; // return false;
33 34
34 private: 35 private:
35 SkBitmap fBitmap; 36 SkBitmap fBitmap;
36 typedef SkPixelRef INHERITED; 37 typedef SkPixelRef INHERITED;
37 }; 38 };
38 39
39 /** 40 /**
40 * PixelRef that wraps a GrSurface 41 * PixelRef that wraps a GrSurface
41 */ 42 */
42 class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef { 43 class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef {
43 public: 44 public:
44 /** 45 /**
45 * Constructs a pixel ref around a GrSurface. If the caller has locked the G rSurface in the 46 * Constructs a pixel ref around a GrSurface. If the caller has locked the G rSurface in the
46 * cache and would like the pixel ref to unlock it in its destructor then tr ansferCacheLock 47 * cache and would like the pixel ref to unlock it in its destructor then tr ansferCacheLock
47 * should be set to true. 48 * should be set to true.
48 */ 49 */
50 SkGrPixelRef(GrSurface*, bool transferCacheLock = false);
49 SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false) ; 51 SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false) ;
50 virtual ~SkGrPixelRef(); 52 virtual ~SkGrPixelRef();
51 53
52 // override from SkPixelRef 54 // override from SkPixelRef
53 virtual GrTexture* getTexture() SK_OVERRIDE; 55 virtual GrTexture* getTexture() SK_OVERRIDE;
54 56
55 SK_DECLARE_UNFLATTENABLE_OBJECT() 57 SK_DECLARE_UNFLATTENABLE_OBJECT()
56 58
57 protected: 59 protected:
58 // overrides from SkPixelRef 60 // overrides from SkPixelRef
59 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE; 61 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE;
60 virtual SkPixelRef* deepCopy(SkBitmap::Config dstConfig, const SkIRect* subs et) SK_OVERRIDE; 62 virtual SkPixelRef* deepCopy(SkBitmap::Config dstConfig, const SkIRect* subs et) SK_OVERRIDE;
61 63
62 private: 64 private:
63 GrSurface* fSurface; 65 GrSurface* fSurface;
64 bool fUnlock; // if true the pixel ref owns a texture cache lock on fSurface 66 bool fUnlock; // if true the pixel ref owns a texture cache lock on fSurface
65 67
66 typedef SkROLockPixelsPixelRef INHERITED; 68 typedef SkROLockPixelsPixelRef INHERITED;
67 }; 69 };
68 70
69 #endif 71 #endif
OLDNEW
« no previous file with comments | « include/gpu/SkGr.h ('k') | include/images/SkImageRef.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698