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

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

Issue 1915263002: Add guards for edge cases. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use proper call for trunc. 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
« no previous file with comments | « no previous file | src/core/SkLinearBitmapPipeline.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 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 SkFilterQuality fFilterQuality; 218 SkFilterQuality fFilterQuality;
219 219
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.profileType() != kSRGB_SkColorProfileType) { return false; }
228 if (srcInfo.colorType() != kRGBA_8888_SkColorType 229 if (srcInfo.colorType() != kRGBA_8888_SkColorType
229 && srcInfo.colorType() != kBGRA_8888_SkColorType 230 && srcInfo.colorType() != kBGRA_8888_SkColorType
230 && srcInfo.colorType() != kIndex_8_SkColorType 231 && srcInfo.colorType() != kIndex_8_SkColorType
231 && srcInfo.colorType() != kRGBA_F16_SkColorType) { 232 && srcInfo.colorType() != kRGBA_F16_SkColorType) {
232 return false; 233 return false;
233 } 234 }
234 235
235 // If we get here, we can reasonably use either context, respect the caller' s preference 236 // If we get here, we can reasonably use either context, respect the caller' s preference
236 // 237 //
237 return SkShader::ContextRec::kPM4f_DstType == rec.fPreferredDstType; 238 return SkShader::ContextRec::kPM4f_DstType == rec.fPreferredDstType;
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); 490 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params));
490 } 491 }
491 492
492 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { 493 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) {
493 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); 494 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner);
494 } 495 }
495 return GrFragmentProcessor::MulOutputByInputAlpha(inner); 496 return GrFragmentProcessor::MulOutputByInputAlpha(inner);
496 } 497 }
497 498
498 #endif 499 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkLinearBitmapPipeline.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698