| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrImageIDTextureAdjuster_DEFINED | 8 #ifndef GrImageIDTextureAdjuster_DEFINED |
| 9 #define GrImageIDTextureAdjuster_DEFINED | 9 #define GrImageIDTextureAdjuster_DEFINED |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public: | 22 public: |
| 23 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); | 23 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); |
| 24 | 24 |
| 25 protected: | 25 protected: |
| 26 GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) ove
rride; | 26 GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) ove
rride; |
| 27 | 27 |
| 28 void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) overrid
e; | 28 void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) overrid
e; |
| 29 | 29 |
| 30 void didCacheCopy(const GrUniqueKey& copyKey) override; | 30 void didCacheCopy(const GrUniqueKey& copyKey) override; |
| 31 | 31 |
| 32 SkAlphaType alphaType() const override; |
| 32 SkColorSpace* getColorSpace() override; | 33 SkColorSpace* getColorSpace() override; |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 const SkBitmap fBitmap; | 36 const SkBitmap fBitmap; |
| 36 GrUniqueKey fOriginalKey; | 37 GrUniqueKey fOriginalKey; |
| 37 | 38 |
| 38 typedef GrTextureMaker INHERITED; | 39 typedef GrTextureMaker INHERITED; |
| 39 }; | 40 }; |
| 40 | 41 |
| 41 /** This class manages the conversion of generator-backed images to GrTextures.
If the caching hint | 42 /** This class manages the conversion of generator-backed images to GrTextures.
If the caching hint |
| 42 is kAllow the image's ID is used for the cache key. */ | 43 is kAllow the image's ID is used for the cache key. */ |
| 43 class GrImageTextureMaker : public GrTextureMaker { | 44 class GrImageTextureMaker : public GrTextureMaker { |
| 44 public: | 45 public: |
| 45 GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkI
mage* client, | 46 GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkI
mage* client, |
| 46 SkImage::CachingHint chint); | 47 SkImage::CachingHint chint); |
| 47 | 48 |
| 48 protected: | 49 protected: |
| 49 // TODO: consider overriding this, for the case where the underlying generat
or might be | 50 // TODO: consider overriding this, for the case where the underlying generat
or might be |
| 50 // able to efficiently produce a "stretched" texture natively (e.g. pi
cture-backed) | 51 // able to efficiently produce a "stretched" texture natively (e.g. pi
cture-backed) |
| 51 // GrTexture* generateTextureForParams(const CopyParams&) override; | 52 // GrTexture* generateTextureForParams(const CopyParams&) override; |
| 52 | 53 |
| 53 GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) ove
rride; | 54 GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) ove
rride; |
| 54 void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) over
ride; | 55 void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) over
ride; |
| 55 void didCacheCopy(const GrUniqueKey& copyKey) override; | 56 void didCacheCopy(const GrUniqueKey& copyKey) override; |
| 56 | 57 |
| 58 SkAlphaType alphaType() const override; |
| 57 SkColorSpace* getColorSpace() override; | 59 SkColorSpace* getColorSpace() override; |
| 58 | 60 |
| 59 private: | 61 private: |
| 60 SkImageCacherator* fCacher; | 62 SkImageCacherator* fCacher; |
| 61 const SkImage* fClient; | 63 const SkImage* fClient; |
| 62 GrUniqueKey fOriginalKey; | 64 GrUniqueKey fOriginalKey; |
| 63 SkImage::CachingHint fCachingHint; | 65 SkImage::CachingHint fCachingHint; |
| 64 | 66 |
| 65 typedef GrTextureMaker INHERITED; | 67 typedef GrTextureMaker INHERITED; |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 #endif | 70 #endif |
| OLD | NEW |