diff options
Diffstat (limited to 'chromium/cc/paint/oop_pixeltest.cc')
-rw-r--r-- | chromium/cc/paint/oop_pixeltest.cc | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/chromium/cc/paint/oop_pixeltest.cc b/chromium/cc/paint/oop_pixeltest.cc index 6c9f1c1e192..ffc090ebee1 100644 --- a/chromium/cc/paint/oop_pixeltest.cc +++ b/chromium/cc/paint/oop_pixeltest.cc @@ -332,7 +332,7 @@ class OopPixelTest : public testing::Test, raster_source->PlaybackToCanvas( canvas, options.content_size, options.full_raster_rect, options.playback_rect, raster_transform, settings); - surface->flush(); + surface->flushAndSubmit(); EXPECT_EQ(gles2_context_provider_->ContextGL()->GetError(), static_cast<unsigned>(GL_NO_ERROR)); @@ -852,7 +852,7 @@ TEST_P(OopImagePixelTest, DrawImageWithSetMatrix) { display_item_list->StartPaint(); PaintFlags flags; flags.setFilterQuality(FilterQuality()); - display_item_list->push<SetMatrixOp>(SkMatrix::MakeScale(0.5f, 0.5f)); + display_item_list->push<SetMatrixOp>(SkMatrix::Scale(0.5f, 0.5f)); display_item_list->push<DrawImageOp>(paint_image, 0.f, 0.f, &flags); display_item_list->EndPaintOfUnpaired(rect); display_item_list->Finalize(); @@ -1358,6 +1358,39 @@ TEST_F(OopPixelTest, DrawRectScaleTransformOptions) { ExpectEquals(actual, expected); } +TEST_F(OopPixelTest, DrawRectTransformOptionsFullRaster) { + PaintFlags flags; + // Use powers of two here to make floating point blending consistent. + flags.setColor(SkColorSetRGB(64, 128, 32)); + flags.setAntiAlias(true); + gfx::Rect draw_rect(0, 0, 19, 19); + + auto display_item_list = base::MakeRefCounted<DisplayItemList>(); + display_item_list->StartPaint(); + display_item_list->push<DrawRectOp>(gfx::RectToSkRect(draw_rect), flags); + display_item_list->EndPaintOfUnpaired(draw_rect); + display_item_list->Finalize(); + + // The opaque rect above is 1px smaller than the canvas. With the subpixel + // translation, the rect fills the whole canvas, but the pixels at the edges + // are translucent. We should clear the canvas before drawing the rect, so + // the translucent pixels at the edges should not expose the preclear color, + // even if requires_clear is not true. + RasterOptions options; + options.resource_size = {20, 20}; + options.content_size = {25, 25}; + options.full_raster_rect = {5, 5, 20, 20}; + options.playback_rect = {5, 5, 20, 20}; + options.preclear = true; + options.preclear_color = SK_ColorRED; + options.post_translate = {0.5f, 0.25f}; + options.post_scale = 2.f; + + auto actual = Raster(display_item_list, options); + auto expected = RasterExpectedBitmap(display_item_list, options); + ExpectEquals(actual, expected); +} + TEST_F(OopPixelTest, DrawRectQueryMiddleOfDisplayList) { auto display_item_list = base::MakeRefCounted<DisplayItemList>(); std::vector<SkColor> colors = { @@ -1546,12 +1579,12 @@ class OopRecordFilterPixelTest : public OopPixelTest, }; TEST_P(OopRecordFilterPixelTest, FilterWithTextScaled) { - SkMatrix mat = SkMatrix::MakeScale(2.f, 2.f); + SkMatrix mat = SkMatrix::Scale(2.f, 2.f); RunTest(mat); } TEST_P(OopRecordFilterPixelTest, FilterWithTextAndComplexCTM) { - SkMatrix mat = SkMatrix::MakeScale(2.f, 2.f); + SkMatrix mat = SkMatrix::Scale(2.f, 2.f); mat.preSkew(2.f, 2.f); RunTest(mat); } |