Fold together mippped and non-mippped bitmap to proxy functions
There are still several layers of redundancy and confusion, but this is
the first step to getting parallel/analogous functions to look and be
scoped similarly.
Bug: skia:
Change-Id: Ief5ecbd55335248a1fc04d66d0a95a8042b0fd28
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/202958
Auto-Submit: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/GrProxyProvider.cpp b/src/gpu/GrProxyProvider.cpp
index eee6a95..611d4bc 100644
--- a/src/gpu/GrProxyProvider.cpp
+++ b/src/gpu/GrProxyProvider.cpp
@@ -294,7 +294,8 @@
budgeted, GrInternalSurfaceFlags::kNone);
}
-sk_sp<GrTextureProxy> GrProxyProvider::createMipMapProxyFromBitmap(const SkBitmap& bitmap) {
+sk_sp<GrTextureProxy> GrProxyProvider::createProxyFromBitmap(const SkBitmap& bitmap,
+ GrMipMapped mipMapped) {
ASSERT_SINGLE_OWNER
if (this->isAbandoned()) {
@@ -305,7 +306,9 @@
return nullptr;
}
- ATRACE_ANDROID_FRAMEWORK("Upload MipMap Texture [%ux%u]", bitmap.width(), bitmap.height());
+ ATRACE_ANDROID_FRAMEWORK("Upload %sTexture [%ux%u]",
+ GrMipMapped::kYes == mipMapped ? "MipMap " : "",
+ bitmap.width(), bitmap.height());
// In non-ddl we will always instantiate right away. Thus we never want to copy the SkBitmap
// even if its mutable. In ddl, if the bitmap is mutable then we must make a copy since the
@@ -317,8 +320,9 @@
return nullptr;
}
- // This was never going to have mips anyway
- if (0 == SkMipMap::ComputeLevelCount(baseLevel->width(), baseLevel->height())) {
+ // If mips weren't requested (or this was too small to have any), then take the fast path
+ if (GrMipMapped::kNo == mipMapped ||
+ 0 == SkMipMap::ComputeLevelCount(baseLevel->width(), baseLevel->height())) {
return this->createTextureProxy(baseLevel, kNone_GrSurfaceFlags, 1, SkBudgeted::kYes,
SkBackingFit::kExact);
}