aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkImageCacherator.cpp10
-rw-r--r--src/core/SkImageCacherator.h2
-rw-r--r--src/core/SkMipMap.cpp2
3 files changed, 10 insertions, 4 deletions
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index 155eb82242..594a8e26ce 100644
--- a/src/core/SkImageCacherator.cpp
+++ b/src/core/SkImageCacherator.cpp
@@ -239,7 +239,8 @@ static GrTexture* set_key_and_return(GrTexture* tex, const GrUniqueKey& key) {
* 5. Ask the generator to return RGB(A) data, which the GPU can convert
*/
GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key,
- const SkImage* client, SkImage::CachingHint chint) {
+ const SkImage* client, SkImage::CachingHint chint,
+ bool willBeMipped) {
// Values representing the various texture lock paths we can take. Used for logging the path
// taken to a histogram.
enum LockTexturePath {
@@ -301,7 +302,12 @@ GrTexture* SkImageCacherator::lockTexture(GrContext* ctx, const GrUniqueKey& key
// 5. Ask the generator to return RGB(A) data, which the GPU can convert
SkBitmap bitmap;
if (this->tryLockAsBitmap(&bitmap, client, chint)) {
- GrTexture* tex = GrUploadBitmapToTexture(ctx, bitmap);
+ GrTexture* tex = nullptr;
+ if (willBeMipped) {
+ tex = GrGenerateMipMapsAndUploadToTexture(ctx, bitmap);
+ } else {
+ tex = GrUploadBitmapToTexture(ctx, bitmap);
+ }
if (tex) {
SK_HISTOGRAM_ENUMERATION("LockTexturePath", kRGBA_LockTexturePath,
kLockTexturePathCount);
diff --git a/src/core/SkImageCacherator.h b/src/core/SkImageCacherator.h
index 6b000668dd..7e146182c7 100644
--- a/src/core/SkImageCacherator.h
+++ b/src/core/SkImageCacherator.h
@@ -75,7 +75,7 @@ private:
// Returns the texture. If the cacherator is generating the texture and wants to cache it,
// it should use the passed in key (if the key is valid).
GrTexture* lockTexture(GrContext*, const GrUniqueKey& key, const SkImage* client,
- SkImage::CachingHint);
+ SkImage::CachingHint, bool willBeMipped);
#endif
class ScopedGenerator {
diff --git a/src/core/SkMipMap.cpp b/src/core/SkMipMap.cpp
index eae5e618f6..1b630a0466 100644
--- a/src/core/SkMipMap.cpp
+++ b/src/core/SkMipMap.cpp
@@ -233,7 +233,7 @@ SkMipMap* SkMipMap::Build(const SkPixmap& src, SkDiscardableFactoryProc fact) {
// whip through our loop to compute the exact size needed
size_t size = 0;
- int countLevels = 0;
+ int countLevels = 0;
{
int width = src.width();
int height = src.height();