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

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

Issue 1882893003: Add F16 source to the linear pipelin. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix think-o for Half name. Created 4 years, 8 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
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 typedef BitmapProcInfoContext INHERITED; 220 typedef BitmapProcInfoContext INHERITED;
221 }; 221 };
222 222
223 //////////////////////////////////////////////////////////////////////////////// /////////////////// 223 //////////////////////////////////////////////////////////////////////////////// ///////////////////
224 224
225 static bool choose_linear_pipeline(const SkShader::ContextRec& rec, const SkImag eInfo& srcInfo) { 225 static bool choose_linear_pipeline(const SkShader::ContextRec& rec, const SkImag eInfo& srcInfo) {
226 // These src attributes are not supported in the new 4f context (yet) 226 // These src attributes are not supported in the new 4f context (yet)
227 // 227 //
228 if (srcInfo.colorType() != kRGBA_8888_SkColorType 228 if (srcInfo.colorType() != kRGBA_8888_SkColorType
229 && srcInfo.colorType() != kBGRA_8888_SkColorType 229 && srcInfo.colorType() != kBGRA_8888_SkColorType
230 && srcInfo.colorType() != kIndex_8_SkColorType) { 230 && srcInfo.colorType() != kIndex_8_SkColorType
231 && srcInfo.colorType() != kRGBA_F16_SkColorType) {
231 return false; 232 return false;
232 } 233 }
233 234
234 #if 0 // later we may opt-in to the new code even if the client hasn't request ed it... 235 #if 0 // later we may opt-in to the new code even if the client hasn't request ed it...
235 // These src attributes are only supported in the new 4f context 236 // These src attributes are only supported in the new 4f context
236 // 237 //
237 if (srcInfo.isSRGB() || 238 if (srcInfo.isSRGB() ||
238 kUnpremul_SkAlphaType == srcInfo.alphaType() || 239 kUnpremul_SkAlphaType == srcInfo.alphaType() ||
239 (4 == srcInfo.bytesPerPixel() && kN32_SkColorType != srcInfo.colorType() )) 240 (4 == srcInfo.bytesPerPixel() && kN32_SkColorType != srcInfo.colorType() ))
240 { 241 {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 274
274 if (useLinearPipeline) { 275 if (useLinearPipeline) {
275 void* infoStorage = (char*)storage + sizeof(LinearPipelineContext); 276 void* infoStorage = (char*)storage + sizeof(LinearPipelineContext);
276 SkBitmapProcInfo* info = new (infoStorage) SkBitmapProcInfo(provider, tm x, tmy); 277 SkBitmapProcInfo* info = new (infoStorage) SkBitmapProcInfo(provider, tm x, tmy);
277 if (!info->init(totalInverse, *rec.fPaint)) { 278 if (!info->init(totalInverse, *rec.fPaint)) {
278 info->~SkBitmapProcInfo(); 279 info->~SkBitmapProcInfo();
279 return nullptr; 280 return nullptr;
280 } 281 }
281 if (info->fPixmap.colorType() != kRGBA_8888_SkColorType 282 if (info->fPixmap.colorType() != kRGBA_8888_SkColorType
282 && info->fPixmap.colorType() != kBGRA_8888_SkColorType 283 && info->fPixmap.colorType() != kBGRA_8888_SkColorType
283 && info->fPixmap.colorType() != kIndex_8_SkColorType) { 284 && info->fPixmap.colorType() != kIndex_8_SkColorType
285 && info->fPixmap.colorType() != kRGBA_F16_SkColorType) {
284 return nullptr; 286 return nullptr;
285 } 287 }
286 return new (storage) LinearPipelineContext(shader, rec, info); 288 return new (storage) LinearPipelineContext(shader, rec, info);
287 } else { 289 } else {
288 void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext); 290 void* stateStorage = (char*)storage + sizeof(BitmapProcShaderContext);
289 SkBitmapProcState* state = new (stateStorage) SkBitmapProcState(provider , tmx, tmy); 291 SkBitmapProcState* state = new (stateStorage) SkBitmapProcState(provider , tmx, tmy);
290 if (!state->setup(totalInverse, *rec.fPaint)) { 292 if (!state->setup(totalInverse, *rec.fPaint)) {
291 state->~SkBitmapProcState(); 293 state->~SkBitmapProcState();
292 return nullptr; 294 return nullptr;
293 } 295 }
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); 505 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params));
504 } 506 }
505 507
506 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 508 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
507 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); 509 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner);
508 } 510 }
509 return GrFragmentProcessor::MulOutputByInputAlpha(inner); 511 return GrFragmentProcessor::MulOutputByInputAlpha(inner);
510 } 512 }
511 513
512 #endif 514 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkLinearBitmapPipeline.cpp » ('j') | src/core/SkLinearBitmapPipeline_sample.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698