| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2010 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef SkGrPixelRef_DEFINED | |
| 9 #define SkGrPixelRef_DEFINED | |
| 10 | |
| 11 #include "SkBitmap.h" | |
| 12 #include "SkPixelRef.h" | |
| 13 #include "GrTexture.h" | |
| 14 #include "GrRenderTarget.h" | |
| 15 | |
| 16 | |
| 17 /** | |
| 18 * Common baseclass that implements onLockPixels() by calling onReadPixels(). | |
| 19 * Since it has a copy, it always returns false for onLockPixelsAreWritable(). | |
| 20 */ | |
| 21 class SK_API SkROLockPixelsPixelRef : public SkPixelRef { | |
| 22 public: | |
| 23 SkROLockPixelsPixelRef(const SkImageInfo&); | |
| 24 virtual ~SkROLockPixelsPixelRef(); | |
| 25 | |
| 26 protected: | |
| 27 bool onNewLockPixels(LockRec*) override; | |
| 28 void onUnlockPixels() override; | |
| 29 bool onLockPixelsAreWritable() const override; // return false; | |
| 30 | |
| 31 private: | |
| 32 SkBitmap fBitmap; | |
| 33 typedef SkPixelRef INHERITED; | |
| 34 }; | |
| 35 | |
| 36 /** | |
| 37 * PixelRef that wraps a GrSurface | |
| 38 */ | |
| 39 class SK_API SkGrPixelRef : public SkROLockPixelsPixelRef { | |
| 40 public: | |
| 41 /** | |
| 42 * Constructs a pixel ref around a GrSurface. | |
| 43 */ | |
| 44 SkGrPixelRef(const SkImageInfo&, GrSurface*); | |
| 45 virtual ~SkGrPixelRef(); | |
| 46 | |
| 47 // override from SkPixelRef | |
| 48 GrTexture* getTexture() override; | |
| 49 | |
| 50 protected: | |
| 51 // overrides from SkPixelRef | |
| 52 bool onReadPixels(SkBitmap* dst, SkColorType, const SkIRect* subset) overrid
e; | |
| 53 SkPixelRef* deepCopy(SkColorType, SkColorSpace*, const SkIRect* subset) over
ride; | |
| 54 void onNotifyPixelsChanged() override; | |
| 55 | |
| 56 private: | |
| 57 GrSurface* fSurface; | |
| 58 typedef SkROLockPixelsPixelRef INHERITED; | |
| 59 }; | |
| 60 | |
| 61 #endif | |
| OLD | NEW |