Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(358)

Side by Side Diff: src/core/SkBlitter_A1.cpp

Issue 86483002: Revert "Revert "remove kA1_Config, as it is no longer supported"" (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add change to picture version Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1
2 /*
3 * Copyright 2006 The Android Open Source Project
4 *
5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file.
7 */
8
9
10 #include "SkCoreBlitters.h"
11
12 SkA1_Blitter::SkA1_Blitter(const SkBitmap& device, const SkPaint& paint)
13 : INHERITED(device) {
14 fSrcA = paint.getAlpha();
15 }
16
17 void SkA1_Blitter::blitH(int x, int y, int width) {
18 SkASSERT(x >= 0 && y >= 0 &&
19 (unsigned)(x + width) <= (unsigned)fDevice.width());
20
21 if (fSrcA <= 0x7F) {
22 return;
23 }
24 uint8_t* dst = fDevice.getAddr1(x, y);
25 int right = x + width;
26
27 int left_mask = 0xFF >> (x & 7);
28 int rite_mask = 0xFF << (8 - (right & 7));
29 int full_runs = (right >> 3) - ((x + 7) >> 3);
30
31 // check for empty right mask, so we don't read off the end
32 // (or go slower than we need to)
33 if (rite_mask == 0) {
34 SkASSERT(full_runs >= 0);
35 full_runs -= 1;
36 rite_mask = 0xFF;
37 }
38 if (left_mask == 0xFF) {
39 full_runs -= 1;
40 }
41 if (full_runs < 0) {
42 SkASSERT((left_mask & rite_mask) != 0);
43 *dst |= (left_mask & rite_mask);
44 } else {
45 *dst++ |= left_mask;
46 memset(dst, 0xFF, full_runs);
47 dst += full_runs;
48 *dst |= rite_mask;
49 }
50 }
OLDNEW
« no previous file with comments | « src/core/SkBlitter.cpp ('k') | src/core/SkCoreBlitters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698