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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 }; | 48 }; |
49 | 49 |
50 /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the
input bitmap is | 50 /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the
input bitmap is |
51 non-volatile the texture is cached using a key created from the pixels' imag
e id and the | 51 non-volatile the texture is cached using a key created from the pixels' imag
e id and the |
52 subset of the pixelref specified by the bitmap. */ | 52 subset of the pixelref specified by the bitmap. */ |
53 class GrBitmapTextureMaker : public GrTextureMaker { | 53 class GrBitmapTextureMaker : public GrTextureMaker { |
54 public: | 54 public: |
55 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); | 55 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); |
56 | 56 |
57 protected: | 57 protected: |
58 GrTexture* refOriginalTexture(bool willBeMipped) override; | 58 GrTexture* refOriginalTexture(bool willBeMipped, bool gammaCorrect) override
; |
59 | 59 |
60 void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) overrid
e; | 60 void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey) overrid
e; |
61 | 61 |
62 void didCacheCopy(const GrUniqueKey& copyKey) override; | 62 void didCacheCopy(const GrUniqueKey& copyKey) override; |
63 | 63 |
64 private: | 64 private: |
65 const SkBitmap fBitmap; | 65 const SkBitmap fBitmap; |
66 GrUniqueKey fOriginalKey; | 66 GrUniqueKey fOriginalKey; |
67 | 67 |
68 typedef GrTextureMaker INHERITED; | 68 typedef GrTextureMaker INHERITED; |
69 }; | 69 }; |
70 | 70 |
71 /** This class manages the conversion of generator-backed images to GrTextures.
If the caching hint | 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. */ | 72 is kAllow the image's ID is used for the cache key. */ |
73 class GrImageTextureMaker : public GrTextureMaker { | 73 class GrImageTextureMaker : public GrTextureMaker { |
74 public: | 74 public: |
75 GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkI
mage* client, | 75 GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkI
mage* client, |
76 SkImage::CachingHint chint); | 76 SkImage::CachingHint chint); |
77 | 77 |
78 protected: | 78 protected: |
79 // TODO: consider overriding this, for the case where the underlying generat
or might be | 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) | 80 // able to efficiently produce a "stretched" texture natively (e.g. pi
cture-backed) |
81 // GrTexture* generateTextureForParams(const CopyParams&) override; | 81 // GrTexture* generateTextureForParams(const CopyParams&) override; |
82 | 82 |
83 GrTexture* refOriginalTexture(bool willBeMipped) override; | 83 GrTexture* refOriginalTexture(bool willBeMipped, bool gammaCorrect) override
; |
84 void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) over
ride; | 84 void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) over
ride; |
85 void didCacheCopy(const GrUniqueKey& copyKey) override; | 85 void didCacheCopy(const GrUniqueKey& copyKey) override; |
86 | 86 |
87 private: | 87 private: |
88 SkImageCacherator* fCacher; | 88 SkImageCacherator* fCacher; |
89 const SkImage* fClient; | 89 const SkImage* fClient; |
90 GrUniqueKey fOriginalKey; | 90 GrUniqueKey fOriginalKey; |
91 SkImage::CachingHint fCachingHint; | 91 SkImage::CachingHint fCachingHint; |
92 | 92 |
93 typedef GrTextureMaker INHERITED; | 93 typedef GrTextureMaker INHERITED; |
94 }; | 94 }; |
95 | 95 |
96 #endif | 96 #endif |
OLD | NEW |