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

Side by Side Diff: tests/CanvasStateTest.cpp

Issue 777643003: use ClipOp instead of SkRegion for clipping (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« no previous file with comments | « tests/CanvasStateHelpers.cpp ('k') | tests/CanvasTest.cpp » ('j') | 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 static void error_callback(SkError code, void* ctx) {} 283 static void error_callback(SkError code, void* ctx) {}
284 284
285 DEF_TEST(CanvasState_test_soft_clips, reporter) { 285 DEF_TEST(CanvasState_test_soft_clips, reporter) {
286 SkBitmap bitmap; 286 SkBitmap bitmap;
287 bitmap.allocN32Pixels(10, 10); 287 bitmap.allocN32Pixels(10, 10);
288 SkCanvas canvas(bitmap); 288 SkCanvas canvas(bitmap);
289 289
290 SkRRect roundRect; 290 SkRRect roundRect;
291 roundRect.setOval(SkRect::MakeWH(5, 5)); 291 roundRect.setOval(SkRect::MakeWH(5, 5));
292 292
293 canvas.clipRRect(roundRect, SkRegion::kIntersect_Op, true); 293 canvas.clipRRect(roundRect, kIntersect_SkClipOp, true);
294 294
295 SkSetErrorCallback(error_callback, NULL); 295 SkSetErrorCallback(error_callback, NULL);
296 296
297 SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas); 297 SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
298 REPORTER_ASSERT(reporter, !state); 298 REPORTER_ASSERT(reporter, !state);
299 299
300 REPORTER_ASSERT(reporter, kInvalidOperation_SkError == SkGetLastError()); 300 REPORTER_ASSERT(reporter, kInvalidOperation_SkError == SkGetLastError());
301 SkClearLastError(); 301 SkClearLastError();
302 } 302 }
303 303
(...skipping 24 matching lines...) Expand all
328 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip 328 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip
329 // stack to the layer bounds. 329 // stack to the layer bounds.
330 canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); 330 canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag);
331 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); 331 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType);
332 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH); 332 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH);
333 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT); 333 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT);
334 334
335 canvas.restore(); 335 canvas.restore();
336 } 336 }
337 #endif 337 #endif
OLDNEW
« no previous file with comments | « tests/CanvasStateHelpers.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698