Flutter Engine
The Flutter Engine
Functions | Variables
SkBlitter.cpp File Reference
#include "src/core/SkBlitter.h"
#include "include/core/SkAlphaType.h"
#include "include/core/SkBlendMode.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorFilter.h"
#include "include/core/SkColorSpace.h"
#include "include/core/SkColorType.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPixmap.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/private/base/SkDebug.h"
#include "include/private/base/SkTemplates.h"
#include "include/private/base/SkTo.h"
#include "src/base/SkArenaAlloc.h"
#include "src/base/SkTLazy.h"
#include "src/core/SkAlphaRuns.h"
#include "src/core/SkBlendModePriv.h"
#include "src/core/SkBlitter_A8.h"
#include "src/core/SkCoreBlitters.h"
#include "src/core/SkMask.h"
#include "src/core/SkMaskFilterBase.h"
#include "src/core/SkMemset.h"
#include "src/core/SkPaintPriv.h"
#include "src/core/SkRegionPriv.h"
#include "src/shaders/SkShaderBase.h"
#include <cstddef>
#include <functional>
#include <optional>

Go to the source code of this file.

Functions

static SkAlpha ScalarToAlpha (SkScalar a)
 
static void bits_to_runs (SkBlitter *blitter, int x, int y, const uint8_t bits[], uint8_t left_mask, ptrdiff_t rowBytes, uint8_t right_mask)
 
static uint8_t generate_right_mask (int maskBitCount)
 
static int compute_anti_width (const int16_t runs[])
 
static bool y_in_rect (int y, const SkIRect &rect)
 
static bool x_in_rect (int x, const SkIRect &rect)
 

Variables

bool gSkForceRasterPipelineBlitter {false}
 

Function Documentation

◆ bits_to_runs()

static void bits_to_runs ( SkBlitter blitter,
int  x,
int  y,
const uint8_t  bits[],
uint8_t  left_mask,
ptrdiff_t  rowBytes,
uint8_t  right_mask 
)
inlinestatic

Definition at line 160 of file SkBlitter.cpp.

163 {
164 int inFill = 0;
165 int pos = 0;
166
167 while (--rowBytes >= 0) {
168 uint8_t b = *bits++ & left_mask;
169 if (rowBytes == 0) {
170 b &= right_mask;
171 }
172
173 for (uint8_t test = 0x80U; test != 0; test >>= 1) {
174 if (b & test) {
175 if (!inFill) {
176 pos = x;
177 inFill = true;
178 }
179 } else {
180 if (inFill) {
181 blitter->blitH(pos, y, x - pos);
182 inFill = false;
183 }
184 }
185 x += 1;
186 }
187 left_mask = 0xFFU;
188 }
189
190 // final cleanup
191 if (inFill) {
192 blitter->blitH(pos, y, x - pos);
193 }
194}
SkPoint pos
virtual void blitH(int x, int y, int width)=0
Blit a horizontal run of one or more pixels.
static bool b
double y
double x

◆ compute_anti_width()

static int compute_anti_width ( const int16_t  runs[])
static

Definition at line 333 of file SkBlitter.cpp.

333 {
334 int width = 0;
335
336 for (;;) {
337 int count = runs[0];
338
339 SkASSERT(count >= 0);
340 if (count == 0) {
341 break;
342 }
343 width += count;
344 runs += count;
345 }
346 return width;
347}
int count
Definition: FontMgrTest.cpp:50
#define SkASSERT(cond)
Definition: SkAssert.h:116
int32_t width

◆ generate_right_mask()

static uint8_t generate_right_mask ( int  maskBitCount)
static

Definition at line 197 of file SkBlitter.cpp.

197 {
198 return static_cast<uint8_t>((0xFF00U >> maskBitCount) & 0xFF);
199}

◆ ScalarToAlpha()

static SkAlpha ScalarToAlpha ( SkScalar  a)
inlinestatic

Definition at line 62 of file SkBlitter.cpp.

62 {
63 SkAlpha alpha = (SkAlpha)(a * 255);
64 return alpha > 247 ? 0xFF : alpha < 8 ? 0 : alpha;
65}
uint8_t SkAlpha
Definition: SkColor.h:26
struct MyStruct a[10]

◆ x_in_rect()

static bool x_in_rect ( int  x,
const SkIRect rect 
)
inlinestatic

Definition at line 353 of file SkBlitter.cpp.

353 {
354 return (unsigned)(x - rect.fLeft) < (unsigned)rect.width();
355}
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350

◆ y_in_rect()

static bool y_in_rect ( int  y,
const SkIRect rect 
)
inlinestatic

Definition at line 349 of file SkBlitter.cpp.

349 {
350 return (unsigned)(y - rect.fTop) < (unsigned)rect.height();
351}

Variable Documentation

◆ gSkForceRasterPipelineBlitter

bool gSkForceRasterPipelineBlitter {false}

Definition at line 44 of file SkBlitter.cpp.