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

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

Issue 2337803002: Don't copy image buffer when calculating size.
Patch Set: Making SkImage_Gpu always return false. 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 | « include/gpu/GrContext.h ('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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 * formats, so others (e.g. PNG) can just return nullptr. 62 * formats, so others (e.g. PNG) can just return nullptr.
63 */ 63 */
64 SkData* refEncoded(GrContext*); 64 SkData* refEncoded(GrContext*);
65 65
66 // Only return true if the generate has already been cached. 66 // Only return true if the generate has already been cached.
67 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*); 67 bool lockAsBitmapOnlyIfAlreadyCached(SkBitmap*);
68 // Call the underlying generator directly 68 // Call the underlying generator directly
69 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRB, 69 bool directGeneratePixels(const SkImageInfo& dstInfo, void* dstPixels, size_ t dstRB,
70 int srcX, int srcY); 70 int srcX, int srcY);
71 71
72 #if SK_SUPPORT_GPU
73 /**
74 * Returns true if the generate can efficiently return a texture (given the properties of the
75 * proxy). By default, simple codecs will usually return false, since they m ust be decoded
76 * on the CPU and then uploaded to become a texture.
77 */
78 bool canGenerateTexture(const GrContextThreadSafeProxy& proxy);
79 #endif
80
72 private: 81 private:
73 // Ref-counted tuple(SkImageGenerator, SkMutex) which allows sharing of one generator 82 // Ref-counted tuple(SkImageGenerator, SkMutex) which allows sharing of one generator
74 // among several cacherators. 83 // among several cacherators.
75 class SharedGenerator final : public SkNVRefCnt<SharedGenerator> { 84 class SharedGenerator final : public SkNVRefCnt<SharedGenerator> {
76 public: 85 public:
77 static sk_sp<SharedGenerator> Make(SkImageGenerator* gen) { 86 static sk_sp<SharedGenerator> Make(SkImageGenerator* gen) {
78 return gen ? sk_sp<SharedGenerator>(new SharedGenerator(gen)) : null ptr; 87 return gen ? sk_sp<SharedGenerator>(new SharedGenerator(gen)) : null ptr;
79 } 88 }
80 89
81 private: 90 private:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 const SkImageInfo fInfo; 124 const SkImageInfo fInfo;
116 const SkIPoint fOrigin; 125 const SkIPoint fOrigin;
117 const uint32_t fUniqueID; 126 const uint32_t fUniqueID;
118 127
119 friend class GrImageTextureMaker; 128 friend class GrImageTextureMaker;
120 friend class SkImage; 129 friend class SkImage;
121 friend class SkImage_Generator; 130 friend class SkImage_Generator;
122 }; 131 };
123 132
124 #endif 133 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/core/SkImageCacherator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698