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 public: | 29 public: |
30 TestDiscardableShader() { | 30 TestDiscardableShader() { |
31 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); | 31 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); |
32 } | 32 } |
33 | 33 |
34 TestDiscardableShader(SkFlattenableReadBuffer& flattenable_buffer) { | 34 TestDiscardableShader(SkFlattenableReadBuffer& flattenable_buffer) { |
35 SkOrderedReadBuffer& buffer = | 35 SkOrderedReadBuffer& buffer = |
36 static_cast<SkOrderedReadBuffer&>(flattenable_buffer); | 36 static_cast<SkOrderedReadBuffer&>(flattenable_buffer); |
37 SkReader32* reader = buffer.getReader32(); | 37 SkReader32* reader = buffer.getReader32(); |
38 | 38 |
39 reader->skip(-4); | 39 reader->skip(static_cast<size_t>(-4)); //!!? Is this safe? |
Peter Kasting
2014/07/09 22:19:54
This needs review. Static-casting a negative valu
Stephen White
2014/07/10 02:13:56
+vmpstr +junov
Much of this code looks dubious. S
| |
40 uint32_t toSkip = reader->readU32(); | 40 uint32_t toSkip = reader->readU32(); |
41 reader->skip(toSkip); | 41 reader->skip(toSkip); |
42 | 42 |
43 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); | 43 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); |
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) |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 EXPECT_EQ(3u, pixel_refs.size()); | 661 EXPECT_EQ(3u, pixel_refs.size()); |
662 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), | 662 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), |
663 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); | 663 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); |
664 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), | 664 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), |
665 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); | 665 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); |
666 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), | 666 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), |
667 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); | 667 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); |
668 } | 668 } |
669 | 669 |
670 } // namespace skia | 670 } // namespace skia |
OLD | NEW |