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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 REPORTER_ASSERT(reporter, !memcmp(bitmaps[0].getPixels(), | 247 REPORTER_ASSERT(reporter, !memcmp(bitmaps[0].getPixels(), |
248 bitmaps[1].getPixels(), | 248 bitmaps[1].getPixels(), |
249 bitmaps[0].getSize())); | 249 bitmaps[0].getSize())); |
250 } | 250 } |
251 #endif | 251 #endif |
252 | 252 |
253 //////////////////////////////////////////////////////////////////////////////// | 253 //////////////////////////////////////////////////////////////////////////////// |
254 | 254 |
255 class TestDrawFilter : public SkDrawFilter { | 255 class TestDrawFilter : public SkDrawFilter { |
256 public: | 256 public: |
257 virtual bool filter(SkPaint*, Type) SK_OVERRIDE { return true; } | 257 bool filter(SkPaint*, Type) SK_OVERRIDE { return true; } |
258 }; | 258 }; |
259 | 259 |
260 DEF_TEST(CanvasState_test_draw_filters, reporter) { | 260 DEF_TEST(CanvasState_test_draw_filters, reporter) { |
261 TestDrawFilter drawFilter; | 261 TestDrawFilter drawFilter; |
262 SkBitmap bitmap; | 262 SkBitmap bitmap; |
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 |
(...skipping 60 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 |