Wed, 31 Dec 2014 07:53:36 +0100
Correct small whitespace inconsistency, lost while renaming variables.
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 */
10 #include "SkAntiRun.h"
11 #include "SkUtils.h"
13 void SkAlphaRuns::reset(int width) {
14 SkASSERT(width > 0);
16 #ifdef SK_DEBUG
17 sk_memset16((uint16_t*)fRuns, (uint16_t)(-42), width);
18 #endif
19 fRuns[0] = SkToS16(width);
20 fRuns[width] = 0;
21 fAlpha[0] = 0;
23 SkDEBUGCODE(fWidth = width;)
24 SkDEBUGCODE(this->validate();)
25 }
27 #ifdef SK_DEBUG
28 void SkAlphaRuns::assertValid(int y, int maxStep) const {
29 int max = (y + 1) * maxStep - (y == maxStep - 1);
31 const int16_t* runs = fRuns;
32 const uint8_t* alpha = fAlpha;
34 while (*runs) {
35 SkASSERT(*alpha <= max);
36 alpha += *runs;
37 runs += *runs;
38 }
39 }
41 void SkAlphaRuns::dump() const {
42 const int16_t* runs = fRuns;
43 const uint8_t* alpha = fAlpha;
45 SkDebugf("Runs");
46 while (*runs) {
47 int n = *runs;
49 SkDebugf(" %02x", *alpha);
50 if (n > 1) {
51 SkDebugf(",%d", n);
52 }
53 alpha += n;
54 runs += n;
55 }
56 SkDebugf("\n");
57 }
59 void SkAlphaRuns::validate() const {
60 SkASSERT(fWidth > 0);
62 int count = 0;
63 const int16_t* runs = fRuns;
65 while (*runs) {
66 SkASSERT(*runs > 0);
67 count += *runs;
68 SkASSERT(count <= fWidth);
69 runs += *runs;
70 }
71 SkASSERT(count == fWidth);
72 }
73 #endif