OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 SkGrPixelRef_DEFINED | 8 #ifndef SkGrPixelRef_DEFINED |
9 #define SkGrPixelRef_DEFINED | 9 #define SkGrPixelRef_DEFINED |
10 | 10 |
(...skipping 23 matching lines...) Expand all Loading... |
34 typedef SkPixelRef INHERITED; | 34 typedef SkPixelRef INHERITED; |
35 }; | 35 }; |
36 | 36 |
37 /** | 37 /** |
38 * PixelRef that wraps a GrSurface | 38 * PixelRef that wraps a GrSurface |
39 */ | 39 */ |
40 class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef { | 40 class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef { |
41 public: | 41 public: |
42 SK_DECLARE_INST_COUNT(SkGrPixelRef) | 42 SK_DECLARE_INST_COUNT(SkGrPixelRef) |
43 /** | 43 /** |
44 * Constructs a pixel ref around a GrSurface. | 44 * Constructs a pixel ref around a GrSurface. If the caller has locked the G
rSurface in the |
| 45 * cache and would like the pixel ref to unlock it in its destructor then tr
ansferCacheLock |
| 46 * should be set to true. |
45 */ | 47 */ |
46 SkGrPixelRef(const SkImageInfo&, GrSurface*); | 48 SkGrPixelRef(const SkImageInfo&, GrSurface*, bool transferCacheLock = false)
; |
47 virtual ~SkGrPixelRef(); | 49 virtual ~SkGrPixelRef(); |
48 | 50 |
49 // override from SkPixelRef | 51 // override from SkPixelRef |
50 virtual GrTexture* getTexture() SK_OVERRIDE; | 52 virtual GrTexture* getTexture() SK_OVERRIDE; |
51 | 53 |
52 protected: | 54 protected: |
53 // overrides from SkPixelRef | 55 // overrides from SkPixelRef |
54 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE; | 56 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE; |
55 virtual SkPixelRef* deepCopy(SkColorType, const SkIRect* subset) SK_OVERRIDE
; | 57 virtual SkPixelRef* deepCopy(SkColorType, const SkIRect* subset) SK_OVERRIDE
; |
56 | 58 |
57 private: | 59 private: |
58 GrSurface* fSurface; | 60 GrSurface* fSurface; |
| 61 bool fUnlock; // if true the pixel ref owns a texture cache lock on
fSurface |
| 62 |
59 typedef SkROLockPixelsPixelRef INHERITED; | 63 typedef SkROLockPixelsPixelRef INHERITED; |
60 }; | 64 }; |
61 | 65 |
62 #endif | 66 #endif |
OLD | NEW |