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