Chromium Code Reviews| 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 #include "SkImage.h" |
| 13 | 13 |
| 14 class SkBitmap; | 14 class SkBitmap; |
| 15 class SkImage_Base; | 15 class SkImage_Base; |
| 16 class SkImageCacherator; | 16 class SkImageCacherator; |
| 17 | 17 |
| 18 /** Implementation for texture-backed SkImages. The image must stay in scope and unmodified while | 18 /** Implementation for texture-backed SkImages. The texture/image must stay in s cope and |
| 19 this object exists. */ | 19 * unmodified while this object exists. |
| 20 class GrImageTextureAdjuster : public GrTextureAdjuster { | 20 */ |
| 21 class GrRawTextureAdjuster : public GrTextureAdjuster { | |
| 21 public: | 22 public: |
| 22 explicit GrImageTextureAdjuster(const SkImage_Base* img); | 23 GrRawTextureAdjuster(GrTexture*, const SkISize& size, uint32_t uniqueID, SkC olorSpace*); |
| 23 | 24 |
| 24 protected: | 25 protected: |
| 25 SkColorSpace* getColorSpace() override; | 26 SkColorSpace* getColorSpace() override; |
| 26 | 27 |
| 27 private: | 28 private: |
| 28 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; | 29 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; |
| 29 | |
| 30 void didCacheCopy(const GrUniqueKey& copyKey) override; | 30 void didCacheCopy(const GrUniqueKey& copyKey) override; |
| 31 | 31 |
| 32 const SkImage_Base* fImageBase; | 32 SkColorSpace* fColorSpace; |
| 33 SkISize fSize; | |
| 34 uint32_t fUniqueID; | |
| 33 | 35 |
| 34 typedef GrTextureAdjuster INHERITED; | 36 typedef GrTextureAdjuster INHERITED; |
| 35 }; | 37 }; |
| 36 | 38 |
| 39 class GrImageTextureAdjuster : public GrRawTextureAdjuster { | |
|
bsalomon
2016/08/15 19:10:39
I wonder if we should make GrTextureAdjuster a fin
reed1
2016/08/16 16:41:33
Done.
| |
| 40 public: | |
| 41 explicit GrImageTextureAdjuster(const SkImage_Base* img); | |
| 42 }; | |
| 43 | |
| 37 /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the input bitmap is | 44 /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the input bitmap is |
| 38 non-volatile the texture is cached using a key created from the pixels' imag e id and the | 45 non-volatile the texture is cached using a key created from the pixels' imag e id and the |
| 39 subset of the pixelref specified by the bitmap. */ | 46 subset of the pixelref specified by the bitmap. */ |
| 40 class GrBitmapTextureMaker : public GrTextureMaker { | 47 class GrBitmapTextureMaker : public GrTextureMaker { |
| 41 public: | 48 public: |
| 42 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); | 49 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); |
| 43 | 50 |
| 44 protected: | 51 protected: |
| 45 GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) ove rride; | 52 GrTexture* refOriginalTexture(bool willBeMipped, SkSourceGammaTreatment) ove rride; |
| 46 | 53 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 private: | 85 private: |
| 79 SkImageCacherator* fCacher; | 86 SkImageCacherator* fCacher; |
| 80 const SkImage* fClient; | 87 const SkImage* fClient; |
| 81 GrUniqueKey fOriginalKey; | 88 GrUniqueKey fOriginalKey; |
| 82 SkImage::CachingHint fCachingHint; | 89 SkImage::CachingHint fCachingHint; |
| 83 | 90 |
| 84 typedef GrTextureMaker INHERITED; | 91 typedef GrTextureMaker INHERITED; |
| 85 }; | 92 }; |
| 86 | 93 |
| 87 #endif | 94 #endif |
| OLD | NEW |