| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| 304 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG | 304 #ifdef SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG |
| 305 #include "SkClipStack.h" |
| 305 DEF_TEST(CanvasState_test_saveLayer_clip, reporter) { | 306 DEF_TEST(CanvasState_test_saveLayer_clip, reporter) { |
| 306 const int WIDTH = 100; | 307 const int WIDTH = 100; |
| 307 const int HEIGHT = 100; | 308 const int HEIGHT = 100; |
| 308 const int LAYER_WIDTH = 50; | 309 const int LAYER_WIDTH = 50; |
| 309 const int LAYER_HEIGHT = 50; | 310 const int LAYER_HEIGHT = 50; |
| 310 | 311 |
| 311 SkBitmap bitmap; | 312 SkBitmap bitmap; |
| 312 bitmap.allocN32Pixels(WIDTH, HEIGHT); | 313 bitmap.allocN32Pixels(WIDTH, HEIGHT); |
| 313 SkCanvas canvas(bitmap); | 314 SkCanvas canvas(bitmap); |
| 314 | 315 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 328 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip | 329 // Check that saveLayer with the kClipToLayer_SaveFlag sets the clip |
| 329 // stack to the layer bounds. | 330 // stack to the layer bounds. |
| 330 canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); | 331 canvas.saveLayer(&bounds, NULL, SkCanvas::kARGB_ClipLayer_SaveFlag); |
| 331 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); | 332 canvas.getClipStack()->getBounds(&clipStackBounds, &boundsType); |
| 332 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH); | 333 REPORTER_ASSERT(reporter, clipStackBounds.width() == LAYER_WIDTH); |
| 333 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT); | 334 REPORTER_ASSERT(reporter, clipStackBounds.height() == LAYER_HEIGHT); |
| 334 | 335 |
| 335 canvas.restore(); | 336 canvas.restore(); |
| 336 } | 337 } |
| 337 #endif | 338 #endif |
| OLD | NEW |