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

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

Issue 2058143002: Better (?) interface for controlling sRGB-ness of mipmaps on GrTexture (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Set gamma treatment flag appropriately, after uploading CPU mips 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 | « src/gpu/GrTexturePriv.h ('k') | src/gpu/gl/GrGLGpu.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 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"
11 11
12 #include "GrCaps.h" 12 #include "GrCaps.h"
13 #include "GrContext.h" 13 #include "GrContext.h"
14 #include "GrGpuResourcePriv.h" 14 #include "GrGpuResourcePriv.h"
15 #include "GrImageIDTextureAdjuster.h" 15 #include "GrImageIDTextureAdjuster.h"
16 #include "GrTextureParamsAdjuster.h" 16 #include "GrTextureParamsAdjuster.h"
17 #include "GrTexturePriv.h"
17 #include "GrTypes.h" 18 #include "GrTypes.h"
18 #include "GrXferProcessor.h" 19 #include "GrXferProcessor.h"
19 #include "GrYUVProvider.h" 20 #include "GrYUVProvider.h"
20 21
21 #include "SkColorFilter.h" 22 #include "SkColorFilter.h"
22 #include "SkConfig8888.h" 23 #include "SkConfig8888.h"
23 #include "SkCanvas.h" 24 #include "SkCanvas.h"
24 #include "SkData.h" 25 #include "SkData.h"
25 #include "SkErrorInternals.h" 26 #include "SkErrorInternals.h"
26 #include "SkGrPixelRef.h" 27 #include "SkGrPixelRef.h"
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 texels[0].fPixels = pixmap.addr(); 379 texels[0].fPixels = pixmap.addr();
379 texels[0].fRowBytes = pixmap.rowBytes(); 380 texels[0].fRowBytes = pixmap.rowBytes();
380 381
381 for (int i = 1; i < mipLevelCount; ++i) { 382 for (int i = 1; i < mipLevelCount; ++i) {
382 SkMipMap::Level generatedMipLevel; 383 SkMipMap::Level generatedMipLevel;
383 mipmaps->getLevel(i - 1, &generatedMipLevel); 384 mipmaps->getLevel(i - 1, &generatedMipLevel);
384 texels[i].fPixels = generatedMipLevel.fPixmap.addr(); 385 texels[i].fPixels = generatedMipLevel.fPixmap.addr();
385 texels[i].fRowBytes = generatedMipLevel.fPixmap.rowBytes(); 386 texels[i].fRowBytes = generatedMipLevel.fPixmap.rowBytes();
386 } 387 }
387 388
388 return ctx->textureProvider()->createMipMappedTexture(desc, SkBudgeted::kYes , texels.get(), 389 {
389 mipLevelCount); 390 GrTexture* texture = ctx->textureProvider()->createMipMappedTexture(desc ,
391 SkBu dgeted::kYes,
392 texe ls.get(),
393 mipL evelCount);
394 texture->texturePriv().setGammaTreatment(gammaTreatment);
395 return texture;
396 }
390 } 397 }
391 398
392 GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info, 399 GrTexture* GrUploadMipMapToTexture(GrContext* ctx, const SkImageInfo& info,
393 const GrMipLevel* texels, int mipLevelCount) { 400 const GrMipLevel* texels, int mipLevelCount) {
394 const GrCaps* caps = ctx->caps(); 401 const GrCaps* caps = ctx->caps();
395 return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDe sc(info, *caps), 402 return ctx->textureProvider()->createMipMappedTexture(GrImageInfoToSurfaceDe sc(info, *caps),
396 SkBudgeted::kYes, texe ls, 403 SkBudgeted::kYes, texe ls,
397 mipLevelCount); 404 mipLevelCount);
398 } 405 }
399 406
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after
761 SkErrorInternals::SetError( kInvalidPaint_SkError, 768 SkErrorInternals::SetError( kInvalidPaint_SkError,
762 "Sorry, I don't understand the filtering " 769 "Sorry, I don't understand the filtering "
763 "mode you asked for. Falling back to " 770 "mode you asked for. Falling back to "
764 "MIPMaps."); 771 "MIPMaps.");
765 textureFilterMode = GrTextureParams::kMipMap_FilterMode; 772 textureFilterMode = GrTextureParams::kMipMap_FilterMode;
766 break; 773 break;
767 774
768 } 775 }
769 return textureFilterMode; 776 return textureFilterMode;
770 } 777 }
OLDNEW
« no previous file with comments | « src/gpu/GrTexturePriv.h ('k') | src/gpu/gl/GrGLGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698