| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |