2 * Copyright 2006 The Android Open Source Project
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "include/core/SkShader.h"
9 #include "include/private/SkColorData.h"
10 #include "src/core/SkCoreBlitters.h"
11 #include "src/core/SkXfermodePriv.h"
13 SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkPixmap& device,
14 const SkPaint& paint) : SkRasterBlitter(device) {
15 SkASSERT(nullptr == paint.getShader());
16 SkASSERT(paint.isSrcOver());
17 SkASSERT(nullptr == paint.getColorFilter());
20 void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
21 const int16_t runs[]) {
22 uint8_t* device = fDevice.writable_addr8(x, y);
23 SkDEBUGCODE(int totalCount = 0;)
32 memset(device, antialias[0], count);
38 SkDEBUGCODE(totalCount += count;)
40 SkASSERT(fDevice.width() == totalCount);
43 void SkA8_Coverage_Blitter::blitH(int x, int y, int width) {
44 memset(fDevice.writable_addr8(x, y), 0xFF, width);
47 void SkA8_Coverage_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
52 uint8_t* dst = fDevice.writable_addr8(x, y);
53 const size_t dstRB = fDevice.rowBytes();
54 while (--height >= 0) {
60 void SkA8_Coverage_Blitter::blitRect(int x, int y, int width, int height) {
61 uint8_t* dst = fDevice.writable_addr8(x, y);
62 const size_t dstRB = fDevice.rowBytes();
63 while (--height >= 0) {
64 memset(dst, 0xFF, width);
69 void SkA8_Coverage_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
70 if (SkMask::kA8_Format != mask.fFormat) {
71 this->INHERITED::blitMask(mask, clip);
77 int width = clip.width();
78 int height = clip.height();
80 uint8_t* dst = fDevice.writable_addr8(x, y);
81 const uint8_t* src = mask.getAddr8(x, y);
82 const size_t srcRB = mask.fRowBytes;
83 const size_t dstRB = fDevice.rowBytes();
85 while (--height >= 0) {
86 memcpy(dst, src, width);
92 const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) {