| 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 29 matching lines...) Expand all Loading... |
| 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 size_t contextSize() const override { return sizeof(SkShader::Context); } | 46 size_t contextSize() const override { return sizeof(SkShader::Context); } |
| 47 | 47 |
| 48 void flatten(SkWriteBuffer&) const override {} | 48 void flatten(SkWriteBuffer&) const override {} |
| 49 | 49 |
| 50 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader); | 50 // Manual expansion of SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS to |
| 51 // satisfy Chrome's style checker, since Skia isn't ready to make the C++11 |
| 52 // leap yet. |
| 53 private: |
| 54 static SkFlattenable* CreateProc(SkReadBuffer&); |
| 55 friend class SkPrivateEffectInitializer; |
| 56 |
| 57 public: |
| 58 Factory getFactory() const override { return CreateProc; } |
| 51 | 59 |
| 52 private: | 60 private: |
| 53 SkBitmap bitmap_; | 61 SkBitmap bitmap_; |
| 54 }; | 62 }; |
| 55 | 63 |
| 56 SkFlattenable* TestDiscardableShader::CreateProc(SkReadBuffer&) { | 64 SkFlattenable* TestDiscardableShader::CreateProc(SkReadBuffer&) { |
| 57 return new TestDiscardableShader; | 65 return new TestDiscardableShader; |
| 58 } | 66 } |
| 59 | 67 |
| 60 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { | 68 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { |
| (...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 EXPECT_EQ(3u, pixel_refs.size()); | 664 EXPECT_EQ(3u, pixel_refs.size()); |
| 657 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), | 665 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), |
| 658 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); | 666 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); |
| 659 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), | 667 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), |
| 660 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); | 668 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); |
| 661 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), | 669 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), |
| 662 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); | 670 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); |
| 663 } | 671 } |
| 664 | 672 |
| 665 } // namespace skia | 673 } // namespace skia |
| OLD | NEW |