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

Side by Side Diff: src/core/SkImageCacherator.h

Issue 1473373002: optimize the disable-caching case for SkImage::readPixels (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « gm/image.cpp ('k') | src/core/SkImageCacherator.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 SkImageCacherator_DEFINED 8 #ifndef SkImageCacherator_DEFINED
9 #define SkImageCacherator_DEFINED 9 #define SkImageCacherator_DEFINED
10 10
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 */ 50 */
51 GrTexture* lockAsTexture(GrContext*, const GrTextureParams&, const SkImage* client, 51 GrTexture* lockAsTexture(GrContext*, const GrTextureParams&, const SkImage* client,
52 SkImage::CachingHint = SkImage::kAllow_CachingHint) ; 52 SkImage::CachingHint = SkImage::kAllow_CachingHint) ;
53 53
54 /** 54 /**
55 * If the underlying src naturally is represented by an encoded blob (in Sk Data), this returns 55 * If the underlying src naturally is represented by an encoded blob (in Sk Data), this returns
56 * a ref to that data. If not, it returns null. 56 * a ref to that data. If not, it returns null.
57 */ 57 */
58 SkData* refEncoded(); 58 SkData* refEncoded();
59 59
60 // Only return true if the generate has already been cached.
61 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*);
62 // Call the underlying generator directly
63 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRB,
f(malita) 2015/11/24 19:36:07 I guess this matches existing internal APIs, but w
reed1 2015/11/24 19:43:49 Yep. Would probably start with SkImageGenerator, a
64 int srcX, int srcY);
65
60 private: 66 private:
61 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui nt32_t uniqueID); 67 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui nt32_t uniqueID);
62 68
63 bool generateBitmap(SkBitmap*); 69 bool generateBitmap(SkBitmap*);
64 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); 70 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint);
65 #if SK_SUPPORT_GPU 71 #if SK_SUPPORT_GPU
66 // Returns the texture. If the cacherator is generating the texture and want s to cache it, 72 // Returns the texture. If the cacherator is generating the texture and want s to cache it,
67 // it should use the passed in key (if the key is valid). 73 // it should use the passed in key (if the key is valid).
68 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl ient, 74 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl ient,
69 SkImage::CachingHint); 75 SkImage::CachingHint);
(...skipping 16 matching lines...) Expand all
86 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator; 92 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator;
87 93
88 const SkImageInfo fInfo; 94 const SkImageInfo fInfo;
89 const SkIPoint fOrigin; 95 const SkIPoint fOrigin;
90 const uint32_t fUniqueID; 96 const uint32_t fUniqueID;
91 97
92 friend class Cacherator_GrTextureMaker; 98 friend class Cacherator_GrTextureMaker;
93 }; 99 };
94 100
95 #endif 101 #endif
OLDNEW
« no previous file with comments | « gm/image.cpp ('k') | src/core/SkImageCacherator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698