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

Side by Side Diff: tests/CanvasStateTest.cpp

Issue 1470563003: Revert[2] of "quick-accept clipRect calls" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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/SkCanvas.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 2013 Google Inc. 2 * Copyright 2013 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 "CanvasStateHelpers.h" 8 #include "CanvasStateHelpers.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkCanvasStateUtils.h" 10 #include "SkCanvasStateUtils.h"
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 315
316 SkRect bounds = SkRect::MakeWH(SkIntToScalar(LAYER_WIDTH), SkIntToScalar(LAY ER_HEIGHT)); 316 SkRect bounds = SkRect::MakeWH(SkIntToScalar(LAYER_WIDTH), SkIntToScalar(LAY ER_HEIGHT));
317 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(WIDTH), SkIntToScalar(HEIGHT))) ; 317 canvas.clipRect(SkRect::MakeWH(SkIntToScalar(WIDTH), SkIntToScalar(HEIGHT))) ;
318 318
319 // Check that saveLayer without the kClipToLayer_SaveFlag leaves the 319 // Check that saveLayer without the kClipToLayer_SaveFlag leaves the
320 // clip stack unchanged. 320 // clip stack unchanged.
321 canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_NoClipLayer_SaveFlag); 321 canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_NoClipLayer_SaveFlag);
322 SkRect clipStackBounds; 322 SkRect clipStackBounds;
323 SkClipStack::BoundsType boundsType; 323 SkClipStack::BoundsType boundsType;
324 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); 324 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType);
325 REPORTER_ASSERT(reporter, clipStackBounds.width() == WIDTH); 325 // The clip stack will return its bounds, or it may be "full" : i.e. empty + inside_out.
326 REPORTER_ASSERT(reporter, clipStackBounds.height() == HEIGHT); 326 // Either result is consistent with this test, since the canvas' size is WID TH/HEIGHT
327 if (SkClipStack::kInsideOut_BoundsType == boundsType) {
328 REPORTER_ASSERT(reporter, clipStackBounds.isEmpty());
329 } else {
330 REPORTER_ASSERT(reporter, clipStackBounds.width() == WIDTH);
331 REPORTER_ASSERT(reporter, clipStackBounds.height() == HEIGHT);
332 }
327 canvas.restore(); 333 canvas.restore();
328 334
329 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip 335 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip
330 // stack to the layer bounds. 336 // stack to the layer bounds.
331 canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_ClipLayer_SaveFlag); 337 canvas.saveLayer(&bounds, nullptr, SkCanvas::kARGB_ClipLayer_SaveFlag);
332 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); 338 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType);
333 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH); 339 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH);
334 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT); 340 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT);
335 341
336 canvas.restore(); 342 canvas.restore();
337 } 343 }
338 #endif 344 #endif
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698