Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: src/gpu/GrImageIDTextureAdjuster.h

Issue 1510903002: Stop wrapping images backed by generators as bitmaps in SkGpuDevice (except when tiling) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/gpu/GrImageIDTextureAdjuster.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/core/SkImageCacherator.cpp ('k') | src/gpu/GrImageIDTextureAdjuster.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698