| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 | 6 |
| 7 #include "cc/output/filter_operations.h" | 7 #include "cc/paint/filter_operations.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "third_party/skia/include/effects/SkBlurImageFilter.h" | 9 #include "third_party/skia/include/effects/SkBlurImageFilter.h" |
| 10 #include "third_party/skia/include/effects/SkDropShadowImageFilter.h" | 10 #include "third_party/skia/include/effects/SkDropShadowImageFilter.h" |
| 11 #include "third_party/skia/include/effects/SkOffsetImageFilter.h" | 11 #include "third_party/skia/include/effects/SkOffsetImageFilter.h" |
| 12 #include "third_party/skia/include/effects/SkXfermodeImageFilter.h" | 12 #include "third_party/skia/include/effects/SkXfermodeImageFilter.h" |
| 13 #include "ui/gfx/geometry/point.h" | 13 #include "ui/gfx/geometry/point.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 | 15 |
| 16 namespace cc { | 16 namespace cc { |
| 17 namespace { | 17 namespace { |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 SAVE_RESTORE_AMOUNT(Grayscale, GRAYSCALE, 0.6f); | 389 SAVE_RESTORE_AMOUNT(Grayscale, GRAYSCALE, 0.6f); |
| 390 SAVE_RESTORE_AMOUNT(Sepia, SEPIA, 0.6f); | 390 SAVE_RESTORE_AMOUNT(Sepia, SEPIA, 0.6f); |
| 391 SAVE_RESTORE_AMOUNT(Saturate, SATURATE, 0.6f); | 391 SAVE_RESTORE_AMOUNT(Saturate, SATURATE, 0.6f); |
| 392 SAVE_RESTORE_AMOUNT(HueRotate, HUE_ROTATE, 0.6f); | 392 SAVE_RESTORE_AMOUNT(HueRotate, HUE_ROTATE, 0.6f); |
| 393 SAVE_RESTORE_AMOUNT(Invert, INVERT, 0.6f); | 393 SAVE_RESTORE_AMOUNT(Invert, INVERT, 0.6f); |
| 394 SAVE_RESTORE_AMOUNT(Brightness, BRIGHTNESS, 0.6f); | 394 SAVE_RESTORE_AMOUNT(Brightness, BRIGHTNESS, 0.6f); |
| 395 SAVE_RESTORE_AMOUNT(Contrast, CONTRAST, 0.6f); | 395 SAVE_RESTORE_AMOUNT(Contrast, CONTRAST, 0.6f); |
| 396 SAVE_RESTORE_AMOUNT(Opacity, OPACITY, 0.6f); | 396 SAVE_RESTORE_AMOUNT(Opacity, OPACITY, 0.6f); |
| 397 SAVE_RESTORE_AMOUNT(Blur, BLUR, 0.6f); | 397 SAVE_RESTORE_AMOUNT(Blur, BLUR, 0.6f); |
| 398 SAVE_RESTORE_AMOUNT(SaturatingBrightness, SATURATING_BRIGHTNESS, 0.6f); | 398 SAVE_RESTORE_AMOUNT(SaturatingBrightness, SATURATING_BRIGHTNESS, 0.6f); |
| 399 SAVE_RESTORE_OFFSET_AMOUNT_COLOR( | 399 SAVE_RESTORE_OFFSET_AMOUNT_COLOR(DropShadow, DROP_SHADOW, gfx::Point(3, 4), |
| 400 DropShadow, DROP_SHADOW, gfx::Point(3, 4), 0.4f, 0xffffff00); | 400 0.4f, 0xffffff00); |
| 401 | 401 |
| 402 SkScalar matrix[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, | 402 SkScalar matrix[20] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, |
| 403 17, 18, 19, 20}; | 403 11, 12, 13, 14, 15, 16, 17, 18, 19, 20}; |
| 404 SAVE_RESTORE_MATRIX(ColorMatrix, COLOR_MATRIX, matrix); | 404 SAVE_RESTORE_MATRIX(ColorMatrix, COLOR_MATRIX, matrix); |
| 405 | 405 |
| 406 SAVE_RESTORE_AMOUNT_INSET(Zoom, ZOOM, 0.5f, 32); | 406 SAVE_RESTORE_AMOUNT_INSET(Zoom, ZOOM, 0.5f, 32); |
| 407 } | 407 } |
| 408 | 408 |
| 409 TEST(FilterOperationsTest, BlendGrayscaleFilters) { | 409 TEST(FilterOperationsTest, BlendGrayscaleFilters) { |
| 410 FilterOperation from = FilterOperation::CreateGrayscaleFilter(0.25f); | 410 FilterOperation from = FilterOperation::CreateGrayscaleFilter(0.25f); |
| 411 FilterOperation to = FilterOperation::CreateGrayscaleFilter(0.75f); | 411 FilterOperation to = FilterOperation::CreateGrayscaleFilter(0.75f); |
| 412 | 412 |
| 413 FilterOperation blended = FilterOperation::Blend(&from, &to, -0.75); | 413 FilterOperation blended = FilterOperation::Blend(&from, &to, -0.75); |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 970 | 970 |
| 971 filters.Append(FilterOperation::CreateSaturateFilter(3.f)); | 971 filters.Append(FilterOperation::CreateSaturateFilter(3.f)); |
| 972 filters.Append(FilterOperation::CreateBlurFilter(2.f)); | 972 filters.Append(FilterOperation::CreateBlurFilter(2.f)); |
| 973 EXPECT_EQ(std::string("{\"FilterOperations\":[{\"amount\":3.0,\"type\":2}," | 973 EXPECT_EQ(std::string("{\"FilterOperations\":[{\"amount\":3.0,\"type\":2}," |
| 974 "{\"amount\":2.0,\"type\":8}]}"), | 974 "{\"amount\":2.0,\"type\":8}]}"), |
| 975 filters.ToString()); | 975 filters.ToString()); |
| 976 } | 976 } |
| 977 | 977 |
| 978 } // namespace | 978 } // namespace |
| 979 } // namespace cc | 979 } // namespace cc |
| OLD | NEW |