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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, | 46 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, |
47 SkMatrix* matrix, | 47 SkMatrix* matrix, |
48 TileMode xy[2]) const OVERRIDE { | 48 TileMode xy[2]) const OVERRIDE { |
49 if (bitmap) | 49 if (bitmap) |
50 *bitmap = bitmap_; | 50 *bitmap = bitmap_; |
51 return SkShader::kDefault_BitmapType; | 51 return SkShader::kDefault_BitmapType; |
52 } | 52 } |
53 | 53 |
54 // Pure virtual implementaiton. | 54 // not indended to return an actual context. Just need to supply this. |
55 virtual SkShader::Context* createContext(const SkBitmap& device, | |
56 const SkPaint& paint, | |
57 const SkMatrix& matrix, | |
58 void* storage) const OVERRIDE { | |
59 return NULL; | |
60 }; | |
61 virtual size_t contextSize() const OVERRIDE { | 55 virtual size_t contextSize() const OVERRIDE { |
62 return sizeof(SkShader::Context); | 56 return sizeof(SkShader::Context); |
63 } | 57 } |
64 | 58 |
65 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); | 59 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); |
66 | 60 |
67 private: | 61 private: |
68 SkBitmap bitmap_; | 62 SkBitmap bitmap_; |
69 }; | 63 }; |
70 | 64 |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 EXPECT_EQ(3u, pixel_refs.size()); | 669 EXPECT_EQ(3u, pixel_refs.size()); |
676 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), | 670 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), |
677 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); | 671 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); |
678 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), | 672 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), |
679 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); | 673 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); |
680 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), | 674 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), |
681 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); | 675 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); |
682 } | 676 } |
683 | 677 |
684 } // namespace skia | 678 } // namespace skia |
OLD | NEW |