OLD | NEW |
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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 SkBitmapProcState* fState; | 113 SkBitmapProcState* fState; |
114 | 114 |
115 typedef BitmapProcInfoContext INHERITED; | 115 typedef BitmapProcInfoContext INHERITED; |
116 }; | 116 }; |
117 | 117 |
118 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 118 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
119 | 119 |
120 size_t SkBitmapProcShader::ContextSize(const ContextRec& rec) { | 120 size_t SkBitmapProcShader::ContextSize(const ContextRec& rec) { |
121 // The SkBitmapProcState is stored outside of the context object, with the c
ontext holding | 121 // The SkBitmapProcState is stored outside of the context object, with the c
ontext holding |
122 // a pointer to it. | 122 // a pointer to it. |
123 return sizeof(BitmapProcShaderContext) + sizeof(SkBitmapProcState); | 123 return SkAlign16(sizeof(BitmapProcShaderContext) + sizeof(SkBitmapProcState)
); |
124 } | 124 } |
125 | 125 |
126 SkShader::Context* SkBitmapProcShader::MakeContext(const SkShader& shader, | 126 SkShader::Context* SkBitmapProcShader::MakeContext(const SkShader& shader, |
127 TileMode tmx, TileMode tmy, | 127 TileMode tmx, TileMode tmy, |
128 const SkBitmapProvider& provi
der, | 128 const SkBitmapProvider& provi
der, |
129 const ContextRec& rec, void*
storage) { | 129 const ContextRec& rec, void*
storage) { |
130 SkMatrix totalInverse; | 130 SkMatrix totalInverse; |
131 // Do this first, so we know the matrix can be inverted. | 131 // Do this first, so we know the matrix can be inverted. |
132 if (!shader.computeTotalInverse(rec, &totalInverse)) { | 132 if (!shader.computeTotalInverse(rec, &totalInverse)) { |
133 return nullptr; | 133 return nullptr; |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
353 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); | 353 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); |
354 } | 354 } |
355 | 355 |
356 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 356 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
357 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); | 357 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); |
358 } | 358 } |
359 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 359 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
360 } | 360 } |
361 | 361 |
362 #endif | 362 #endif |
OLD | NEW |