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

Side by Side Diff: tests/CanvasStateTest.cpp

Issue 2355483002: abstract name of clipping ops, to transtion to a more restricted set (Closed)
Patch Set: no need for ifdef for globals Created 4 years, 3 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/SkNWayCanvas.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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 static void error_callback(SkError code, void* ctx) {} 297 static void error_callback(SkError code, void* ctx) {}
298 298
299 DEF_TEST(CanvasState_test_soft_clips, reporter) { 299 DEF_TEST(CanvasState_test_soft_clips, reporter) {
300 SkBitmap bitmap; 300 SkBitmap bitmap;
301 bitmap.allocN32Pixels(10, 10); 301 bitmap.allocN32Pixels(10, 10);
302 SkCanvas canvas(bitmap); 302 SkCanvas canvas(bitmap);
303 303
304 SkRRect roundRect; 304 SkRRect roundRect;
305 roundRect.setOval(SkRect::MakeWH(5, 5)); 305 roundRect.setOval(SkRect::MakeWH(5, 5));
306 306
307 canvas.clipRRect(roundRect, SkRegion::kIntersect_Op, true); 307 canvas.clipRRect(roundRect, SkCanvas::kIntersect_Op, true);
308 308
309 SkSetErrorCallback(error_callback, nullptr); 309 SkSetErrorCallback(error_callback, nullptr);
310 310
311 SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas); 311 SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas);
312 REPORTER_ASSERT(reporter, !state); 312 REPORTER_ASSERT(reporter, !state);
313 313
314 REPORTER_ASSERT(reporter, kInvalidOperation_SkError == SkGetLastError()); 314 REPORTER_ASSERT(reporter, kInvalidOperation_SkError == SkGetLastError());
315 SkClearLastError(); 315 SkClearLastError();
316 } 316 }
317 317
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip 351 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip
352 // stack to the layer bounds. 352 // stack to the layer bounds.
353 canvas.saveLayer(&bounds, nullptr); 353 canvas.saveLayer(&bounds, nullptr);
354 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); 354 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType);
355 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH); 355 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH);
356 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT); 356 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT);
357 357
358 canvas.restore(); 358 canvas.restore();
359 } 359 }
360 #endif 360 #endif
OLDNEW
« no previous file with comments | « src/utils/SkNWayCanvas.cpp ('k') | tests/CanvasTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698