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

Side by Side Diff: tools/filtermain.cpp

Issue 912403004: Remove SkPictureFlat.h include from SkDrawCommands.h (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT Created 5 years, 10 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/utils/debugger/SkDrawCommand.cpp ('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 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkDebugCanvas.h" 8 #include "SkDebugCanvas.h"
9 #include "SkDevice.h" 9 #include "SkDevice.h"
10 #include "SkForceLinking.h" 10 #include "SkForceLinking.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 NULL == p.getImageFilter(); 42 NULL == p.getImageFilter();
43 } 43 }
44 44
45 45
46 // Check for: 46 // Check for:
47 // SAVE_LAYER 47 // SAVE_LAYER
48 // DRAW_BITMAP_RECT_TO_RECT 48 // DRAW_BITMAP_RECT_TO_RECT
49 // RESTORE 49 // RESTORE
50 // where the saveLayer's color can be moved into the drawBitmapRect 50 // where the saveLayer's color can be moved into the drawBitmapRect
51 static bool check_0(SkDebugCanvas* canvas, int curCommand) { 51 static bool check_0(SkDebugCanvas* canvas, int curCommand) {
52 if (SAVE_LAYER != canvas->getDrawCommandAt(curCommand)->getType() || 52 if (SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand) ->getType() ||
53 canvas->getSize() <= curCommand+2 || 53 canvas->getSize() <= curCommand+2 ||
54 DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+1)->getT ype() || 54 SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCom mand+1)->getType() ||
55 RESTORE != canvas->getDrawCommandAt(curCommand+2)->getType()) { 55 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+2) ->getType()) {
56 return false; 56 return false;
57 } 57 }
58 58
59 SkSaveLayerCommand* saveLayer = 59 SkSaveLayerCommand* saveLayer =
60 (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand); 60 (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
61 SkDrawBitmapRectCommand* dbmr = 61 SkDrawBitmapRectCommand* dbmr =
62 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1); 62 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+1);
63 63
64 const SkPaint* saveLayerPaint = saveLayer->paint(); 64 const SkPaint* saveLayerPaint = saveLayer->paint();
65 SkPaint* dbmrPaint = dbmr->paint(); 65 SkPaint* dbmrPaint = dbmr->paint();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 114
115 // Check for: 115 // Check for:
116 // SAVE_LAYER 116 // SAVE_LAYER
117 // SAVE 117 // SAVE
118 // CLIP_RECT 118 // CLIP_RECT
119 // DRAW_BITMAP_RECT_TO_RECT 119 // DRAW_BITMAP_RECT_TO_RECT
120 // RESTORE 120 // RESTORE
121 // RESTORE 121 // RESTORE
122 // where the saveLayer's color can be moved into the drawBitmapRect 122 // where the saveLayer's color can be moved into the drawBitmapRect
123 static bool check_1(SkDebugCanvas* canvas, int curCommand) { 123 static bool check_1(SkDebugCanvas* canvas, int curCommand) {
124 if (SAVE_LAYER != canvas->getDrawCommandAt(curCommand)->getType() || 124 if (SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand) ->getType() ||
125 canvas->getSize() <= curCommand+5 || 125 canvas->getSize() <= curCommand+5 ||
126 SAVE != canvas->getDrawCommandAt(curCommand+1)->getType() || 126 SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand+1)->g etType() ||
127 CLIP_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() || 127 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+2 )->getType() ||
128 DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+3)->getT ype() || 128 SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCom mand+3)->getType() ||
129 RESTORE != canvas->getDrawCommandAt(curCommand+4)->getType() || 129 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+4) ->getType() ||
130 RESTORE != canvas->getDrawCommandAt(curCommand+5)->getType()) { 130 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+5) ->getType()) {
131 return false; 131 return false;
132 } 132 }
133 133
134 SkSaveLayerCommand* saveLayer = 134 SkSaveLayerCommand* saveLayer =
135 (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand); 135 (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand);
136 SkDrawBitmapRectCommand* dbmr = 136 SkDrawBitmapRectCommand* dbmr =
137 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3); 137 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+3);
138 138
139 const SkPaint* saveLayerPaint = saveLayer->paint(); 139 const SkPaint* saveLayerPaint = saveLayer->paint();
140 SkPaint* dbmrPaint = dbmr->paint(); 140 SkPaint* dbmrPaint = dbmr->paint();
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 canvas->deleteDrawCommandAt(curCommand); // saveLayer 180 canvas->deleteDrawCommandAt(curCommand); // saveLayer
181 } 181 }
182 182
183 // Check for: 183 // Check for:
184 // SAVE 184 // SAVE
185 // CLIP_RECT 185 // CLIP_RECT
186 // DRAW_RECT 186 // DRAW_RECT
187 // RESTORE 187 // RESTORE
188 // where the rect is entirely within the clip and the clip is an intersect 188 // where the rect is entirely within the clip and the clip is an intersect
189 static bool check_2(SkDebugCanvas* canvas, int curCommand) { 189 static bool check_2(SkDebugCanvas* canvas, int curCommand) {
190 if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() || 190 if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->get Type() ||
191 canvas->getSize() <= curCommand+4 || 191 canvas->getSize() <= curCommand+4 ||
192 CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() || 192 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1 )->getType() ||
193 DRAW_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() || 193 SkDrawCommand::kDrawRect_OpType != canvas->getDrawCommandAt(curCommand+2 )->getType() ||
194 RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) { 194 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3) ->getType()) {
195 return false; 195 return false;
196 } 196 }
197 197
198 SkClipRectCommand* cr = 198 SkClipRectCommand* cr =
199 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1); 199 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
200 SkDrawRectCommand* dr = 200 SkDrawRectCommand* dr =
201 (SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2); 201 (SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2);
202 202
203 if (SkRegion::kIntersect_Op != cr->op()) { 203 if (SkRegion::kIntersect_Op != cr->op()) {
204 return false; 204 return false;
(...skipping 10 matching lines...) Expand all
215 canvas->deleteDrawCommandAt(curCommand); // save 215 canvas->deleteDrawCommandAt(curCommand); // save
216 } 216 }
217 217
218 // Check for: 218 // Check for:
219 // SAVE 219 // SAVE
220 // CLIP_RRECT 220 // CLIP_RRECT
221 // DRAW_RECT 221 // DRAW_RECT
222 // RESTORE 222 // RESTORE
223 // where the rect entirely encloses the clip 223 // where the rect entirely encloses the clip
224 static bool check_3(SkDebugCanvas* canvas, int curCommand) { 224 static bool check_3(SkDebugCanvas* canvas, int curCommand) {
225 if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() || 225 if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->get Type() ||
226 canvas->getSize() <= curCommand+4 || 226 canvas->getSize() <= curCommand+4 ||
227 CLIP_RRECT != canvas->getDrawCommandAt(curCommand+1)->getType() || 227 SkDrawCommand::kClipRRect_OpType != canvas->getDrawCommandAt(curCommand+ 1)->getType() ||
228 DRAW_RECT != canvas->getDrawCommandAt(curCommand+2)->getType() || 228 SkDrawCommand::kDrawRect_OpType != canvas->getDrawCommandAt(curCommand+2 )->getType() ||
229 RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) { 229 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3) ->getType()) {
230 return false; 230 return false;
231 } 231 }
232 232
233 SkClipRRectCommand* crr = 233 SkClipRRectCommand* crr =
234 (SkClipRRectCommand*) canvas->getDrawCommandAt(curCommand+1); 234 (SkClipRRectCommand*) canvas->getDrawCommandAt(curCommand+1);
235 SkDrawRectCommand* dr = 235 SkDrawRectCommand* dr =
236 (SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2); 236 (SkDrawRectCommand*) canvas->getDrawCommandAt(curCommand+2);
237 237
238 if (SkRegion::kIntersect_Op != crr->op()) { 238 if (SkRegion::kIntersect_Op != crr->op()) {
239 return false; 239 return false;
(...skipping 23 matching lines...) Expand all
263 canvas->deleteDrawCommandAt(curCommand); // save 263 canvas->deleteDrawCommandAt(curCommand); // save
264 } 264 }
265 265
266 // Check for: 266 // Check for:
267 // SAVE 267 // SAVE
268 // CLIP_RECT 268 // CLIP_RECT
269 // DRAW_BITMAP_RECT_TO_RECT 269 // DRAW_BITMAP_RECT_TO_RECT
270 // RESTORE 270 // RESTORE
271 // where the rect and drawBitmapRect dst exactly match 271 // where the rect and drawBitmapRect dst exactly match
272 static bool check_4(SkDebugCanvas* canvas, int curCommand) { 272 static bool check_4(SkDebugCanvas* canvas, int curCommand) {
273 if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() || 273 if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->get Type() ||
274 canvas->getSize() <= curCommand+4 || 274 canvas->getSize() <= curCommand+4 ||
275 CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() || 275 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1 )->getType() ||
276 DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getT ype() || 276 SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCom mand+2)->getType() ||
277 RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) { 277 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3) ->getType()) {
278 return false; 278 return false;
279 } 279 }
280 280
281 SkClipRectCommand* cr = 281 SkClipRectCommand* cr =
282 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1); 282 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
283 SkDrawBitmapRectCommand* dbmr = 283 SkDrawBitmapRectCommand* dbmr =
284 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2); 284 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
285 285
286 if (SkRegion::kIntersect_Op != cr->op()) { 286 if (SkRegion::kIntersect_Op != cr->op()) {
287 return false; 287 return false;
288 } 288 }
289 289
290 return dbmr->dstRect() == cr->rect(); 290 return dbmr->dstRect() == cr->rect();
291 } 291 }
292 292
293 // Remove everything but the drawBitmapRect 293 // Remove everything but the drawBitmapRect
294 static void apply_4(SkDebugCanvas* canvas, int curCommand) { 294 static void apply_4(SkDebugCanvas* canvas, int curCommand) {
295 canvas->deleteDrawCommandAt(curCommand+3); // restore 295 canvas->deleteDrawCommandAt(curCommand+3); // restore
296 // drawBitmapRectToRect 296 // drawBitmapRectToRect
297 canvas->deleteDrawCommandAt(curCommand+1); // clipRect 297 canvas->deleteDrawCommandAt(curCommand+1); // clipRect
298 canvas->deleteDrawCommandAt(curCommand); // save 298 canvas->deleteDrawCommandAt(curCommand); // save
299 } 299 }
300 300
301 // Check for: 301 // Check for:
302 // TRANSLATE
303 // where the translate is zero
304 static bool check_5(SkDebugCanvas* canvas, int curCommand) {
305 if (TRANSLATE != canvas->getDrawCommandAt(curCommand)->getType()) {
306 return false;
307 }
308
309 SkTranslateCommand* t =
310 (SkTranslateCommand*) canvas->getDrawCommandAt(curCommand);
311
312 return 0 == t->x() && 0 == t->y();
313 }
314
315 // Just remove the translate
316 static void apply_5(SkDebugCanvas* canvas, int curCommand) {
317 canvas->deleteDrawCommandAt(curCommand); // translate
318 }
319
320 // Check for:
321 // SCALE
322 // where the scale is 1,1
323 static bool check_6(SkDebugCanvas* canvas, int curCommand) {
324 if (SCALE != canvas->getDrawCommandAt(curCommand)->getType()) {
325 return false;
326 }
327
328 SkScaleCommand* s = (SkScaleCommand*) canvas->getDrawCommandAt(curCommand);
329
330 return SK_Scalar1 == s->x() && SK_Scalar1 == s->y();
331 }
332
333 // Just remove the scale
334 static void apply_6(SkDebugCanvas* canvas, int curCommand) {
335 canvas->deleteDrawCommandAt(curCommand); // scale
336 }
337
338 // Check for:
339 // SAVE 302 // SAVE
340 // CLIP_RECT 303 // CLIP_RECT
341 // SAVE_LAYER 304 // SAVE_LAYER
342 // SAVE 305 // SAVE
343 // CLIP_RECT 306 // CLIP_RECT
344 // SAVE_LAYER 307 // SAVE_LAYER
345 // SAVE 308 // SAVE
346 // CLIP_RECT 309 // CLIP_RECT
347 // DRAWBITMAPRECTTORECT 310 // DRAWBITMAPRECTTORECT
348 // RESTORE 311 // RESTORE
349 // RESTORE 312 // RESTORE
350 // RESTORE 313 // RESTORE
351 // RESTORE 314 // RESTORE
352 // RESTORE 315 // RESTORE
353 // where: 316 // where:
354 // all the clipRect's are BW, nested, intersections 317 // all the clipRect's are BW, nested, intersections
355 // the drawBitmapRectToRect is a 1-1 copy from src to dest 318 // the drawBitmapRectToRect is a 1-1 copy from src to dest
356 // the last (smallest) clip rect is a subset of the drawBitmapRectToRect's dest rect 319 // the last (smallest) clip rect is a subset of the drawBitmapRectToRect's dest rect
357 // all the saveLayer's paints can be rolled into the drawBitmapRectToRect's paint 320 // all the saveLayer's paints can be rolled into the drawBitmapRectToRect's paint
358 // This pattern is used by Google spreadsheet when drawing the toolbar buttons 321 // This pattern is used by Google spreadsheet when drawing the toolbar buttons
359 static bool check_7(SkDebugCanvas* canvas, int curCommand) { 322 static bool check_7(SkDebugCanvas* canvas, int curCommand) {
360 if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() || 323 if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->get Type() ||
361 canvas->getSize() <= curCommand+13 || 324 canvas->getSize() <= curCommand+13 ||
362 CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() || 325 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1 )->getType() ||
363 SAVE_LAYER != canvas->getDrawCommandAt(curCommand+2)->getType() || 326 SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand+ 2)->getType() ||
364 SAVE != canvas->getDrawCommandAt(curCommand+3)->getType() || 327 SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand+3)->g etType() ||
365 CLIP_RECT != canvas->getDrawCommandAt(curCommand+4)->getType() || 328 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+4 )->getType() ||
366 SAVE_LAYER != canvas->getDrawCommandAt(curCommand+5)->getType() || 329 SkDrawCommand::kSaveLayer_OpType != canvas->getDrawCommandAt(curCommand+ 5)->getType() ||
367 SAVE != canvas->getDrawCommandAt(curCommand+6)->getType() || 330 SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand+6)->g etType() ||
368 CLIP_RECT != canvas->getDrawCommandAt(curCommand+7)->getType() || 331 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+7 )->getType() ||
369 DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+8)->getT ype() || 332 SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCom mand+8)->getType() ||
370 RESTORE != canvas->getDrawCommandAt(curCommand+9)->getType() || 333 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+9) ->getType() ||
371 RESTORE != canvas->getDrawCommandAt(curCommand+10)->getType() || 334 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+10 )->getType() ||
372 RESTORE != canvas->getDrawCommandAt(curCommand+11)->getType() || 335 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+11 )->getType() ||
373 RESTORE != canvas->getDrawCommandAt(curCommand+12)->getType() || 336 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+12 )->getType() ||
374 RESTORE != canvas->getDrawCommandAt(curCommand+13)->getType()) { 337 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+13 )->getType()) {
375 return false; 338 return false;
376 } 339 }
377 340
378 SkClipRectCommand* clip0 = 341 SkClipRectCommand* clip0 =
379 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1); 342 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
380 SkSaveLayerCommand* saveLayer0 = 343 SkSaveLayerCommand* saveLayer0 =
381 (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand+2); 344 (SkSaveLayerCommand*) canvas->getDrawCommandAt(curCommand+2);
382 SkClipRectCommand* clip1 = 345 SkClipRectCommand* clip1 =
383 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+4); 346 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+4);
384 SkSaveLayerCommand* saveLayer1 = 347 SkSaveLayerCommand* saveLayer1 =
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 489
527 // Check for: 490 // Check for:
528 // SAVE 491 // SAVE
529 // CLIP_RECT 492 // CLIP_RECT
530 // DRAWBITMAPRECTTORECT 493 // DRAWBITMAPRECTTORECT
531 // RESTORE 494 // RESTORE
532 // where: 495 // where:
533 // the drawBitmapRectToRect is a 1-1 copy from src to dest 496 // the drawBitmapRectToRect is a 1-1 copy from src to dest
534 // the clip rect is BW and a subset of the drawBitmapRectToRect's dest rect 497 // the clip rect is BW and a subset of the drawBitmapRectToRect's dest rect
535 static bool check_8(SkDebugCanvas* canvas, int curCommand) { 498 static bool check_8(SkDebugCanvas* canvas, int curCommand) {
536 if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() || 499 if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->get Type() ||
537 canvas->getSize() <= curCommand+4 || 500 canvas->getSize() <= curCommand+4 ||
538 CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() || 501 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1 )->getType() ||
539 DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getT ype() || 502 SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCom mand+2)->getType() ||
540 RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) { 503 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3) ->getType()) {
541 return false; 504 return false;
542 } 505 }
543 506
544 SkClipRectCommand* clip = 507 SkClipRectCommand* clip =
545 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1); 508 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
546 SkDrawBitmapRectCommand* dbmr = 509 SkDrawBitmapRectCommand* dbmr =
547 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2); 510 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
548 511
549 if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) { 512 if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) {
550 return false; 513 return false;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 } 563 }
601 564
602 // Check for: 565 // Check for:
603 // SAVE 566 // SAVE
604 // CLIP_RECT 567 // CLIP_RECT
605 // DRAWBITMAPRECTTORECT 568 // DRAWBITMAPRECTTORECT
606 // RESTORE 569 // RESTORE
607 // where: 570 // where:
608 // clipRect is BW and encloses the DBMR2R's dest rect 571 // clipRect is BW and encloses the DBMR2R's dest rect
609 static bool check_9(SkDebugCanvas* canvas, int curCommand) { 572 static bool check_9(SkDebugCanvas* canvas, int curCommand) {
610 if (SAVE != canvas->getDrawCommandAt(curCommand)->getType() || 573 if (SkDrawCommand::kSave_OpType != canvas->getDrawCommandAt(curCommand)->get Type() ||
611 canvas->getSize() <= curCommand+4 || 574 canvas->getSize() <= curCommand+4 ||
612 CLIP_RECT != canvas->getDrawCommandAt(curCommand+1)->getType() || 575 SkDrawCommand::kClipRect_OpType != canvas->getDrawCommandAt(curCommand+1 )->getType() ||
613 DRAW_BITMAP_RECT_TO_RECT != canvas->getDrawCommandAt(curCommand+2)->getT ype() || 576 SkDrawCommand::kDrawBitmapRect_OpType != canvas->getDrawCommandAt(curCom mand+2)->getType() ||
614 RESTORE != canvas->getDrawCommandAt(curCommand+3)->getType()) { 577 SkDrawCommand::kRestore_OpType != canvas->getDrawCommandAt(curCommand+3) ->getType()) {
615 return false; 578 return false;
616 } 579 }
617 580
618 SkClipRectCommand* clip = 581 SkClipRectCommand* clip =
619 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1); 582 (SkClipRectCommand*) canvas->getDrawCommandAt(curCommand+1);
620 SkDrawBitmapRectCommand* dbmr = 583 SkDrawBitmapRectCommand* dbmr =
621 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2); 584 (SkDrawBitmapRectCommand*) canvas->getDrawCommandAt(curCommand+2);
622 585
623 if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) { 586 if (clip->doAA() || SkRegion::kIntersect_Op != clip->op()) {
624 return false; 587 return false;
(...skipping 20 matching lines...) Expand all
645 struct OptTableEntry { 608 struct OptTableEntry {
646 PFCheck fCheck; 609 PFCheck fCheck;
647 PFApply fApply; 610 PFApply fApply;
648 int fNumTimesApplied; 611 int fNumTimesApplied;
649 } gOptTable[] = { 612 } gOptTable[] = {
650 { check_0, apply_0, 0 }, 613 { check_0, apply_0, 0 },
651 { check_1, apply_1, 0 }, 614 { check_1, apply_1, 0 },
652 { check_2, apply_2, 0 }, 615 { check_2, apply_2, 0 },
653 { check_3, apply_3, 0 }, 616 { check_3, apply_3, 0 },
654 { check_4, apply_4, 0 }, 617 { check_4, apply_4, 0 },
655 { check_5, apply_5, 0 },
656 { check_6, apply_6, 0 },
657 { check_7, apply_7, 0 }, 618 { check_7, apply_7, 0 },
658 { check_8, apply_8, 0 }, 619 { check_8, apply_8, 0 },
659 { check_9, apply_9, 0 }, 620 { check_9, apply_9, 0 },
660 }; 621 };
661 622
662 623
663 static int filter_picture(const SkString& inFile, const SkString& outFile) { 624 static int filter_picture(const SkString& inFile, const SkString& outFile) {
664 SkAutoTUnref<SkPicture> inPicture; 625 SkAutoTUnref<SkPicture> inPicture;
665 626
666 SkFILEStream inStream(inFile.c_str()); 627 SkFILEStream inStream(inFile.c_str());
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 800
840 SkGraphics::Term(); 801 SkGraphics::Term();
841 return 0; 802 return 0;
842 } 803 }
843 804
844 #if !defined SK_BUILD_FOR_IOS 805 #if !defined SK_BUILD_FOR_IOS
845 int main(int argc, char * const argv[]) { 806 int main(int argc, char * const argv[]) {
846 return tool_main(argc, (char**) argv); 807 return tool_main(argc, (char**) argv);
847 } 808 }
848 #endif 809 #endif
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698