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

Side by Side Diff: src/core/SkBitmapProcShader.cpp

Issue 2029373004: respect srgb gamma when building mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning 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/core/SkBitmapController.cpp ('k') | src/core/SkBitmapProcState.h » ('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 2011 Google Inc. 2 * Copyright 2011 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 #include "SkBitmapProcShader.h" 8 #include "SkBitmapProcShader.h"
9 #include "SkBitmapProcState.h" 9 #include "SkBitmapProcState.h"
10 #include "SkBitmapProvider.h" 10 #include "SkBitmapProvider.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 const SkBitmapProvider& provi der, 222 const SkBitmapProvider& provi der,
223 const ContextRec& rec, void* storage) { 223 const ContextRec& rec, void* storage) {
224 SkMatrix totalInverse; 224 SkMatrix totalInverse;
225 // Do this first, so we know the matrix can be inverted. 225 // Do this first, so we know the matrix can be inverted.
226 if (!shader.computeTotalInverse(rec, &totalInverse)) { 226 if (!shader.computeTotalInverse(rec, &totalInverse)) {
227 return nullptr; 227 return nullptr;
228 } 228 }
229 229
230 // Decide if we can/want to use the new linear pipeline 230 // Decide if we can/want to use the new linear pipeline
231 bool useLinearPipeline = choose_linear_pipeline(rec, provider.info()); 231 bool useLinearPipeline = choose_linear_pipeline(rec, provider.info());
232 SkSourceGammaTreatment treatment = SkMipMap::DeduceTreatment(rec);
232 233
233 if (useLinearPipeline) { 234 if (useLinearPipeline) {
234 void* infoStorage = (char*)storage + sizeof(LinearPipelineContext); 235 void* infoStorage = (char*)storage + sizeof(LinearPipelineContext);
235 SkBitmapProcInfo* info = new (infoStorage) SkBitmapProcInfo(provider, tm x, tmy); 236 SkBitmapProcInfo* info = new (infoStorage) SkBitmapProcInfo(provider, tm x, tmy, treatment);
236 if (!info->init(totalInverse, *rec.fPaint)) { 237 if (!info->init(totalInverse, *rec.fPaint)) {
237 info->~SkBitmapProcInfo(); 238 info->~SkBitmapProcInfo();
238 return nullptr; 239 return nullptr;
239 } 240 }
240 241
241 return new (storage) LinearPipelineContext(shader, rec, info); 242 return new (storage) LinearPipelineContext(shader, rec, info);
242 } else { 243 } else {
243 void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext); 244 void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
244 SkBitmapProcState* state = new (stateStorage) SkBitmapProcState(provider , tmx, tmy); 245 SkBitmapProcState* state = new (stateStorage) SkBitmapProcState(provider , tmx, tmy,
246 treatmen t);
245 if (!state->setup(totalInverse, *rec.fPaint)) { 247 if (!state->setup(totalInverse, *rec.fPaint)) {
246 state->~SkBitmapProcState(); 248 state->~SkBitmapProcState();
247 return nullptr; 249 return nullptr;
248 } 250 }
249 return new (storage) BitmapProcShaderContext(shader, rec, state); 251 return new (storage) BitmapProcShaderContext(shader, rec, state);
250 } 252 }
251 } 253 }
252 254
253 SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo id* storage) const { 255 SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo id* storage) const {
254 return MakeContext(*this, (TileMode)fTileModeX, (TileMode)fTileModeY, 256 return MakeContext(*this, (TileMode)fTileModeX, (TileMode)fTileModeY,
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 inner = GrSimpleTextureEffect::Make(texture, matrix, params); 462 inner = GrSimpleTextureEffect::Make(texture, matrix, params);
461 } 463 }
462 464
463 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 465 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
464 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r)); 466 return GrFragmentProcessor::MulOutputByInputUnpremulColor(std::move(inne r));
465 } 467 }
466 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner)); 468 return GrFragmentProcessor::MulOutputByInputAlpha(std::move(inner));
467 } 469 }
468 470
469 #endif 471 #endif
OLDNEW
« no previous file with comments | « src/core/SkBitmapController.cpp ('k') | src/core/SkBitmapProcState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698