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

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

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: Updating tests. Created 4 years, 1 month 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 | « no previous file | src/core/SkImageCacherator.cpp » ('j') | tests/ImageTest.cpp » ('J')
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 * formats, so others (e.g. PNG) can just return nullptr. 60 * formats, so others (e.g. PNG) can just return nullptr.
61 */ 61 */
62 SkData* refEncoded(GrContext*); 62 SkData* refEncoded(GrContext*);
63 63
64 // Only return true if the generate has already been cached. 64 // Only return true if the generate has already been cached.
65 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*); 65 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*);
66 // Call the underlying generator directly 66 // Call the underlying generator directly
67 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRB, 67 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRB,
68 int srcX, int srcY); 68 int srcX, int srcY);
69 69
70 #if SK_SUPPORT_GPU
71 /**
72 * Returns true if the generate can efficiently return a texture (given the properties of the
73 * proxy). By default, simple codecs will usually return false, since they m ust be decoded
74 * on the CPU and then uploaded to become a texture.
75 */
76 bool canGenerateTexture(const GrContextThreadSafeProxy& proxy);
77 #endif
78
70 private: 79 private:
71 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui nt32_t uniqueID); 80 SkImageCacherator(SkImageGenerator*, const SkImageInfo&, const SkIPoint&, ui nt32_t uniqueID);
72 81
73 bool generateBitmap(SkBitmap*); 82 bool generateBitmap(SkBitmap*);
74 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint); 83 bool tryLockAsBitmap(SkBitmap*, const SkImage*, SkImage::CachingHint);
75 #if SK_SUPPORT_GPU 84 #if SK_SUPPORT_GPU
76 // Returns the texture. If the cacherator is generating the texture and want s to cache it, 85 // Returns the texture. If the cacherator is generating the texture and want s to cache it,
77 // it should use the passed in key (if the key is valid). 86 // it should use the passed in key (if the key is valid).
78 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl ient, 87 GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* cl ient,
79 SkImage::CachingHint, bool willBeMipped, SkSourceGamm aTreatment); 88 SkImage::CachingHint, bool willBeMipped, SkSourceGamm aTreatment);
(...skipping 16 matching lines...) Expand all
96 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator; 105 SkAutoTDelete<SkImageGenerator> fNotThreadSafeGenerator;
97 106
98 const SkImageInfo fInfo; 107 const SkImageInfo fInfo;
99 const SkIPoint fOrigin; 108 const SkIPoint fOrigin;
100 const uint32_t fUniqueID; 109 const uint32_t fUniqueID;
101 110
102 friend class GrImageTextureMaker; 111 friend class GrImageTextureMaker;
103 }; 112 };
104 113
105 #endif 114 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkImageCacherator.cpp » ('j') | tests/ImageTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698