本文整理汇总了C++中SkPixmap::writable_addr32方法的典型用法代码示例。如果您正苦于以下问题:C++ SkPixmap::writable_addr32方法的具体用法?C++ SkPixmap::writable_addr32怎么用?C++ SkPixmap::writable_addr32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkPixmap
的用法示例。
在下文中一共展示了SkPixmap::writable_addr32方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
SkLinearBitmapPipeline::SkLinearBitmapPipeline(
const SkLinearBitmapPipeline& pipeline,
const SkPixmap& srcPixmap,
SkXfermode::Mode mode,
const SkImageInfo& dstInfo)
{
SkASSERT(mode == SkXfermode::kSrc_Mode || mode == SkXfermode::kSrcOver_Mode);
SkASSERT(srcPixmap.info().colorType() == dstInfo.colorType()
&& srcPixmap.info().colorType() == kRGBA_8888_SkColorType);
if (mode == SkXfermode::kSrc_Mode) {
fSampleStage.initSink<RGBA8888UnitRepeatSrc>(
srcPixmap.writable_addr32(0, 0), srcPixmap.rowBytes() / 4);
fLastStage = fSampleStage.getInterface<DestinationInterface, RGBA8888UnitRepeatSrc>();
} else {
fSampleStage.initSink<RGBA8888UnitRepeatSrcOver>(
srcPixmap.writable_addr32(0, 0), srcPixmap.rowBytes() / 4);
fLastStage = fSampleStage.getInterface<DestinationInterface, RGBA8888UnitRepeatSrcOver>();
}
auto sampleStage = fSampleStage.get();
auto tilerStage = pipeline.fTileStage.cloneStageTo(sampleStage, &fTileStage);
tilerStage = (tilerStage != nullptr) ? tilerStage : sampleStage;
auto matrixStage = pipeline.fMatrixStage.cloneStageTo(tilerStage, &fMatrixStage);
matrixStage = (matrixStage != nullptr) ? matrixStage : tilerStage;
fFirstStage = matrixStage;
}
示例2:
void SkLinearGradient::
LinearGradient4fContext::D32_BlitBW(BlitState* state, int x, int y, const SkPixmap& dst,
int count) {
// FIXME: ignoring coverage for now
const LinearGradient4fContext* ctx =
static_cast<const LinearGradient4fContext*>(state->fCtx);
if (!dst.info().gammaCloseToSRGB()) {
if (ctx->fColorsArePremul) {
ctx->shadePremulSpan<DstType::L32, ApplyPremul::False>(
x, y, dst.writable_addr32(x, y), count);
} else {
ctx->shadePremulSpan<DstType::L32, ApplyPremul::True>(
x, y, dst.writable_addr32(x, y), count);
}
} else {
if (ctx->fColorsArePremul) {
ctx->shadePremulSpan<DstType::S32, ApplyPremul::False>(
x, y, dst.writable_addr32(x, y), count);
} else {
ctx->shadePremulSpan<DstType::S32, ApplyPremul::True>(
x, y, dst.writable_addr32(x, y), count);
}
}
}
示例3:
void SkLinearGradient::
LinearGradient4fContext::D32_BlitBW(BlitState* state, int x, int y, const SkPixmap& dst,
int count) {
// FIXME: ignoring coverage for now
const LinearGradient4fContext* ctx =
static_cast<const LinearGradient4fContext*>(state->fCtx);
if (dst.info().isLinear()) {
if (ctx->fColorsArePremul) {
ctx->shadePremulSpan<SkPMColor, kLinear_SkColorProfileType, ApplyPremul::False>(
x, y, dst.writable_addr32(x, y), count);
} else {
ctx->shadePremulSpan<SkPMColor, kLinear_SkColorProfileType, ApplyPremul::True>(
x, y, dst.writable_addr32(x, y), count);
}
} else {
if (ctx->fColorsArePremul) {
ctx->shadePremulSpan<SkPMColor, kSRGB_SkColorProfileType, ApplyPremul::False>(
x, y, dst.writable_addr32(x, y), count);
} else {
ctx->shadePremulSpan<SkPMColor, kSRGB_SkColorProfileType, ApplyPremul::True>(
x, y, dst.writable_addr32(x, y), count);
}
}
}
示例4: draw_rect
static void draw_rect(SkCanvas* canvas, const SkRect& r, SkColor c, SkColorProfileType profile,
const SkAlpha aa[]) {
const SkIRect ir = r.round();
SkBitmap bm;
bm.allocN32Pixels(ir.width(), ir.height());
bm.eraseColor(0xFFFFFFFF);
SkPixmap pm;
bm.peekPixels(&pm);
uint32_t flags = 0;
if (SkColorGetA(c) == 0xFF) {
flags |= SkXfermode::kSrcIsOpaque_PM4fFlag;
}
if (kSRGB_SkColorProfileType == profile) {
flags |= SkXfermode::kDstIsSRGB_PM4fFlag;
}
const SkXfermode::PM4fState state { nullptr, flags };
const SkPM4f src = SkColor4f::FromColor(c).premul();
auto proc1 = SkXfermode::GetPM4fProc1(SkXfermode::kSrcOver_Mode, flags);
for (int y = 0; y < ir.height()/2; ++y) {
proc1(state, pm.writable_addr32(0, y), src, ir.width(), aa);
}
SkPM4f srcRow[1000];
for (int i = 0; i < ir.width(); ++i) {
srcRow[i] = src;
}
auto procN = SkXfermode::GetPM4fProcN(SkXfermode::kSrcOver_Mode, flags);
// +1 to skip a row, so we can see the boundary between proc1 and procN
for (int y = ir.height()/2 + 1; y < ir.height(); ++y) {
procN(state, pm.writable_addr32(0, y), srcRow, ir.width(), aa);
}
canvas->drawBitmap(bm, r.left(), r.top(), nullptr);
}
示例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: proc
static void D32_BlitAA(SkShader::Context::BlitState* state, int x, int y, const SkPixmap& dst,
int count, const SkAlpha aa[]) {
SkXfermode::D32Proc proc = (SkXfermode::D32Proc)state->fStorage[0];
const SkPM4f* src = (const SkPM4f*)state->fStorage[1];
proc(state->fXfer, dst.writable_addr32(x, y), src, count, aa);
}
示例7: ForwardToPipeline
static void ForwardToPipeline(BlitState* state, int x, int y, const SkPixmap& dst, int count) {
SkLinearBitmapPipeline* pipeline = static_cast<SkLinearBitmapPipeline*>(state->fStorage[0]);
void* addr = dst.writable_addr32(x, y);
pipeline->blitSpan(x, y, addr, count);
}