本文整理汇总了C++中SkMask::getAddr8方法的典型用法代码示例。如果您正苦于以下问题:C++ SkMask::getAddr8方法的具体用法?C++ SkMask::getAddr8怎么用?C++ SkMask::getAddr8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkMask
的用法示例。
在下文中一共展示了SkMask::getAddr8方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
void SkRGB16_Black_Blitter::blitMask(const SkMask& mask,
const SkIRect& clip) {
if (mask.fFormat == SkMask::kBW_Format) {
SkRGB16_Black_BlitBW(fDevice, mask, clip);
} else {
uint16_t* SK_RESTRICT device = fDevice.getAddr16(clip.fLeft, clip.fTop);
const uint8_t* SK_RESTRICT alpha = mask.getAddr8(clip.fLeft, clip.fTop);
unsigned width = clip.width();
unsigned height = clip.height();
size_t deviceRB = fDevice.rowBytes() - (width << 1);
unsigned maskRB = mask.fRowBytes - width;
SkASSERT((int)height > 0);
SkASSERT((int)width > 0);
SkASSERT((int)deviceRB >= 0);
SkASSERT((int)maskRB >= 0);
do {
unsigned w = width;
do {
unsigned aa = *alpha++;
*device = SkAlphaMulRGB16(*device, SkAlpha255To256(255 - aa));
device += 1;
} while (--w != 0);
device = (uint16_t*)((char*)device + deviceRB);
alpha += maskRB;
} while (--height != 0);
}
}
示例2: blitMask
void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
if (mask.fFormat == SkMask::kBW_Format) {
// TODO: native BW masks?
return INHERITED::blitMask(mask, clip);
}
int x = clip.left();
for (int y = clip.top(); y < clip.bottom(); y++) {
auto dst = fDst.writable_addr(0,y);
SkRasterPipeline p;
p.extend(fShader);
p.extend(fColorFilter);
this->append_load_d(&p, dst);
p.extend(fXfermode);
switch (mask.fFormat) {
case SkMask::kA8_Format:
p.append<lerp_a8, lerp_a8_1>(mask.getAddr8(x,y)-x);
break;
case SkMask::kLCD16_Format:
p.append<lerp_lcd16, lerp_lcd16_1>(mask.getAddrLCD16(x,y)-x);
break;
default: break;
}
this->append_store(&p, dst);
p.run(x, clip.width());
}
}
示例3: dump
static void dump(const SkMask& mask) {
for (int y = mask.fBounds.top(); y < mask.fBounds.bottom(); ++y) {
for (int x = mask.fBounds.left(); x < mask.fBounds.right(); ++x) {
SkDebugf("%02X", *mask.getAddr8(x, y));
}
SkDebugf("\n");
}
SkDebugf("\n");
}
示例4: blitMask
void SkRasterPipelineBlitter::blitMask(const SkMask& mask, const SkIRect& clip) {
if (mask.fFormat == SkMask::kBW_Format) {
// TODO: native BW masks?
return INHERITED::blitMask(mask, clip);
}
if (mask.fFormat == SkMask::kA8_Format && !fBlitMaskA8) {
SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
if (fBlend == SkBlendMode::kSrcOver) {
p.append(SkRasterPipeline::scale_u8, &fMaskPtr);
this->append_load_d(&p);
this->append_blend(&p);
} else {
this->append_load_d(&p);
this->append_blend(&p);
p.append(SkRasterPipeline::lerp_u8, &fMaskPtr);
}
this->maybe_clamp(&p);
this->append_store(&p);
fBlitMaskA8 = p.compile();
}
if (mask.fFormat == SkMask::kLCD16_Format && !fBlitMaskLCD16) {
SkRasterPipeline p(fAlloc);
p.extend(fColorPipeline);
this->append_load_d(&p);
this->append_blend(&p);
p.append(SkRasterPipeline::lerp_565, &fMaskPtr);
this->maybe_clamp(&p);
this->append_store(&p);
fBlitMaskLCD16 = p.compile();
}
int x = clip.left();
for (int y = clip.top(); y < clip.bottom(); y++) {
fDstPtr = fDst.writable_addr(0,y);
this->maybe_shade(x,y,clip.width());
switch (mask.fFormat) {
case SkMask::kA8_Format:
fMaskPtr = mask.getAddr8(x,y)-x;
fBlitMaskA8(x,y,clip.width());
break;
case SkMask::kLCD16_Format:
fMaskPtr = mask.getAddrLCD16(x,y)-x;
fBlitMaskLCD16(x,y,clip.width());
break;
default:
// TODO
break;
}
}
}
示例5: proc
static void SkARGB32_Blit32(const SkPixmap& device, const SkMask& mask,
const SkIRect& clip, SkPMColor srcColor) {
U8CPU alpha = SkGetPackedA32(srcColor);
unsigned flags = SkBlitRow::kSrcPixelAlpha_Flag32;
if (alpha != 255) {
flags |= SkBlitRow::kGlobalAlpha_Flag32;
}
SkBlitRow::Proc32 proc = SkBlitRow::Factory32(flags);
int x = clip.fLeft;
int y = clip.fTop;
int width = clip.width();
int height = clip.height();
SkPMColor* dstRow = device.writable_addr32(x, y);
const SkPMColor* srcRow = reinterpret_cast<const SkPMColor*>(mask.getAddr8(x, y));
do {
proc(dstRow, srcRow, width, alpha);
dstRow = (SkPMColor*)((char*)dstRow + device.rowBytes());
srcRow = (const SkPMColor*)((const char*)srcRow + mask.fRowBytes);
} while (--height != 0);
}
示例6: draw_nine_clipped
static void draw_nine_clipped(const SkMask& mask, const SkIRect& outerR,
const SkIPoint& center, bool fillCenter,
const SkIRect& clipR, SkBlitter* blitter) {
int cx = center.x();
int cy = center.y();
SkMask m;
// top-left
m.fBounds = mask.fBounds;
m.fBounds.fRight = cx;
m.fBounds.fBottom = cy;
if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
extractMaskSubset(mask, &m);
m.fBounds.offsetTo(outerR.left(), outerR.top());
blitClippedMask(blitter, m, m.fBounds, clipR);
}
// top-right
m.fBounds = mask.fBounds;
m.fBounds.fLeft = cx + 1;
m.fBounds.fBottom = cy;
if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
extractMaskSubset(mask, &m);
m.fBounds.offsetTo(outerR.right() - m.fBounds.width(), outerR.top());
blitClippedMask(blitter, m, m.fBounds, clipR);
}
// bottom-left
m.fBounds = mask.fBounds;
m.fBounds.fRight = cx;
m.fBounds.fTop = cy + 1;
if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
extractMaskSubset(mask, &m);
m.fBounds.offsetTo(outerR.left(), outerR.bottom() - m.fBounds.height());
blitClippedMask(blitter, m, m.fBounds, clipR);
}
// bottom-right
m.fBounds = mask.fBounds;
m.fBounds.fLeft = cx + 1;
m.fBounds.fTop = cy + 1;
if (m.fBounds.width() > 0 && m.fBounds.height() > 0) {
extractMaskSubset(mask, &m);
m.fBounds.offsetTo(outerR.right() - m.fBounds.width(),
outerR.bottom() - m.fBounds.height());
blitClippedMask(blitter, m, m.fBounds, clipR);
}
SkIRect innerR;
innerR.set(outerR.left() + cx - mask.fBounds.left(),
outerR.top() + cy - mask.fBounds.top(),
outerR.right() + (cx + 1 - mask.fBounds.right()),
outerR.bottom() + (cy + 1 - mask.fBounds.bottom()));
if (fillCenter) {
blitClippedRect(blitter, innerR, clipR);
}
const int innerW = innerR.width();
size_t storageSize = (innerW + 1) * (sizeof(int16_t) + sizeof(uint8_t));
SkAutoSMalloc<4*1024> storage(storageSize);
int16_t* runs = (int16_t*)storage.get();
uint8_t* alpha = (uint8_t*)(runs + innerW + 1);
SkIRect r;
// top
r.set(innerR.left(), outerR.top(), innerR.right(), innerR.top());
if (r.intersect(clipR)) {
int startY = SkMax32(0, r.top() - outerR.top());
int stopY = startY + r.height();
int width = r.width();
for (int y = startY; y < stopY; ++y) {
runs[0] = width;
runs[width] = 0;
alpha[0] = *mask.getAddr8(cx, mask.fBounds.top() + y);
blitter->blitAntiH(r.left(), outerR.top() + y, alpha, runs);
}
}
// bottom
r.set(innerR.left(), innerR.bottom(), innerR.right(), outerR.bottom());
if (r.intersect(clipR)) {
int startY = outerR.bottom() - r.bottom();
int stopY = startY + r.height();
int width = r.width();
for (int y = startY; y < stopY; ++y) {
runs[0] = width;
runs[width] = 0;
alpha[0] = *mask.getAddr8(cx, mask.fBounds.bottom() - y - 1);
blitter->blitAntiH(r.left(), outerR.bottom() - y - 1, alpha, runs);
}
}
// left
r.set(outerR.left(), innerR.top(), innerR.left(), innerR.bottom());
if (r.intersect(clipR)) {
int startX = r.left() - outerR.left();
int stopX = startX + r.width();
int height = r.height();
for (int x = startX; x < stopX; ++x) {
blitter->blitV(outerR.left() + x, r.top(), height,
*mask.getAddr8(mask.fBounds.left() + x, mask.fBounds.top() + cy));
}
//.........这里部分代码省略.........