OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "cc/test/geometry_test_utils.h" | 7 #include "cc/test/geometry_test_utils.h" |
8 #include "skia/ext/pixel_ref_utils.h" | 8 #include "skia/ext/pixel_ref_utils.h" |
9 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 TestDiscardableShader() { | 29 TestDiscardableShader() { |
30 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); | 30 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); |
31 } | 31 } |
32 | 32 |
33 TestDiscardableShader(SkReadBuffer& buffer) { | 33 TestDiscardableShader(SkReadBuffer& buffer) { |
34 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); | 34 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); |
35 } | 35 } |
36 | 36 |
37 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, | 37 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, |
38 SkMatrix* matrix, | 38 SkMatrix* matrix, |
39 TileMode xy[2]) const OVERRIDE { | 39 TileMode xy[2]) const override { |
40 if (bitmap) | 40 if (bitmap) |
41 *bitmap = bitmap_; | 41 *bitmap = bitmap_; |
42 return SkShader::kDefault_BitmapType; | 42 return SkShader::kDefault_BitmapType; |
43 } | 43 } |
44 | 44 |
45 // not indended to return an actual context. Just need to supply this. | 45 // not indended to return an actual context. Just need to supply this. |
46 virtual size_t contextSize() const OVERRIDE { | 46 virtual size_t contextSize() const override { |
47 return sizeof(SkShader::Context); | 47 return sizeof(SkShader::Context); |
48 } | 48 } |
49 | 49 |
50 virtual void flatten(SkWriteBuffer&) const OVERRIDE {} | 50 virtual void flatten(SkWriteBuffer&) const override {} |
51 | 51 |
52 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); | 52 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); |
53 | 53 |
54 private: | 54 private: |
55 SkBitmap bitmap_; | 55 SkBitmap bitmap_; |
56 }; | 56 }; |
57 | 57 |
58 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING | 58 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
59 SkFlattenable* TestDiscardableShader::CreateProc(SkReadBuffer&) { | 59 SkFlattenable* TestDiscardableShader::CreateProc(SkReadBuffer&) { |
60 return new TestDiscardableShader; | 60 return new TestDiscardableShader; |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
660 EXPECT_EQ(3u, pixel_refs.size()); | 660 EXPECT_EQ(3u, pixel_refs.size()); |
661 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), | 661 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), |
662 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); | 662 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); |
663 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), | 663 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), |
664 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); | 664 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); |
665 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), | 665 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), |
666 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); | 666 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); |
667 } | 667 } |
668 | 668 |
669 } // namespace skia | 669 } // namespace skia |
OLD | NEW |