| 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 |
| 11 #include "SkBitmap.h" | 11 #include "SkBitmap.h" |
| 12 #include "SkPixelRef.h" | 12 #include "SkPixelRef.h" |
| 13 #include "GrTexture.h" | 13 #include "GrTexture.h" |
| 14 #include "GrRenderTarget.h" | 14 #include "GrRenderTarget.h" |
| 15 | 15 |
| 16 | 16 |
| 17 /** | 17 /** |
| 18 * Common baseclass that implements onLockPixels() by calling onReadPixels(). | 18 * Common baseclass that implements onLockPixels() by calling onReadPixels(). |
| 19 * Since it has a copy, it always returns false for onLockPixelsAreWritable(). | 19 * Since it has a copy, it always returns false for onLockPixelsAreWritable(). |
| 20 */ | 20 */ |
| 21 class SK_API SkROLockPixelsPixelRef : public SkPixelRef { | 21 class SK_API SkROLockPixelsPixelRef : public SkPixelRef { |
| 22 public: | 22 public: |
| 23 SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef) | 23 SK_DECLARE_INST_COUNT(SkROLockPixelsPixelRef) |
| 24 SkROLockPixelsPixelRef(const SkImageInfo&); | 24 SkROLockPixelsPixelRef(const SkImageInfo&); |
| 25 virtual ~SkROLockPixelsPixelRef(); | 25 virtual ~SkROLockPixelsPixelRef(); |
| 26 | 26 |
| 27 protected: | 27 protected: |
| 28 virtual bool onNewLockPixels(LockRec*) SK_OVERRIDE; | 28 bool onNewLockPixels(LockRec*) SK_OVERRIDE; |
| 29 virtual void onUnlockPixels() SK_OVERRIDE; | 29 void onUnlockPixels() SK_OVERRIDE; |
| 30 virtual bool onLockPixelsAreWritable() const SK_OVERRIDE; // return false; | 30 bool onLockPixelsAreWritable() const SK_OVERRIDE; // return false; |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 SkBitmap fBitmap; | 33 SkBitmap fBitmap; |
| 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. |
| 45 */ | 45 */ |
| 46 SkGrPixelRef(const SkImageInfo&, GrSurface*); | 46 SkGrPixelRef(const SkImageInfo&, GrSurface*); |
| 47 virtual ~SkGrPixelRef(); | 47 virtual ~SkGrPixelRef(); |
| 48 | 48 |
| 49 // override from SkPixelRef | 49 // override from SkPixelRef |
| 50 virtual GrTexture* getTexture() SK_OVERRIDE; | 50 GrTexture* getTexture() SK_OVERRIDE; |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 // overrides from SkPixelRef | 53 // overrides from SkPixelRef |
| 54 virtual bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE; | 54 bool onReadPixels(SkBitmap* dst, const SkIRect* subset) SK_OVERRIDE; |
| 55 virtual SkPixelRef* deepCopy(SkColorType, SkColorProfileType, | 55 virtual SkPixelRef* deepCopy(SkColorType, SkColorProfileType, |
| 56 const SkIRect* subset) SK_OVERRIDE; | 56 const SkIRect* subset) SK_OVERRIDE; |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 GrSurface* fSurface; | 59 GrSurface* fSurface; |
| 60 typedef SkROLockPixelsPixelRef INHERITED; | 60 typedef SkROLockPixelsPixelRef INHERITED; |
| 61 }; | 61 }; |
| 62 | 62 |
| 63 #endif | 63 #endif |
| OLD | NEW |