Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: skia/ext/pixel_ref_utils_unittest.cc

Issue 382673002: Fixes for re-enabling more MSVC level 4 warnings: misc edition #2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « jingle/glue/utils.cc ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 namespace { 24 namespace {
25 25
26 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap); 26 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap);
27 27
28 class TestDiscardableShader : public SkShader { 28 class TestDiscardableShader : public SkShader {
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(SkReadBuffer& buffer) : SkShader(buffer) {
35 SkOrderedReadBuffer& buffer =
36 static_cast<SkOrderedReadBuffer&>(flattenable_buffer);
37 SkReader32* reader = buffer.getReader32();
38
39 reader->skip(-4);
40 uint32_t toSkip = reader->readU32();
41 reader->skip(toSkip);
42
43 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_); 35 CreateBitmap(gfx::Size(50, 50), "discardable", &bitmap_);
44 } 36 }
45 37
46 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap, 38 virtual SkShader::BitmapType asABitmap(SkBitmap* bitmap,
47 SkMatrix* matrix, 39 SkMatrix* matrix,
48 TileMode xy[2]) const OVERRIDE { 40 TileMode xy[2]) const OVERRIDE {
49 if (bitmap) 41 if (bitmap)
50 *bitmap = bitmap_; 42 *bitmap = bitmap_;
51 return SkShader::kDefault_BitmapType; 43 return SkShader::kDefault_BitmapType;
52 } 44 }
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 EXPECT_EQ(3u, pixel_refs.size()); 653 EXPECT_EQ(3u, pixel_refs.size());
662 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), 654 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90),
663 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); 655 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect));
664 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), 656 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40),
665 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); 657 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect));
666 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), 658 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145),
667 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); 659 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
668 } 660 }
669 661
670 } // namespace skia 662 } // namespace skia
OLDNEW
« no previous file with comments | « jingle/glue/utils.cc ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698