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

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

Issue 761903003: Update from https://crrev.com/306655 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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
« no previous file with comments | « skia/ext/image_operations_unittest.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(TestDiscardableShader);
51 51
52 private: 52 private:
53 SkBitmap bitmap_; 53 SkBitmap bitmap_;
54 }; 54 };
55 55
56 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
57 SkFlattenable* TestDiscardableShader::CreateProc(SkReadBuffer&) { 56 SkFlattenable* TestDiscardableShader::CreateProc(SkReadBuffer&) {
58 return new TestDiscardableShader; 57 return new TestDiscardableShader;
59 } 58 }
60 #endif
61 59
62 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { 60 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
63 bitmap->allocN32Pixels(size.width(), size.height()); 61 bitmap->allocN32Pixels(size.width(), size.height());
64 bitmap->pixelRef()->setImmutable(); 62 bitmap->pixelRef()->setImmutable();
65 bitmap->pixelRef()->setURI(uri); 63 bitmap->pixelRef()->setURI(uri);
66 } 64 }
67 65
68 SkCanvas* StartRecording(SkPictureRecorder* recorder, gfx::Rect layer_rect) { 66 SkCanvas* StartRecording(SkPictureRecorder* recorder, gfx::Rect layer_rect) {
69 SkCanvas* canvas = 67 SkCanvas* canvas =
70 recorder->beginRecording(layer_rect.width(), layer_rect.height()); 68 recorder->beginRecording(layer_rect.width(), layer_rect.height());
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 EXPECT_EQ(3u, pixel_refs.size()); 656 EXPECT_EQ(3u, pixel_refs.size());
659 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90), 657 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 90, 90),
660 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect)); 658 gfx::SkRectToRectF(pixel_refs[0].pixel_ref_rect));
661 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40), 659 EXPECT_FLOAT_RECT_EQ(gfx::RectF(10, 10, 40, 40),
662 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect)); 660 gfx::SkRectToRectF(pixel_refs[1].pixel_ref_rect));
663 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145), 661 EXPECT_FLOAT_RECT_EQ(gfx::RectF(50, 55, 150, 145),
664 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect)); 662 gfx::SkRectToRectF(pixel_refs[2].pixel_ref_rect));
665 } 663 }
666 664
667 } // namespace skia 665 } // namespace skia
OLDNEW
« no previous file with comments | « skia/ext/image_operations_unittest.cc ('k') | skia/ext/platform_canvas_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698