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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 if (texM) { | 268 if (texM) { |
269 texM->reset(); | 269 texM->reset(); |
270 } | 270 } |
271 if (xy) { | 271 if (xy) { |
272 xy[0] = (TileMode)fTileModeX; | 272 xy[0] = (TileMode)fTileModeX; |
273 xy[1] = (TileMode)fTileModeY; | 273 xy[1] = (TileMode)fTileModeY; |
274 } | 274 } |
275 return true; | 275 return true; |
276 } | 276 } |
277 | 277 |
278 SkFlattenable* SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) { | 278 sk_sp<SkFlattenable> SkBitmapProcShader::CreateProc(SkReadBuffer& buffer) { |
279 SkMatrix lm; | 279 SkMatrix lm; |
280 buffer.readMatrix(&lm); | 280 buffer.readMatrix(&lm); |
281 SkBitmap bm; | 281 SkBitmap bm; |
282 if (!buffer.readBitmap(&bm)) { | 282 if (!buffer.readBitmap(&bm)) { |
283 return nullptr; | 283 return nullptr; |
284 } | 284 } |
285 bm.setImmutable(); | 285 bm.setImmutable(); |
286 TileMode mx = (TileMode)buffer.readUInt(); | 286 TileMode mx = (TileMode)buffer.readUInt(); |
287 TileMode my = (TileMode)buffer.readUInt(); | 287 TileMode my = (TileMode)buffer.readUInt(); |
288 return SkShader::MakeBitmapShader(bm, mx, my, &lm).release(); | 288 return SkShader::MakeBitmapShader(bm, mx, my, &lm); |
289 } | 289 } |
290 | 290 |
291 void SkBitmapProcShader::flatten(SkWriteBuffer& buffer) const { | 291 void SkBitmapProcShader::flatten(SkWriteBuffer& buffer) const { |
292 buffer.writeMatrix(this->getLocalMatrix()); | 292 buffer.writeMatrix(this->getLocalMatrix()); |
293 buffer.writeBitmap(fRawBitmap); | 293 buffer.writeBitmap(fRawBitmap); |
294 buffer.writeUInt(fTileModeX); | 294 buffer.writeUInt(fTileModeX); |
295 buffer.writeUInt(fTileModeY); | 295 buffer.writeUInt(fTileModeY); |
296 } | 296 } |
297 | 297 |
298 bool SkBitmapProcShader::isOpaque() const { | 298 bool SkBitmapProcShader::isOpaque() const { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); | 454 inner.reset(GrSimpleTextureEffect::Create(texture, matrix, params)); |
455 } | 455 } |
456 | 456 |
457 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { | 457 if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
458 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); | 458 return GrFragmentProcessor::MulOutputByInputUnpremulColor(inner); |
459 } | 459 } |
460 return GrFragmentProcessor::MulOutputByInputAlpha(inner); | 460 return GrFragmentProcessor::MulOutputByInputAlpha(inner); |
461 } | 461 } |
462 | 462 |
463 #endif | 463 #endif |
OLD | NEW |