OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkCoreBlitters.h" | 8 #include "SkCoreBlitters.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 static void blend_srcmode(SkPMColor* SK_RESTRICT device, | 268 static void blend_srcmode(SkPMColor* SK_RESTRICT device, |
269 const SkPMColor* SK_RESTRICT span, | 269 const SkPMColor* SK_RESTRICT span, |
270 int count, U8CPU aa) { | 270 int count, U8CPU aa) { |
271 int aa256 = SkAlpha255To256(aa); | 271 int aa256 = SkAlpha255To256(aa); |
272 for (int i = 0; i < count; ++i) { | 272 for (int i = 0; i < count; ++i) { |
273 device[i] = SkFourByteInterp256(span[i], device[i], aa256); | 273 device[i] = SkFourByteInterp256(span[i], device[i], aa256); |
274 } | 274 } |
275 } | 275 } |
276 | 276 |
277 SkARGB32_Shader_Blitter::SkARGB32_Shader_Blitter(const SkBitmap& device, | 277 SkARGB32_Shader_Blitter::SkARGB32_Shader_Blitter(const SkBitmap& device, |
278 const SkPaint& paint) : INHERITED(device, paint) { | 278 const SkPaint& paint, SkShader::Context* shaderContext) |
279 : INHERITED(device, paint, shaderContext) | |
280 { | |
279 fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * (sizeof(SkPMColor))); | 281 fBuffer = (SkPMColor*)sk_malloc_throw(device.width() * (sizeof(SkPMColor))); |
280 | 282 |
281 fXfermode = paint.getXfermode(); | 283 fXfermode = paint.getXfermode(); |
282 SkSafeRef(fXfermode); | 284 SkSafeRef(fXfermode); |
283 | 285 |
284 int flags = 0; | 286 int flags = 0; |
285 if (!(fShader->getFlags() & SkShader::kOpaqueAlpha_Flag)) { | 287 if (!(fShaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag)) { |
286 flags |= SkBlitRow::kSrcPixelAlpha_Flag32; | 288 flags |= SkBlitRow::kSrcPixelAlpha_Flag32; |
287 } | 289 } |
288 // we call this on the output from the shader | 290 // we call this on the output from the shader |
289 fProc32 = SkBlitRow::Factory32(flags); | 291 fProc32 = SkBlitRow::Factory32(flags); |
290 // we call this on the output from the shader + alpha from the aa buffer | 292 // we call this on the output from the shader + alpha from the aa buffer |
291 fProc32Blend = SkBlitRow::Factory32(flags | SkBlitRow::kGlobalAlpha_Flag32); | 293 fProc32Blend = SkBlitRow::Factory32(flags | SkBlitRow::kGlobalAlpha_Flag32); |
292 | 294 |
293 fShadeDirectlyIntoDevice = false; | 295 fShadeDirectlyIntoDevice = false; |
294 if (fXfermode == NULL) { | 296 if (fXfermode == NULL) { |
295 if (fShader->getFlags() & SkShader::kOpaqueAlpha_Flag) { | 297 if (fShaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) { |
296 fShadeDirectlyIntoDevice = true; | 298 fShadeDirectlyIntoDevice = true; |
297 } | 299 } |
298 } else { | 300 } else { |
299 SkXfermode::Mode mode; | 301 SkXfermode::Mode mode; |
300 if (fXfermode->asMode(&mode)) { | 302 if (fXfermode->asMode(&mode)) { |
301 if (SkXfermode::kSrc_Mode == mode) { | 303 if (SkXfermode::kSrc_Mode == mode) { |
302 fShadeDirectlyIntoDevice = true; | 304 fShadeDirectlyIntoDevice = true; |
303 fProc32Blend = blend_srcmode; | 305 fProc32Blend = blend_srcmode; |
304 } | 306 } |
305 } | 307 } |
306 } | 308 } |
307 | 309 |
308 fConstInY = SkToBool(fShader->getFlags() & SkShader::kConstInY32_Flag); | 310 fConstInY = SkToBool(fShaderContext->getFlags() & SkShader::kConstInY32_Flag ); |
309 } | 311 } |
310 | 312 |
311 SkARGB32_Shader_Blitter::~SkARGB32_Shader_Blitter() { | 313 SkARGB32_Shader_Blitter::~SkARGB32_Shader_Blitter() { |
312 SkSafeUnref(fXfermode); | 314 SkSafeUnref(fXfermode); |
313 sk_free(fBuffer); | 315 sk_free(fBuffer); |
314 } | 316 } |
315 | 317 |
316 void SkARGB32_Shader_Blitter::blitH(int x, int y, int width) { | 318 void SkARGB32_Shader_Blitter::blitH(int x, int y, int width) { |
317 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width()); | 319 SkASSERT(x >= 0 && y >= 0 && x + width <= fDevice.width()); |
318 | 320 |
319 uint32_t* device = fDevice.getAddr32(x, y); | 321 uint32_t* device = fDevice.getAddr32(x, y); |
320 | 322 |
321 if (fShadeDirectlyIntoDevice) { | 323 if (fShadeDirectlyIntoDevice) { |
322 fShader->shadeSpan(x, y, device, width); | 324 fShaderContext->shadeSpan(x, y, device, width); |
323 } else { | 325 } else { |
324 SkPMColor* span = fBuffer; | 326 SkPMColor* span = fBuffer; |
325 fShader->shadeSpan(x, y, span, width); | 327 fShaderContext->shadeSpan(x, y, span, width); |
326 if (fXfermode) { | 328 if (fXfermode) { |
327 fXfermode->xfer32(device, span, width, NULL); | 329 fXfermode->xfer32(device, span, width, NULL); |
328 } else { | 330 } else { |
329 fProc32(device, span, width, 255); | 331 fProc32(device, span, width, 255); |
330 } | 332 } |
331 } | 333 } |
332 } | 334 } |
333 | 335 |
334 void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) { | 336 void SkARGB32_Shader_Blitter::blitRect(int x, int y, int width, int height) { |
335 SkASSERT(x >= 0 && y >= 0 && | 337 SkASSERT(x >= 0 && y >= 0 && |
336 x + width <= fDevice.width() && y + height <= fDevice.height()); | 338 x + width <= fDevice.width() && y + height <= fDevice.height()); |
337 | 339 |
338 uint32_t* device = fDevice.getAddr32(x, y); | 340 uint32_t* device = fDevice.getAddr32(x, y); |
339 size_t deviceRB = fDevice.rowBytes(); | 341 size_t deviceRB = fDevice.rowBytes(); |
340 SkShader* shader = fShader; | |
scroggo
2014/03/24 21:24:46
Odd that the cached variable shader wasn't used. I
| |
341 SkPMColor* span = fBuffer; | 342 SkPMColor* span = fBuffer; |
342 | 343 |
343 if (fConstInY) { | 344 if (fConstInY) { |
344 if (fShadeDirectlyIntoDevice) { | 345 if (fShadeDirectlyIntoDevice) { |
345 // shade the first row directly into the device | 346 // shade the first row directly into the device |
346 fShader->shadeSpan(x, y, device, width); | 347 fShaderContext->shadeSpan(x, y, device, width); |
347 span = device; | 348 span = device; |
348 while (--height > 0) { | 349 while (--height > 0) { |
349 device = (uint32_t*)((char*)device + deviceRB); | 350 device = (uint32_t*)((char*)device + deviceRB); |
350 memcpy(device, span, width << 2); | 351 memcpy(device, span, width << 2); |
351 } | 352 } |
352 } else { | 353 } else { |
353 fShader->shadeSpan(x, y, span, width); | 354 fShaderContext->shadeSpan(x, y, span, width); |
354 SkXfermode* xfer = fXfermode; | 355 SkXfermode* xfer = fXfermode; |
355 if (xfer) { | 356 if (xfer) { |
356 do { | 357 do { |
357 xfer->xfer32(device, span, width, NULL); | 358 xfer->xfer32(device, span, width, NULL); |
358 y += 1; | 359 y += 1; |
359 device = (uint32_t*)((char*)device + deviceRB); | 360 device = (uint32_t*)((char*)device + deviceRB); |
360 } while (--height > 0); | 361 } while (--height > 0); |
361 } else { | 362 } else { |
362 SkBlitRow::Proc32 proc = fProc32; | 363 SkBlitRow::Proc32 proc = fProc32; |
363 do { | 364 do { |
364 proc(device, span, width, 255); | 365 proc(device, span, width, 255); |
365 y += 1; | 366 y += 1; |
366 device = (uint32_t*)((char*)device + deviceRB); | 367 device = (uint32_t*)((char*)device + deviceRB); |
367 } while (--height > 0); | 368 } while (--height > 0); |
368 } | 369 } |
369 } | 370 } |
370 return; | 371 return; |
371 } | 372 } |
372 | 373 |
373 if (fShadeDirectlyIntoDevice) { | 374 if (fShadeDirectlyIntoDevice) { |
374 void* ctx; | 375 void* ctx; |
375 SkShader::ShadeProc shadeProc = fShader->asAShadeProc(&ctx); | 376 SkShader::Context::ShadeProc shadeProc = fShaderContext->asAShadeProc(&c tx); |
376 if (shadeProc) { | 377 if (shadeProc) { |
377 do { | 378 do { |
378 shadeProc(ctx, x, y, device, width); | 379 shadeProc(ctx, x, y, device, width); |
379 y += 1; | 380 y += 1; |
380 device = (uint32_t*)((char*)device + deviceRB); | 381 device = (uint32_t*)((char*)device + deviceRB); |
381 } while (--height > 0); | 382 } while (--height > 0); |
382 } else { | 383 } else { |
383 do { | 384 do { |
384 shader->shadeSpan(x, y, device, width); | 385 fShaderContext->shadeSpan(x, y, device, width); |
385 y += 1; | 386 y += 1; |
386 device = (uint32_t*)((char*)device + deviceRB); | 387 device = (uint32_t*)((char*)device + deviceRB); |
387 } while (--height > 0); | 388 } while (--height > 0); |
388 } | 389 } |
389 } else { | 390 } else { |
390 SkXfermode* xfer = fXfermode; | 391 SkXfermode* xfer = fXfermode; |
391 if (xfer) { | 392 if (xfer) { |
392 do { | 393 do { |
393 shader->shadeSpan(x, y, span, width); | 394 fShaderContext->shadeSpan(x, y, span, width); |
394 xfer->xfer32(device, span, width, NULL); | 395 xfer->xfer32(device, span, width, NULL); |
395 y += 1; | 396 y += 1; |
396 device = (uint32_t*)((char*)device + deviceRB); | 397 device = (uint32_t*)((char*)device + deviceRB); |
397 } while (--height > 0); | 398 } while (--height > 0); |
398 } else { | 399 } else { |
399 SkBlitRow::Proc32 proc = fProc32; | 400 SkBlitRow::Proc32 proc = fProc32; |
400 do { | 401 do { |
401 shader->shadeSpan(x, y, span, width); | 402 fShaderContext->shadeSpan(x, y, span, width); |
402 proc(device, span, width, 255); | 403 proc(device, span, width, 255); |
403 y += 1; | 404 y += 1; |
404 device = (uint32_t*)((char*)device + deviceRB); | 405 device = (uint32_t*)((char*)device + deviceRB); |
405 } while (--height > 0); | 406 } while (--height > 0); |
406 } | 407 } |
407 } | 408 } |
408 } | 409 } |
409 | 410 |
410 void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], | 411 void SkARGB32_Shader_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[], |
411 const int16_t runs[]) { | 412 const int16_t runs[]) { |
412 SkPMColor* span = fBuffer; | 413 SkPMColor* span = fBuffer; |
413 uint32_t* device = fDevice.getAddr32(x, y); | 414 uint32_t* device = fDevice.getAddr32(x, y); |
414 SkShader* shader = fShader; | |
scroggo
2014/03/24 21:24:46
Same.
| |
415 | 415 |
416 if (fXfermode && !fShadeDirectlyIntoDevice) { | 416 if (fXfermode && !fShadeDirectlyIntoDevice) { |
417 for (;;) { | 417 for (;;) { |
418 SkXfermode* xfer = fXfermode; | 418 SkXfermode* xfer = fXfermode; |
419 | 419 |
420 int count = *runs; | 420 int count = *runs; |
421 if (count <= 0) | 421 if (count <= 0) |
422 break; | 422 break; |
423 int aa = *antialias; | 423 int aa = *antialias; |
424 if (aa) { | 424 if (aa) { |
425 shader->shadeSpan(x, y, span, count); | 425 fShaderContext->shadeSpan(x, y, span, count); |
426 if (aa == 255) { | 426 if (aa == 255) { |
427 xfer->xfer32(device, span, count, NULL); | 427 xfer->xfer32(device, span, count, NULL); |
428 } else { | 428 } else { |
429 // count is almost always 1 | 429 // count is almost always 1 |
430 for (int i = count - 1; i >= 0; --i) { | 430 for (int i = count - 1; i >= 0; --i) { |
431 xfer->xfer32(&device[i], &span[i], 1, antialias); | 431 xfer->xfer32(&device[i], &span[i], 1, antialias); |
432 } | 432 } |
433 } | 433 } |
434 } | 434 } |
435 device += count; | 435 device += count; |
436 runs += count; | 436 runs += count; |
437 antialias += count; | 437 antialias += count; |
438 x += count; | 438 x += count; |
439 } | 439 } |
440 } else if (fShadeDirectlyIntoDevice || | 440 } else if (fShadeDirectlyIntoDevice || |
441 (fShader->getFlags() & SkShader::kOpaqueAlpha_Flag)) { | 441 (fShaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag)) { |
442 for (;;) { | 442 for (;;) { |
443 int count = *runs; | 443 int count = *runs; |
444 if (count <= 0) { | 444 if (count <= 0) { |
445 break; | 445 break; |
446 } | 446 } |
447 int aa = *antialias; | 447 int aa = *antialias; |
448 if (aa) { | 448 if (aa) { |
449 if (aa == 255) { | 449 if (aa == 255) { |
450 // cool, have the shader draw right into the device | 450 // cool, have the shader draw right into the device |
451 shader->shadeSpan(x, y, device, count); | 451 fShaderContext->shadeSpan(x, y, device, count); |
452 } else { | 452 } else { |
453 shader->shadeSpan(x, y, span, count); | 453 fShaderContext->shadeSpan(x, y, span, count); |
454 fProc32Blend(device, span, count, aa); | 454 fProc32Blend(device, span, count, aa); |
455 } | 455 } |
456 } | 456 } |
457 device += count; | 457 device += count; |
458 runs += count; | 458 runs += count; |
459 antialias += count; | 459 antialias += count; |
460 x += count; | 460 x += count; |
461 } | 461 } |
462 } else { | 462 } else { |
463 for (;;) { | 463 for (;;) { |
464 int count = *runs; | 464 int count = *runs; |
465 if (count <= 0) { | 465 if (count <= 0) { |
466 break; | 466 break; |
467 } | 467 } |
468 int aa = *antialias; | 468 int aa = *antialias; |
469 if (aa) { | 469 if (aa) { |
470 fShader->shadeSpan(x, y, span, count); | 470 fShaderContext->shadeSpan(x, y, span, count); |
471 if (aa == 255) { | 471 if (aa == 255) { |
472 fProc32(device, span, count, 255); | 472 fProc32(device, span, count, 255); |
473 } else { | 473 } else { |
474 fProc32Blend(device, span, count, aa); | 474 fProc32Blend(device, span, count, aa); |
475 } | 475 } |
476 } | 476 } |
477 device += count; | 477 device += count; |
478 runs += count; | 478 runs += count; |
479 antialias += count; | 479 antialias += count; |
480 x += count; | 480 x += count; |
481 } | 481 } |
482 } | 482 } |
483 } | 483 } |
484 | 484 |
485 void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) { | 485 void SkARGB32_Shader_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) { |
486 // we only handle kA8 with an xfermode | 486 // we only handle kA8 with an xfermode |
487 if (fXfermode && (SkMask::kA8_Format != mask.fFormat)) { | 487 if (fXfermode && (SkMask::kA8_Format != mask.fFormat)) { |
488 this->INHERITED::blitMask(mask, clip); | 488 this->INHERITED::blitMask(mask, clip); |
489 return; | 489 return; |
490 } | 490 } |
491 | 491 |
492 SkASSERT(mask.fBounds.contains(clip)); | 492 SkASSERT(mask.fBounds.contains(clip)); |
493 | 493 |
494 SkBlitMask::RowProc proc = NULL; | 494 SkBlitMask::RowProc proc = NULL; |
495 if (!fXfermode) { | 495 if (!fXfermode) { |
496 unsigned flags = 0; | 496 unsigned flags = 0; |
497 if (fShader->getFlags() & SkShader::kOpaqueAlpha_Flag) { | 497 if (fShaderContext->getFlags() & SkShader::kOpaqueAlpha_Flag) { |
498 flags |= SkBlitMask::kSrcIsOpaque_RowFlag; | 498 flags |= SkBlitMask::kSrcIsOpaque_RowFlag; |
499 } | 499 } |
500 proc = SkBlitMask::RowFactory(SkBitmap::kARGB_8888_Config, mask.fFormat, | 500 proc = SkBlitMask::RowFactory(SkBitmap::kARGB_8888_Config, mask.fFormat, |
501 (SkBlitMask::RowFlags)flags); | 501 (SkBlitMask::RowFlags)flags); |
502 if (NULL == proc) { | 502 if (NULL == proc) { |
503 this->INHERITED::blitMask(mask, clip); | 503 this->INHERITED::blitMask(mask, clip); |
504 return; | 504 return; |
505 } | 505 } |
506 } | 506 } |
507 | 507 |
508 const int x = clip.fLeft; | 508 const int x = clip.fLeft; |
509 const int width = clip.width(); | 509 const int width = clip.width(); |
510 int y = clip.fTop; | 510 int y = clip.fTop; |
511 int height = clip.height(); | 511 int height = clip.height(); |
512 | 512 |
513 char* dstRow = (char*)fDevice.getAddr32(x, y); | 513 char* dstRow = (char*)fDevice.getAddr32(x, y); |
514 const size_t dstRB = fDevice.rowBytes(); | 514 const size_t dstRB = fDevice.rowBytes(); |
515 const uint8_t* maskRow = (const uint8_t*)mask.getAddr(x, y); | 515 const uint8_t* maskRow = (const uint8_t*)mask.getAddr(x, y); |
516 const size_t maskRB = mask.fRowBytes; | 516 const size_t maskRB = mask.fRowBytes; |
517 | 517 |
518 SkShader* shader = fShader; | |
scroggo
2014/03/24 21:24:46
Same
| |
519 SkPMColor* span = fBuffer; | 518 SkPMColor* span = fBuffer; |
520 | 519 |
521 if (fXfermode) { | 520 if (fXfermode) { |
522 SkASSERT(SkMask::kA8_Format == mask.fFormat); | 521 SkASSERT(SkMask::kA8_Format == mask.fFormat); |
523 SkXfermode* xfer = fXfermode; | 522 SkXfermode* xfer = fXfermode; |
524 do { | 523 do { |
525 shader->shadeSpan(x, y, span, width); | 524 fShaderContext->shadeSpan(x, y, span, width); |
526 xfer->xfer32((SkPMColor*)dstRow, span, width, maskRow); | 525 xfer->xfer32((SkPMColor*)dstRow, span, width, maskRow); |
527 dstRow += dstRB; | 526 dstRow += dstRB; |
528 maskRow += maskRB; | 527 maskRow += maskRB; |
529 y += 1; | 528 y += 1; |
530 } while (--height > 0); | 529 } while (--height > 0); |
531 } else { | 530 } else { |
532 do { | 531 do { |
533 shader->shadeSpan(x, y, span, width); | 532 fShaderContext->shadeSpan(x, y, span, width); |
534 proc(dstRow, maskRow, span, width); | 533 proc(dstRow, maskRow, span, width); |
535 dstRow += dstRB; | 534 dstRow += dstRB; |
536 maskRow += maskRB; | 535 maskRow += maskRB; |
537 y += 1; | 536 y += 1; |
538 } while (--height > 0); | 537 } while (--height > 0); |
539 } | 538 } |
540 } | 539 } |
541 | 540 |
542 void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { | 541 void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { |
543 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height()); | 542 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height()); |
544 | 543 |
545 uint32_t* device = fDevice.getAddr32(x, y); | 544 uint32_t* device = fDevice.getAddr32(x, y); |
546 size_t deviceRB = fDevice.rowBytes(); | 545 size_t deviceRB = fDevice.rowBytes(); |
547 SkShader* shader = fShader; | |
scroggo
2014/03/24 21:24:46
Same
| |
548 | 546 |
549 if (fConstInY) { | 547 if (fConstInY) { |
550 SkPMColor c; | 548 SkPMColor c; |
551 fShader->shadeSpan(x, y, &c, 1); | 549 fShaderContext->shadeSpan(x, y, &c, 1); |
552 | 550 |
553 if (fShadeDirectlyIntoDevice) { | 551 if (fShadeDirectlyIntoDevice) { |
554 if (255 == alpha) { | 552 if (255 == alpha) { |
555 do { | 553 do { |
556 *device = c; | 554 *device = c; |
557 device = (uint32_t*)((char*)device + deviceRB); | 555 device = (uint32_t*)((char*)device + deviceRB); |
558 } while (--height > 0); | 556 } while (--height > 0); |
559 } else { | 557 } else { |
560 do { | 558 do { |
561 *device = SkFourByteInterp(c, *device, alpha); | 559 *device = SkFourByteInterp(c, *device, alpha); |
(...skipping 13 matching lines...) Expand all Loading... | |
575 proc(device, &c, 1, alpha); | 573 proc(device, &c, 1, alpha); |
576 device = (uint32_t*)((char*)device + deviceRB); | 574 device = (uint32_t*)((char*)device + deviceRB); |
577 } while (--height > 0); | 575 } while (--height > 0); |
578 } | 576 } |
579 } | 577 } |
580 return; | 578 return; |
581 } | 579 } |
582 | 580 |
583 if (fShadeDirectlyIntoDevice) { | 581 if (fShadeDirectlyIntoDevice) { |
584 void* ctx; | 582 void* ctx; |
585 SkShader::ShadeProc shadeProc = fShader->asAShadeProc(&ctx); | 583 SkShader::Context::ShadeProc shadeProc = fShaderContext->asAShadeProc(&c tx); |
586 if (255 == alpha) { | 584 if (255 == alpha) { |
587 if (shadeProc) { | 585 if (shadeProc) { |
588 do { | 586 do { |
589 shadeProc(ctx, x, y, device, 1); | 587 shadeProc(ctx, x, y, device, 1); |
590 y += 1; | 588 y += 1; |
591 device = (uint32_t*)((char*)device + deviceRB); | 589 device = (uint32_t*)((char*)device + deviceRB); |
592 } while (--height > 0); | 590 } while (--height > 0); |
593 } else { | 591 } else { |
594 do { | 592 do { |
595 shader->shadeSpan(x, y, device, 1); | 593 fShaderContext->shadeSpan(x, y, device, 1); |
596 y += 1; | 594 y += 1; |
597 device = (uint32_t*)((char*)device + deviceRB); | 595 device = (uint32_t*)((char*)device + deviceRB); |
598 } while (--height > 0); | 596 } while (--height > 0); |
599 } | 597 } |
600 } else { // alpha < 255 | 598 } else { // alpha < 255 |
601 SkPMColor c; | 599 SkPMColor c; |
602 if (shadeProc) { | 600 if (shadeProc) { |
603 do { | 601 do { |
604 shadeProc(ctx, x, y, &c, 1); | 602 shadeProc(ctx, x, y, &c, 1); |
605 *device = SkFourByteInterp(c, *device, alpha); | 603 *device = SkFourByteInterp(c, *device, alpha); |
606 y += 1; | 604 y += 1; |
607 device = (uint32_t*)((char*)device + deviceRB); | 605 device = (uint32_t*)((char*)device + deviceRB); |
608 } while (--height > 0); | 606 } while (--height > 0); |
609 } else { | 607 } else { |
610 do { | 608 do { |
611 shader->shadeSpan(x, y, &c, 1); | 609 fShaderContext->shadeSpan(x, y, &c, 1); |
612 *device = SkFourByteInterp(c, *device, alpha); | 610 *device = SkFourByteInterp(c, *device, alpha); |
613 y += 1; | 611 y += 1; |
614 device = (uint32_t*)((char*)device + deviceRB); | 612 device = (uint32_t*)((char*)device + deviceRB); |
615 } while (--height > 0); | 613 } while (--height > 0); |
616 } | 614 } |
617 } | 615 } |
618 } else { | 616 } else { |
619 SkPMColor* span = fBuffer; | 617 SkPMColor* span = fBuffer; |
620 SkXfermode* xfer = fXfermode; | 618 SkXfermode* xfer = fXfermode; |
621 if (xfer) { | 619 if (xfer) { |
622 do { | 620 do { |
623 shader->shadeSpan(x, y, span, 1); | 621 fShaderContext->shadeSpan(x, y, span, 1); |
624 xfer->xfer32(device, span, 1, &alpha); | 622 xfer->xfer32(device, span, 1, &alpha); |
625 y += 1; | 623 y += 1; |
626 device = (uint32_t*)((char*)device + deviceRB); | 624 device = (uint32_t*)((char*)device + deviceRB); |
627 } while (--height > 0); | 625 } while (--height > 0); |
628 } else { | 626 } else { |
629 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; | 627 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; |
630 do { | 628 do { |
631 shader->shadeSpan(x, y, span, 1); | 629 fShaderContext->shadeSpan(x, y, span, 1); |
632 proc(device, span, 1, alpha); | 630 proc(device, span, 1, alpha); |
633 y += 1; | 631 y += 1; |
634 device = (uint32_t*)((char*)device + deviceRB); | 632 device = (uint32_t*)((char*)device + deviceRB); |
635 } while (--height > 0); | 633 } while (--height > 0); |
636 } | 634 } |
637 } | 635 } |
638 } | 636 } |
OLD | NEW |