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 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, | 45 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, |
46 SkMatrix* matrix, | 46 SkMatrix* matrix, |
47 TileMode xy[2]) const OVERRIDE { | 47 TileMode xy[2]) const OVERRIDE { |
48 if (bitmap) | 48 if (bitmap) |
49 *bitmap = bitmap_; | 49 *bitmap = bitmap_; |
50 return SkShader::kDefault_BitmapType; | 50 return SkShader::kDefault_BitmapType; |
51 } | 51 } |
52 | 52 |
53 // Pure virtual implementaiton. | 53 // Pure virtual implementaiton. |
54 virtual void shadeSpan(int x, int y, SkPMColor[], int count) OVERRIDE {} | 54 virtual SkShader::Context* createContext(const SkBitmap& device, |
| 55 const SkPaint& paint, |
| 56 const SkMatrix& matrix, |
| 57 void* storage) const OVERRIDE { |
| 58 return NULL; |
| 59 }; |
| 60 virtual size_t contextSize() const OVERRIDE { |
| 61 return sizeof(SkShader::Context); |
| 62 } |
| 63 |
55 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); | 64 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); |
56 | 65 |
57 private: | 66 private: |
58 SkBitmap bitmap_; | 67 SkBitmap bitmap_; |
59 }; | 68 }; |
60 | 69 |
61 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { | 70 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { |
62 const SkImageInfo info = { | 71 const SkImageInfo info = { |
63 size.width(), size.height(), kPMColor_SkColorType, kPremul_SkAlphaType | 72 size.width(), size.height(), kPMColor_SkColorType, kPremul_SkAlphaType |
64 }; | 73 }; |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 EXPECT_EQ(3u, pixel_refs.size()); | 673 EXPECT_EQ(3u, pixel_refs.size()); |
665 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), | 674 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), |
666 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); | 675 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); |
667 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), | 676 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), |
668 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); | 677 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); |
669 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), | 678 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), |
670 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); | 679 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); |
671 } | 680 } |
672 | 681 |
673 } // namespace skia | 682 } // namespace skia |
OLD | NEW |