| 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 |
| 11 #include "GrTextureParamsAdjuster.h" | 11 #include "GrTextureParamsAdjuster.h" |
| 12 #include "SkImage.h" |
| 12 | 13 |
| 13 class SkBitmap; | 14 class SkBitmap; |
| 14 class SkImage_Base; | 15 class SkImage_Base; |
| 16 class SkImageCacherator; |
| 15 | 17 |
| 16 /** Implementation for texture-backed SkBitmaps. The bitmap must stay in scope a
nd unmodified | 18 /** Implementation for texture-backed SkBitmaps. The bitmap must stay in scope a
nd unmodified |
| 17 while this object exists. */ | 19 while this object exists. */ |
| 18 class GrBitmapTextureAdjuster : public GrTextureAdjuster { | 20 class GrBitmapTextureAdjuster : public GrTextureAdjuster { |
| 19 public: | 21 public: |
| 20 explicit GrBitmapTextureAdjuster(const SkBitmap* bmp); | 22 explicit GrBitmapTextureAdjuster(const SkBitmap* bmp); |
| 21 | 23 |
| 22 private: | 24 private: |
| 23 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; | 25 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; |
| 24 | 26 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 61 |
| 60 void didCacheCopy(const GrUniqueKey& copyKey) override; | 62 void didCacheCopy(const GrUniqueKey& copyKey) override; |
| 61 | 63 |
| 62 private: | 64 private: |
| 63 const SkBitmap fBitmap; | 65 const SkBitmap fBitmap; |
| 64 GrUniqueKey fOriginalKey; | 66 GrUniqueKey fOriginalKey; |
| 65 | 67 |
| 66 typedef GrTextureMaker INHERITED; | 68 typedef GrTextureMaker INHERITED; |
| 67 }; | 69 }; |
| 68 | 70 |
| 71 /** This class manages the conversion of generator-backed images to GrTextures.
If the caching hint |
| 72 is kAllow the image's ID is used for the cache key. */ |
| 73 class GrImageTextureMaker : public GrTextureMaker { |
| 74 public: |
| 75 GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkI
mage* client, |
| 76 SkImage::CachingHint chint); |
| 77 |
| 78 protected: |
| 79 // TODO: consider overriding this, for the case where the underlying generat
or might be |
| 80 // able to efficiently produce a "stretched" texture natively (e.g. pi
cture-backed) |
| 81 // GrTexture* generateTextureForParams(const CopyParams&) override; |
| 82 |
| 83 GrTexture* refOriginalTexture() override; |
| 84 void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) over
ride; |
| 85 void didCacheCopy(const GrUniqueKey& copyKey) override; |
| 86 |
| 87 private: |
| 88 SkImageCacherator* fCacher; |
| 89 const SkImage* fClient; |
| 90 GrUniqueKey fOriginalKey; |
| 91 SkImage::CachingHint fCachingHint; |
| 92 |
| 93 typedef GrTextureMaker INHERITED; |
| 94 }; |
| 95 |
| 69 #endif | 96 #endif |
| OLD | NEW |