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

Unified Diff: src/core/SkImageCacherator.cpp

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Fixing rebase errors and cleaning up. Created 4 years, 10 months 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 side-by-side diff with in-line comments
Download patch
Index: src/core/SkImageCacherator.cpp
diff --git a/src/core/SkImageCacherator.cpp b/src/core/SkImageCacherator.cpp
index dc831d7cbf6522b04a64740dc5a30a7699c798dd..5c28a368d44cfb3e06eabfca8688f8651e5b3292 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);

Powered by Google App Engine
This is Rietveld 408576698