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

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

Issue 1530743002: Fix UB function problems for shaders and mask. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 16-bit masks Created 5 years 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 | « src/core/SkBlitMask_D32.cpp ('k') | no next file » | 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 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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 const uint8_t* maskRow = (const uint8_t*)mask.getAddr(x, y); 563 const uint8_t* maskRow = (const uint8_t*)mask.getAddr(x, y);
564 const size_t maskRB = mask.fRowBytes; 564 const size_t maskRB = mask.fRowBytes;
565 565
566 SkPMColor* span = fBuffer; 566 SkPMColor* span = fBuffer;
567 567
568 if (fXfermode) { 568 if (fXfermode) {
569 SkASSERT(SkMask::kA8_Format == mask.fFormat); 569 SkASSERT(SkMask::kA8_Format == mask.fFormat);
570 SkXfermode* xfer = fXfermode; 570 SkXfermode* xfer = fXfermode;
571 do { 571 do {
572 shaderContext->shadeSpan(x, y, span, width); 572 shaderContext->shadeSpan(x, y, span, width);
573 xfer->xfer32((SkPMColor*)dstRow, span, width, maskRow); 573 xfer->xfer32(reinterpret_cast<SkPMColor*>(dstRow), span, width, mask Row);
574 dstRow += dstRB; 574 dstRow += dstRB;
575 maskRow += maskRB; 575 maskRow += maskRB;
576 y += 1; 576 y += 1;
577 } while (--height > 0); 577 } while (--height > 0);
578 } else { 578 } else {
579 do { 579 do {
580 shaderContext->shadeSpan(x, y, span, width); 580 shaderContext->shadeSpan(x, y, span, width);
581 proc(dstRow, maskRow, span, width); 581 proc(reinterpret_cast<SkPMColor*>(dstRow), maskRow, span, width);
582 dstRow += dstRB; 582 dstRow += dstRB;
583 maskRow += maskRB; 583 maskRow += maskRB;
584 y += 1; 584 y += 1;
585 } while (--height > 0); 585 } while (--height > 0);
586 } 586 }
587 } 587 }
588 588
589 void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) { 589 void SkARGB32_Shader_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
590 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height()); 590 SkASSERT(x >= 0 && y >= 0 && y + height <= fDevice.height());
591 591
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
676 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend; 676 SkBlitRow::Proc32 proc = (255 == alpha) ? fProc32 : fProc32Blend;
677 do { 677 do {
678 shaderContext->shadeSpan(x, y, span, 1); 678 shaderContext->shadeSpan(x, y, span, 1);
679 proc(device, span, 1, alpha); 679 proc(device, span, 1, alpha);
680 y += 1; 680 y += 1;
681 device = (uint32_t*)((char*)device + deviceRB); 681 device = (uint32_t*)((char*)device + deviceRB);
682 } while (--height > 0); 682 } while (--height > 0);
683 } 683 }
684 } 684 }
685 } 685 }
OLDNEW
« no previous file with comments | « src/core/SkBlitMask_D32.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698