Coverage Report

Created: 2021-08-22 09:07

/src/skia/src/core/SkBlitter_A8.cpp
Line
Count
Source (jump to first uncovered line)
1
/*
2
 * Copyright 2006 The Android Open Source Project
3
 *
4
 * Use of this source code is governed by a BSD-style license that can be
5
 * found in the LICENSE file.
6
 */
7
8
#include "include/core/SkShader.h"
9
#include "include/private/SkColorData.h"
10
#include "src/core/SkCoreBlitters.h"
11
#include "src/core/SkXfermodePriv.h"
12
13
SkA8_Coverage_Blitter::SkA8_Coverage_Blitter(const SkPixmap& device,
14
7.64k
                             const SkPaint& paint) : SkRasterBlitter(device) {
15
7.64k
    SkASSERT(nullptr == paint.getShader());
16
7.64k
    SkASSERT(paint.isSrcOver());
17
7.64k
    SkASSERT(nullptr == paint.getColorFilter());
18
7.64k
}
19
20
void SkA8_Coverage_Blitter::blitAntiH(int x, int y, const SkAlpha antialias[],
21
630k
                                      const int16_t runs[]) {
22
630k
    uint8_t* device = fDevice.writable_addr8(x, y);
23
630k
    SkDEBUGCODE(int totalCount = 0;)
24
25
5.60M
    for (;;) {
26
5.60M
        int count = runs[0];
27
5.60M
        SkASSERT(count >= 0);
28
5.60M
        if (count == 0) {
29
630k
            return;
30
630k
        }
31
4.97M
        if (antialias[0]) {
32
4.50M
            memset(device, antialias[0], count);
33
4.50M
        }
34
4.97M
        runs += count;
35
4.97M
        antialias += count;
36
4.97M
        device += count;
37
38
4.97M
        SkDEBUGCODE(totalCount += count;)
39
4.97M
    }
40
0
    SkASSERT(fDevice.width() == totalCount);
41
0
}
42
43
355k
void SkA8_Coverage_Blitter::blitH(int x, int y, int width) {
44
355k
    memset(fDevice.writable_addr8(x, y), 0xFF, width);
45
355k
}
46
47
970k
void SkA8_Coverage_Blitter::blitV(int x, int y, int height, SkAlpha alpha) {
48
970k
    if (0 == alpha) {
49
377
        return;
50
377
    }
51
52
970k
    uint8_t* dst = fDevice.writable_addr8(x, y);
53
970k
    const size_t dstRB = fDevice.rowBytes();
54
1.94M
    while (--height >= 0) {
55
970k
        *dst = alpha;
56
970k
        dst += dstRB;
57
970k
    }
58
970k
}
59
60
11
void SkA8_Coverage_Blitter::blitRect(int x, int y, int width, int height) {
61
11
    uint8_t* dst = fDevice.writable_addr8(x, y);
62
11
    const size_t dstRB = fDevice.rowBytes();
63
752
    while (--height >= 0) {
64
741
        memset(dst, 0xFF, width);
65
741
        dst += dstRB;
66
741
    }
67
11
}
68
69
664
void SkA8_Coverage_Blitter::blitMask(const SkMask& mask, const SkIRect& clip) {
70
664
    if (SkMask::kA8_Format != mask.fFormat) {
71
0
        this->INHERITED::blitMask(mask, clip);
72
0
        return;
73
0
    }
74
75
664
    int x = clip.fLeft;
76
664
    int y = clip.fTop;
77
664
    int width = clip.width();
78
664
    int height = clip.height();
79
80
664
    uint8_t* dst = fDevice.writable_addr8(x, y);
81
664
    const uint8_t* src = mask.getAddr8(x, y);
82
664
    const size_t srcRB = mask.fRowBytes;
83
664
    const size_t dstRB = fDevice.rowBytes();
84
85
8.49k
    while (--height >= 0) {
86
7.82k
        memcpy(dst, src, width);
87
7.82k
        dst += dstRB;
88
7.82k
        src += srcRB;
89
7.82k
    }
90
664
}
91
92
0
const SkPixmap* SkA8_Coverage_Blitter::justAnOpaqueColor(uint32_t*) {
93
0
    return nullptr;
94
0
}