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

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

Issue 450423002: add a simple ascii-art debug thing for AA clips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add a Y compression flag to the aa clip debugger Created 6 years, 4 months 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
« no previous file with comments | « src/core/SkAAClip.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkAAClip.h" 9 #include "SkAAClip.h"
10 #include "SkBlitter.h" 10 #include "SkBlitter.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 prevOffset = yoff->fOffset; 212 prevOffset = yoff->fOffset;
213 const uint8_t* row = head->data() + yoff->fOffset; 213 const uint8_t* row = head->data() + yoff->fOffset;
214 size_t rowLength = compute_row_length(row, fBounds.width()); 214 size_t rowLength = compute_row_length(row, fBounds.width());
215 SkASSERT(yoff->fOffset + rowLength <= head->fDataSize); 215 SkASSERT(yoff->fOffset + rowLength <= head->fDataSize);
216 yoff += 1; 216 yoff += 1;
217 } 217 }
218 // check the last entry; 218 // check the last entry;
219 --yoff; 219 --yoff;
220 SkASSERT(yoff->fY == lastY); 220 SkASSERT(yoff->fY == lastY);
221 } 221 }
222
223 static void dump_one_row(const uint8_t* SK_RESTRICT row,
224 int width, int leading_num) {
225 if (leading_num) {
226 SkDebugf( "%03d ", leading_num );
227 }
228 while (width > 0) {
229 int n = row[0];
230 int val = row[1];
231 char out = '.';
232 if (val == 0xff) {
233 out = '*';
234 } else if (val > 0) {
235 out = '+';
236 }
237 for (int i = 0 ; i < n ; i++) {
238 SkDebugf( "%c", out );
239 }
240 row += 2;
241 width -= n;
242 }
243 SkDebugf( "\n" );
244 }
245
246 void SkAAClip::debug(bool compress_y) const {
247 Iter iter(*this);
248 const int width = fBounds.width();
249
250 int y = fBounds.fTop;
251 while (!iter.done()) {
252 if (compress_y) {
253 dump_one_row(iter.data(), width, iter.bottom() - iter.top() + 1);
254 } else {
255 do {
256 dump_one_row(iter.data(), width, 0);
257 } while (++y < iter.bottom());
258 }
259 iter.next();
260 }
261 }
222 #endif 262 #endif
223 263
224 /////////////////////////////////////////////////////////////////////////////// 264 ///////////////////////////////////////////////////////////////////////////////
225 265
226 // Count the number of zeros on the left and right edges of the passed in 266 // Count the number of zeros on the left and right edges of the passed in
227 // RLE row. If 'row' is all zeros return 'width' in both variables. 267 // RLE row. If 'row' is all zeros return 'width' in both variables.
228 static void count_left_right_zeros(const uint8_t* row, int width, 268 static void count_left_right_zeros(const uint8_t* row, int width,
229 int* leftZ, int* riteZ) { 269 int* leftZ, int* riteZ) {
230 int zeros = 0; 270 int zeros = 0;
231 do { 271 do {
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 rowMask.fBounds.fBottom = y + 1; 2228 rowMask.fBounds.fBottom = y + 1;
2189 fBlitter->blitMask(rowMask, rowMask.fBounds); 2229 fBlitter->blitMask(rowMask, rowMask.fBounds);
2190 src = (const void*)((const char*)src + srcRB); 2230 src = (const void*)((const char*)src + srcRB);
2191 } while (++y < localStopY); 2231 } while (++y < localStopY);
2192 } while (y < stopY); 2232 } while (y < stopY);
2193 } 2233 }
2194 2234
2195 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) { 2235 const SkBitmap* SkAAClipBlitter::justAnOpaqueColor(uint32_t* value) {
2196 return NULL; 2236 return NULL;
2197 } 2237 }
OLDNEW
« no previous file with comments | « src/core/SkAAClip.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698