| 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 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |