OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "cc/output/gl_renderer.h" | 9 #include "cc/output/gl_renderer.h" |
10 #include "cc/quads/draw_quad.h" | 10 #include "cc/quads/draw_quad.h" |
(...skipping 1371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1382 matrix[5] = 0.213f - 0.213f * amount; | 1382 matrix[5] = 0.213f - 0.213f * amount; |
1383 matrix[6] = 0.715f + 0.285f * amount; | 1383 matrix[6] = 0.715f + 0.285f * amount; |
1384 matrix[7] = 1.f - (matrix[5] + matrix[6]); | 1384 matrix[7] = 1.f - (matrix[5] + matrix[6]); |
1385 matrix[8] = matrix[9] = 0; | 1385 matrix[8] = matrix[9] = 0; |
1386 matrix[10] = 0.213f - 0.213f * amount; | 1386 matrix[10] = 0.213f - 0.213f * amount; |
1387 matrix[11] = 0.715f - 0.715f * amount; | 1387 matrix[11] = 0.715f - 0.715f * amount; |
1388 matrix[12] = 1.f - (matrix[10] + matrix[11]); | 1388 matrix[12] = 1.f - (matrix[10] + matrix[11]); |
1389 matrix[13] = matrix[14] = 0; | 1389 matrix[13] = matrix[14] = 0; |
1390 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; | 1390 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; |
1391 matrix[18] = 1; | 1391 matrix[18] = 1; |
1392 sk_sp<SkColorFilter> color_filter = | |
1393 SkColorFilter::MakeMatrixFilterRowMajor255(matrix); | |
1394 skia::RefPtr<SkImageFilter> filter = skia::AdoptRef( | |
1395 SkColorFilterImageFilter::Create(color_filter.get(), NULL)); | |
1396 FilterOperations filters; | 1392 FilterOperations filters; |
1397 filters.Append(FilterOperation::CreateReferenceFilter(filter)); | 1393 filters.Append( |
| 1394 FilterOperation::CreateReferenceFilter(SkColorFilterImageFilter::Make( |
| 1395 SkColorFilter::MakeMatrixFilterRowMajor255(matrix), NULL))); |
1398 | 1396 |
1399 RenderPassDrawQuad* render_pass_quad = | 1397 RenderPassDrawQuad* render_pass_quad = |
1400 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 1398 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
1401 render_pass_quad->SetNew(pass_shared_state, | 1399 render_pass_quad->SetNew(pass_shared_state, |
1402 pass_rect, | 1400 pass_rect, |
1403 pass_rect, | 1401 pass_rect, |
1404 child_pass_id, | 1402 child_pass_id, |
1405 0, | 1403 0, |
1406 gfx::Vector2dF(), | 1404 gfx::Vector2dF(), |
1407 gfx::Size(), | 1405 gfx::Size(), |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1621 matrix[7] = 1.f - (matrix[5] + matrix[6]); | 1619 matrix[7] = 1.f - (matrix[5] + matrix[6]); |
1622 matrix[8] = 0; | 1620 matrix[8] = 0; |
1623 matrix[9] = 200.f; | 1621 matrix[9] = 200.f; |
1624 matrix[10] = 0.213f - 0.213f * amount; | 1622 matrix[10] = 0.213f - 0.213f * amount; |
1625 matrix[11] = 0.715f - 0.715f * amount; | 1623 matrix[11] = 0.715f - 0.715f * amount; |
1626 matrix[12] = 1.f - (matrix[10] + matrix[11]); | 1624 matrix[12] = 1.f - (matrix[10] + matrix[11]); |
1627 matrix[13] = 0; | 1625 matrix[13] = 0; |
1628 matrix[14] = 1.5f; | 1626 matrix[14] = 1.5f; |
1629 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; | 1627 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; |
1630 matrix[18] = 1; | 1628 matrix[18] = 1; |
1631 sk_sp<SkColorFilter> color_filter = | |
1632 SkColorFilter::MakeMatrixFilterRowMajor255(matrix); | |
1633 skia::RefPtr<SkImageFilter> filter = skia::AdoptRef( | |
1634 SkColorFilterImageFilter::Create(color_filter.get(), NULL)); | |
1635 FilterOperations filters; | 1629 FilterOperations filters; |
1636 filters.Append(FilterOperation::CreateReferenceFilter(filter)); | 1630 filters.Append( |
| 1631 FilterOperation::CreateReferenceFilter(SkColorFilterImageFilter::Make( |
| 1632 SkColorFilter::MakeMatrixFilterRowMajor255(matrix), NULL))); |
1637 | 1633 |
1638 RenderPassDrawQuad* render_pass_quad = | 1634 RenderPassDrawQuad* render_pass_quad = |
1639 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); | 1635 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); |
1640 render_pass_quad->SetNew(pass_shared_state, | 1636 render_pass_quad->SetNew(pass_shared_state, |
1641 pass_rect, | 1637 pass_rect, |
1642 pass_rect, | 1638 pass_rect, |
1643 child_pass_id, | 1639 child_pass_id, |
1644 0, | 1640 0, |
1645 gfx::Vector2dF(), | 1641 gfx::Vector2dF(), |
1646 gfx::Size(), | 1642 gfx::Size(), |
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 std::unique_ptr<RenderPass> pass = | 2558 std::unique_ptr<RenderPass> pass = |
2563 CreateTestRenderPass(id, viewport, transform_to_root); | 2559 CreateTestRenderPass(id, viewport, transform_to_root); |
2564 | 2560 |
2565 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(2, 2); | 2561 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(2, 2); |
2566 ASSERT_NE(surface, nullptr); | 2562 ASSERT_NE(surface, nullptr); |
2567 SkCanvas* canvas = surface->getCanvas(); | 2563 SkCanvas* canvas = surface->getCanvas(); |
2568 canvas->drawPoint(0, 0, SK_ColorGREEN); | 2564 canvas->drawPoint(0, 0, SK_ColorGREEN); |
2569 canvas->drawPoint(0, 1, SK_ColorBLUE); | 2565 canvas->drawPoint(0, 1, SK_ColorBLUE); |
2570 canvas->drawPoint(1, 0, SK_ColorBLUE); | 2566 canvas->drawPoint(1, 0, SK_ColorBLUE); |
2571 canvas->drawPoint(1, 1, SK_ColorGREEN); | 2567 canvas->drawPoint(1, 1, SK_ColorGREEN); |
2572 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); | 2568 sk_sp<SkImage> image = surface->makeImageSnapshot(); |
2573 | 2569 |
2574 std::unique_ptr<FakeRecordingSource> recording = | 2570 std::unique_ptr<FakeRecordingSource> recording = |
2575 FakeRecordingSource::CreateFilledRecordingSource(viewport.size()); | 2571 FakeRecordingSource::CreateFilledRecordingSource(viewport.size()); |
2576 SkPaint paint; | 2572 SkPaint paint; |
2577 paint.setFilterQuality(kLow_SkFilterQuality); | 2573 paint.setFilterQuality(kLow_SkFilterQuality); |
2578 recording->add_draw_image_with_paint(image.get(), gfx::Point(), paint); | 2574 recording->add_draw_image_with_paint(image.get(), gfx::Point(), paint); |
2579 recording->Rerecord(); | 2575 recording->Rerecord(); |
2580 scoped_refptr<FakeRasterSource> raster_source = | 2576 scoped_refptr<FakeRasterSource> raster_source = |
2581 FakeRasterSource::CreateFromRecordingSource(recording.get(), false); | 2577 FakeRasterSource::CreateFromRecordingSource(recording.get(), false); |
2582 | 2578 |
(...skipping 28 matching lines...) Expand all Loading... |
2611 std::unique_ptr<RenderPass> pass = | 2607 std::unique_ptr<RenderPass> pass = |
2612 CreateTestRenderPass(id, viewport, transform_to_root); | 2608 CreateTestRenderPass(id, viewport, transform_to_root); |
2613 | 2609 |
2614 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(2, 2); | 2610 sk_sp<SkSurface> surface = SkSurface::MakeRasterN32Premul(2, 2); |
2615 ASSERT_NE(surface, nullptr); | 2611 ASSERT_NE(surface, nullptr); |
2616 SkCanvas* canvas = surface->getCanvas(); | 2612 SkCanvas* canvas = surface->getCanvas(); |
2617 canvas->drawPoint(0, 0, SK_ColorGREEN); | 2613 canvas->drawPoint(0, 0, SK_ColorGREEN); |
2618 canvas->drawPoint(0, 1, SK_ColorBLUE); | 2614 canvas->drawPoint(0, 1, SK_ColorBLUE); |
2619 canvas->drawPoint(1, 0, SK_ColorBLUE); | 2615 canvas->drawPoint(1, 0, SK_ColorBLUE); |
2620 canvas->drawPoint(1, 1, SK_ColorGREEN); | 2616 canvas->drawPoint(1, 1, SK_ColorGREEN); |
2621 skia::RefPtr<SkImage> image = skia::AdoptRef(surface->newImageSnapshot()); | 2617 sk_sp<SkImage> image = surface->makeImageSnapshot(); |
2622 | 2618 |
2623 std::unique_ptr<FakeRecordingSource> recording = | 2619 std::unique_ptr<FakeRecordingSource> recording = |
2624 FakeRecordingSource::CreateFilledRecordingSource(viewport.size()); | 2620 FakeRecordingSource::CreateFilledRecordingSource(viewport.size()); |
2625 SkPaint paint; | 2621 SkPaint paint; |
2626 paint.setFilterQuality(kLow_SkFilterQuality); | 2622 paint.setFilterQuality(kLow_SkFilterQuality); |
2627 recording->add_draw_image_with_paint(image.get(), gfx::Point(), paint); | 2623 recording->add_draw_image_with_paint(image.get(), gfx::Point(), paint); |
2628 recording->Rerecord(); | 2624 recording->Rerecord(); |
2629 scoped_refptr<FakeRasterSource> raster_source = | 2625 scoped_refptr<FakeRasterSource> raster_source = |
2630 FakeRasterSource::CreateFromRecordingSource(recording.get(), false); | 2626 FakeRasterSource::CreateFromRecordingSource(recording.get(), false); |
2631 | 2627 |
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3176 | 3172 |
3177 EXPECT_TRUE(this->RunPixelTest( | 3173 EXPECT_TRUE(this->RunPixelTest( |
3178 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), | 3174 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), |
3179 FuzzyPixelOffByOneComparator(true))); | 3175 FuzzyPixelOffByOneComparator(true))); |
3180 } | 3176 } |
3181 | 3177 |
3182 #endif // !defined(OS_ANDROID) | 3178 #endif // !defined(OS_ANDROID) |
3183 | 3179 |
3184 } // namespace | 3180 } // namespace |
3185 } // namespace cc | 3181 } // namespace cc |
OLD | NEW |