| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 566 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 567 context.drawImage(alphaImage.get(), IntPoint(10, 10)); | 567 context.drawImage(alphaImage.get(), IntPoint(10, 10)); |
| 568 EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), context.opaqueRegion().asRect()); | 568 EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), context.opaqueRegion().asRect()); |
| 569 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 569 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 570 | 570 |
| 571 context.drawImage(alphaImage.get(), IntPoint(20, 10), CompositeSourceIn); | 571 context.drawImage(alphaImage.get(), IntPoint(20, 10), CompositeSourceIn); |
| 572 EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), context.opaqueRegion().asRect()); | 572 EXPECT_EQ_RECT(IntRect(10, 20, 90, 80), context.opaqueRegion().asRect()); |
| 573 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 573 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 574 | 574 |
| 575 context.save(); | 575 context.save(); |
| 576 context.setAlpha(0.5); | 576 context.setAlphaAsFloat(0.5); |
| 577 context.drawImage(opaqueImage.get(), IntPoint(25, 15), CompositeSourceIn); | 577 context.drawImage(opaqueImage.get(), IntPoint(25, 15), CompositeSourceIn); |
| 578 context.restore(); | 578 context.restore(); |
| 579 EXPECT_EQ_RECT(IntRect(10, 25, 90, 75), context.opaqueRegion().asRect()); | 579 EXPECT_EQ_RECT(IntRect(10, 25, 90, 75), context.opaqueRegion().asRect()); |
| 580 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 580 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 581 | 581 |
| 582 context.fillRect(FloatRect(10, 10, 90, 90), opaque, CompositeSourceOver); | 582 context.fillRect(FloatRect(10, 10, 90, 90), opaque, CompositeSourceOver); |
| 583 EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), context.opaqueRegion().asRect()); | 583 EXPECT_EQ_RECT(IntRect(10, 10, 90, 90), context.opaqueRegion().asRect()); |
| 584 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 584 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 585 | 585 |
| 586 context.drawImage(alphaImage.get(), IntPoint(10, 20), CompositeSourceIn); | 586 context.drawImage(alphaImage.get(), IntPoint(10, 20), CompositeSourceIn); |
| 587 EXPECT_EQ_RECT(IntRect(20, 10, 80, 90), context.opaqueRegion().asRect()); | 587 EXPECT_EQ_RECT(IntRect(20, 10, 80, 90), context.opaqueRegion().asRect()); |
| 588 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 588 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 589 | 589 |
| 590 context.save(); | 590 context.save(); |
| 591 context.setAlpha(0.5); | 591 context.setAlphaAsFloat(0.5); |
| 592 context.drawImage(opaqueImage.get(), IntPoint(15, 25), CompositeSourceIn); | 592 context.drawImage(opaqueImage.get(), IntPoint(15, 25), CompositeSourceIn); |
| 593 context.restore(); | 593 context.restore(); |
| 594 EXPECT_EQ_RECT(IntRect(25, 10, 75, 90), context.opaqueRegion().asRect()); | 594 EXPECT_EQ_RECT(IntRect(25, 10, 75, 90), context.opaqueRegion().asRect()); |
| 595 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); | 595 EXPECT_PIXELS_MATCH(bitmap, context.opaqueRegion().asRect()); |
| 596 } | 596 } |
| 597 | 597 |
| 598 TEST(GraphicsContextTest, trackOpaqueOvalTest) | 598 TEST(GraphicsContextTest, trackOpaqueOvalTest) |
| 599 { | 599 { |
| 600 SkBitmap bitmap; | 600 SkBitmap bitmap; |
| 601 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); | 601 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 200, 200); |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1114 controlContext.restore(); | 1114 controlContext.restore(); |
| 1115 context.endRecording(); | 1115 context.endRecording(); |
| 1116 EXPECT_EQ(context.getCTM(), controlContext.getCTM()); | 1116 EXPECT_EQ(context.getCTM(), controlContext.getCTM()); |
| 1117 | 1117 |
| 1118 controlContext.restore(); | 1118 controlContext.restore(); |
| 1119 context.endRecording(); | 1119 context.endRecording(); |
| 1120 EXPECT_EQ(context.getCTM(), controlContext.getCTM()); | 1120 EXPECT_EQ(context.getCTM(), controlContext.getCTM()); |
| 1121 } | 1121 } |
| 1122 | 1122 |
| 1123 } // namespace | 1123 } // namespace |
| OLD | NEW |