OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "Test.h" | 8 #include "Test.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 paint.setAlpha(255); | 326 paint.setAlpha(255); |
327 paint.setXfermodeMode(SkXfermode::kSrcIn_Mode); | 327 paint.setXfermodeMode(SkXfermode::kSrcIn_Mode); |
328 canvas->drawRect(fullRect, paint); | 328 canvas->drawRect(fullRect, paint); |
329 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 329 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
330 } | 330 } |
331 { | 331 { |
332 SkPaint paint; | 332 SkPaint paint; |
333 paint.setStyle(SkPaint::kFill_Style); | 333 paint.setStyle(SkPaint::kFill_Style); |
334 SkBitmap bmp; | 334 SkBitmap bmp; |
335 create(&bmp, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); | 335 create(&bmp, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); |
336 bmp.setIsOpaque(true); | 336 bmp.setAlphaType(kOpaque_SkAlphaType); |
337 SkShader* shader = SkShader::CreateBitmapShader(bmp, | 337 SkShader* shader = SkShader::CreateBitmapShader(bmp, |
338 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); | 338 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); |
339 paint.setShader(shader)->unref(); | 339 paint.setShader(shader)->unref(); |
340 canvas->drawRect(fullRect, paint); | 340 canvas->drawRect(fullRect, paint); |
341 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); | 341 REPORTER_ASSERT(reporter, canvas->isFreshFrame()); |
342 } | 342 } |
343 | 343 |
344 // Verify that full frame rects with different forms of non-opaque paint | 344 // Verify that full frame rects with different forms of non-opaque paint |
345 // do not trigger frames to be marked as fresh | 345 // do not trigger frames to be marked as fresh |
346 { | 346 { |
(...skipping 17 matching lines...) Expand all Loading... |
364 pt1, r1, pt2, r2, colors, pos, 2, SkShader::kClamp_TileMode, NULL); | 364 pt1, r1, pt2, r2, colors, pos, 2, SkShader::kClamp_TileMode, NULL); |
365 paint.setShader(shader)->unref(); | 365 paint.setShader(shader)->unref(); |
366 canvas->drawRect(fullRect, paint); | 366 canvas->drawRect(fullRect, paint); |
367 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 367 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
368 } | 368 } |
369 { | 369 { |
370 SkPaint paint; | 370 SkPaint paint; |
371 paint.setStyle(SkPaint::kFill_Style); | 371 paint.setStyle(SkPaint::kFill_Style); |
372 SkBitmap bmp; | 372 SkBitmap bmp; |
373 create(&bmp, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); | 373 create(&bmp, SkBitmap::kARGB_8888_Config, 0xFFFFFFFF); |
374 bmp.setIsOpaque(false); | 374 bmp.setAlphaType(kPremul_SkAlphaType); |
375 SkShader* shader = SkShader::CreateBitmapShader(bmp, | 375 SkShader* shader = SkShader::CreateBitmapShader(bmp, |
376 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); | 376 SkShader::kClamp_TileMode, SkShader::kClamp_TileMode); |
377 paint.setShader(shader)->unref(); | 377 paint.setShader(shader)->unref(); |
378 canvas->drawRect(fullRect, paint); | 378 canvas->drawRect(fullRect, paint); |
379 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); | 379 REPORTER_ASSERT(reporter, !canvas->isFreshFrame()); |
380 } | 380 } |
381 | 381 |
382 // Verify that incomplete coverage does not trigger a fresh frame | 382 // Verify that incomplete coverage does not trigger a fresh frame |
383 { | 383 { |
384 SkPaint paint; | 384 SkPaint paint; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
839 TestDeferredCanvasSurface(reporter, NULL); | 839 TestDeferredCanvasSurface(reporter, NULL); |
840 TestDeferredCanvasSetSurface(reporter, NULL); | 840 TestDeferredCanvasSetSurface(reporter, NULL); |
841 if (NULL != factory) { | 841 if (NULL != factory) { |
842 TestDeferredCanvasSurface(reporter, factory); | 842 TestDeferredCanvasSurface(reporter, factory); |
843 TestDeferredCanvasSetSurface(reporter, factory); | 843 TestDeferredCanvasSetSurface(reporter, factory); |
844 } | 844 } |
845 } | 845 } |
846 | 846 |
847 #include "TestClassDef.h" | 847 #include "TestClassDef.h" |
848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) | 848 DEFINE_GPUTESTCLASS("DeferredCanvas", TestDeferredCanvasClass, TestDeferredCanva
s) |
OLD | NEW |