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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 bitmap.allocN32Pixels(10, 10); | 263 bitmap.allocN32Pixels(10, 10); |
264 SkCanvas canvas(bitmap); | 264 SkCanvas canvas(bitmap); |
265 | 265 |
266 canvas.setDrawFilter(&drawFilter); | 266 canvas.setDrawFilter(&drawFilter); |
267 | 267 |
268 SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas); | 268 SkCanvasState* state = SkCanvasStateUtils::CaptureCanvasState(&canvas); |
269 REPORTER_ASSERT(reporter, state); | 269 REPORTER_ASSERT(reporter, state); |
270 SkCanvas* tmpCanvas = SkCanvasStateUtils::CreateFromCanvasState(state); | 270 SkCanvas* tmpCanvas = SkCanvasStateUtils::CreateFromCanvasState(state); |
271 REPORTER_ASSERT(reporter, tmpCanvas); | 271 REPORTER_ASSERT(reporter, tmpCanvas); |
272 | 272 |
273 REPORTER_ASSERT(reporter, NULL != canvas.getDrawFilter()); | 273 REPORTER_ASSERT(reporter, canvas.getDrawFilter()); |
274 REPORTER_ASSERT(reporter, NULL == tmpCanvas->getDrawFilter()); | 274 REPORTER_ASSERT(reporter, NULL == tmpCanvas->getDrawFilter()); |
275 | 275 |
276 tmpCanvas->unref(); | 276 tmpCanvas->unref(); |
277 SkCanvasStateUtils::ReleaseCanvasState(state); | 277 SkCanvasStateUtils::ReleaseCanvasState(state); |
278 } | 278 } |
279 | 279 |
280 //////////////////////////////////////////////////////////////////////////////// | 280 //////////////////////////////////////////////////////////////////////////////// |
281 | 281 |
282 // we need this function to prevent SkError from printing to stdout | 282 // we need this function to prevent SkError from printing to stdout |
283 static void error_callback(SkError code, void* ctx) {} | 283 static void error_callback(SkError code, void* ctx) {} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |