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

Side by Side Diff: src/gpu/SkGr.cpp

Issue 2088883002: Never use CPU-built mips for Gray_8. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | 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 2010 Google Inc. 2 * Copyright 2010 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 8
9 #include "SkGr.h" 9 #include "SkGr.h"
10 #include "SkGrPriv.h" 10 #include "SkGrPriv.h"
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (texture) { 342 if (texture) {
343 return texture; 343 return texture;
344 } 344 }
345 } 345 }
346 346
347 sk_sp<GrTexture> texture(create_texture_from_yuv(ctx, bitmap, desc)); 347 sk_sp<GrTexture> texture(create_texture_from_yuv(ctx, bitmap, desc));
348 if (texture) { 348 if (texture) {
349 return texture.release(); 349 return texture.release();
350 } 350 }
351 351
352 // We don't support Gray8 directly in the GL backend, so fail-over to GrUplo adBitmapToTexture.
353 // That will transform the Gray8 to 8888, then use the driver/GPU to build m ipmaps. If we build
354 // the mips on the CPU here, they'll all be Gray8, which isn't useful. (They get treated as A8).
355 // TODO: A better option might be to transform the initial bitmap here to 88 88, then run the
356 // CPU mip-mapper on that data before uploading. This is much less code for a rare case though:
357 if (kGray_8_SkColorType == bitmap.colorType()) {
bsalomon 2016/06/21 18:57:40 Chris, I think we'll a similar failure mode for th
358 return nullptr;
359 }
360
352 SkASSERT(sizeof(int) <= sizeof(uint32_t)); 361 SkASSERT(sizeof(int) <= sizeof(uint32_t));
353 if (bitmap.width() < 0 || bitmap.height() < 0) { 362 if (bitmap.width() < 0 || bitmap.height() < 0) {
354 return nullptr; 363 return nullptr;
355 } 364 }
356 365
357 SkAutoPixmapUnlock srcUnlocker; 366 SkAutoPixmapUnlock srcUnlocker;
358 if (!bitmap.requestLock(&srcUnlocker)) { 367 if (!bitmap.requestLock(&srcUnlocker)) {
359 return nullptr; 368 return nullptr;
360 } 369 }
361 const SkPixmap& pixmap = srcUnlocker.pixmap(); 370 const SkPixmap& pixmap = srcUnlocker.pixmap();
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
773 SkErrorInternals::SetError( kInvalidPaint_SkError, 782 SkErrorInternals::SetError( kInvalidPaint_SkError,
774 "Sorry, I don't understand the filtering " 783 "Sorry, I don't understand the filtering "
775 "mode you asked for. Falling back to " 784 "mode you asked for. Falling back to "
776 "MIPMaps."); 785 "MIPMaps.");
777 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 786 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
778 break; 787 break;
779 788
780 } 789 }
781 return textureFilterMode; 790 return textureFilterMode;
782 } 791 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698