Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(788)

Side by Side Diff: cc/output/renderer_pixeltest.cc

Issue 1829093002: Use sk_sp-based APIs for SkColorFilter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to reviews Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1299 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 matrix[5] = 0.213f - 0.213f * amount; 1310 matrix[5] = 0.213f - 0.213f * amount;
1311 matrix[6] = 0.715f + 0.285f * amount; 1311 matrix[6] = 0.715f + 0.285f * amount;
1312 matrix[7] = 1.f - (matrix[5] + matrix[6]); 1312 matrix[7] = 1.f - (matrix[5] + matrix[6]);
1313 matrix[8] = matrix[9] = 0; 1313 matrix[8] = matrix[9] = 0;
1314 matrix[10] = 0.213f - 0.213f * amount; 1314 matrix[10] = 0.213f - 0.213f * amount;
1315 matrix[11] = 0.715f - 0.715f * amount; 1315 matrix[11] = 0.715f - 0.715f * amount;
1316 matrix[12] = 1.f - (matrix[10] + matrix[11]); 1316 matrix[12] = 1.f - (matrix[10] + matrix[11]);
1317 matrix[13] = matrix[14] = 0; 1317 matrix[13] = matrix[14] = 0;
1318 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; 1318 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
1319 matrix[18] = 1; 1319 matrix[18] = 1;
1320 skia::RefPtr<SkColorFilter> colorFilter( 1320 sk_sp<SkColorFilter> color_filter =
1321 skia::AdoptRef(SkColorMatrixFilter::Create(matrix))); 1321 SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
1322 skia::RefPtr<SkImageFilter> filter = 1322 skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(
1323 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); 1323 SkColorFilterImageFilter::Create(color_filter.get(), NULL));
1324 FilterOperations filters; 1324 FilterOperations filters;
1325 filters.Append(FilterOperation::CreateReferenceFilter(filter)); 1325 filters.Append(FilterOperation::CreateReferenceFilter(filter));
1326 1326
1327 RenderPassDrawQuad* render_pass_quad = 1327 RenderPassDrawQuad* render_pass_quad =
1328 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); 1328 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
1329 render_pass_quad->SetNew(pass_shared_state, 1329 render_pass_quad->SetNew(pass_shared_state,
1330 pass_rect, 1330 pass_rect,
1331 pass_rect, 1331 pass_rect,
1332 child_pass_id, 1332 child_pass_id,
1333 0, 1333 0,
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 matrix[7] = 1.f - (matrix[5] + matrix[6]); 1549 matrix[7] = 1.f - (matrix[5] + matrix[6]);
1550 matrix[8] = 0; 1550 matrix[8] = 0;
1551 matrix[9] = 200.f; 1551 matrix[9] = 200.f;
1552 matrix[10] = 0.213f - 0.213f * amount; 1552 matrix[10] = 0.213f - 0.213f * amount;
1553 matrix[11] = 0.715f - 0.715f * amount; 1553 matrix[11] = 0.715f - 0.715f * amount;
1554 matrix[12] = 1.f - (matrix[10] + matrix[11]); 1554 matrix[12] = 1.f - (matrix[10] + matrix[11]);
1555 matrix[13] = 0; 1555 matrix[13] = 0;
1556 matrix[14] = 1.5f; 1556 matrix[14] = 1.5f;
1557 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0; 1557 matrix[15] = matrix[16] = matrix[17] = matrix[19] = 0;
1558 matrix[18] = 1; 1558 matrix[18] = 1;
1559 skia::RefPtr<SkColorFilter> colorFilter( 1559 sk_sp<SkColorFilter> color_filter =
1560 skia::AdoptRef(SkColorMatrixFilter::Create(matrix))); 1560 SkColorFilter::MakeMatrixFilterRowMajor255(matrix);
1561 skia::RefPtr<SkImageFilter> filter = 1561 skia::RefPtr<SkImageFilter> filter = skia::AdoptRef(
1562 skia::AdoptRef(SkColorFilterImageFilter::Create(colorFilter.get(), NULL)); 1562 SkColorFilterImageFilter::Create(color_filter.get(), NULL));
1563 FilterOperations filters; 1563 FilterOperations filters;
1564 filters.Append(FilterOperation::CreateReferenceFilter(filter)); 1564 filters.Append(FilterOperation::CreateReferenceFilter(filter));
1565 1565
1566 RenderPassDrawQuad* render_pass_quad = 1566 RenderPassDrawQuad* render_pass_quad =
1567 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>(); 1567 root_pass->CreateAndAppendDrawQuad<RenderPassDrawQuad>();
1568 render_pass_quad->SetNew(pass_shared_state, 1568 render_pass_quad->SetNew(pass_shared_state,
1569 pass_rect, 1569 pass_rect,
1570 pass_rect, 1570 pass_rect,
1571 child_pass_id, 1571 child_pass_id,
1572 0, 1572 0,
(...skipping 1549 matching lines...) Expand 10 before | Expand all | Expand 10 after
3122 3122
3123 EXPECT_TRUE(this->RunPixelTest( 3123 EXPECT_TRUE(this->RunPixelTest(
3124 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")), 3124 &pass_list, base::FilePath(FILE_PATH_LITERAL("spiral.png")),
3125 FuzzyPixelOffByOneComparator(true))); 3125 FuzzyPixelOffByOneComparator(true)));
3126 } 3126 }
3127 3127
3128 #endif // !defined(OS_ANDROID) 3128 #endif // !defined(OS_ANDROID)
3129 3129
3130 } // namespace 3130 } // namespace
3131 } // namespace cc 3131 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698