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 | |
19 this object exists. */ | |
20 class GrImageTextureAdjuster : public GrTextureAdjuster { | 18 class GrImageTextureAdjuster : public GrTextureAdjuster { |
21 public: | 19 public: |
22 explicit GrImageTextureAdjuster(const SkImage_Base* img); | 20 explicit GrImageTextureAdjuster(const SkImage_Base* img); |
23 | |
24 protected: | |
25 SkColorSpace* getColorSpace() override; | |
26 | |
27 private: | |
28 void makeCopyKey(const CopyParams& params, GrUniqueKey* copyKey) override; | |
29 | |
30 void didCacheCopy(const GrUniqueKey& copyKey) override; | |
31 | |
32 const SkImage_Base* fImageBase; | |
33 | |
34 typedef GrTextureAdjuster INHERITED; | |
35 }; | 21 }; |
36 | 22 |
37 /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the
input bitmap is | 23 /** 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 | 24 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. */ | 25 subset of the pixelref specified by the bitmap. */ |
40 class GrBitmapTextureMaker : public GrTextureMaker { | 26 class GrBitmapTextureMaker : public GrTextureMaker { |
41 public: | 27 public: |
42 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); | 28 GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap); |
43 | 29 |
44 protected: | 30 protected: |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 private: | 64 private: |
79 SkImageCacherator* fCacher; | 65 SkImageCacherator* fCacher; |
80 const SkImage* fClient; | 66 const SkImage* fClient; |
81 GrUniqueKey fOriginalKey; | 67 GrUniqueKey fOriginalKey; |
82 SkImage::CachingHint fCachingHint; | 68 SkImage::CachingHint fCachingHint; |
83 | 69 |
84 typedef GrTextureMaker INHERITED; | 70 typedef GrTextureMaker INHERITED; |
85 }; | 71 }; |
86 | 72 |
87 #endif | 73 #endif |
OLD | NEW |