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

Side by Side Diff: tests/RecordReplaceDrawTest.cpp

Issue 536003002: Hide fields in SkImageInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix qt Created 6 years, 3 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
« no previous file with comments | « tests/PremulAlphaRoundTripTest.cpp ('k') | tests/SerializationTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #if SK_SUPPORT_GPU 8 #if SK_SUPPORT_GPU
9 9
10 #include "Test.h" 10 #include "Test.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 assert_type<SkRecords::Save>(r, rerecord, 0); 65 assert_type<SkRecords::Save>(r, rerecord, 0);
66 assert_type<SkRecords::Save>(r, rerecord, 1); 66 assert_type<SkRecords::Save>(r, rerecord, 1);
67 assert_type<SkRecords::Restore>(r, rerecord, 2); 67 assert_type<SkRecords::Restore>(r, rerecord, 2);
68 assert_type<SkRecords::Restore>(r, rerecord, 3); 68 assert_type<SkRecords::Restore>(r, rerecord, 3);
69 } 69 }
70 70
71 static SkImage* make_image(SkColor color) { 71 static SkImage* make_image(SkColor color) {
72 const SkPMColor pmcolor = SkPreMultiplyColor(color); 72 const SkPMColor pmcolor = SkPreMultiplyColor(color);
73 const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight); 73 const SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
74 const size_t rowBytes = info.minRowBytes(); 74 const size_t rowBytes = info.minRowBytes();
75 const size_t size = rowBytes * info.fHeight; 75 const size_t size = rowBytes * info.height();
76 76
77 SkAutoMalloc addr(size); 77 SkAutoMalloc addr(size);
78 sk_memset32((SkPMColor*)addr.get(), pmcolor, SkToInt(size >> 2)); 78 sk_memset32((SkPMColor*)addr.get(), pmcolor, SkToInt(size >> 2));
79 79
80 return SkImage::NewRasterCopy(info, addr.get(), rowBytes); 80 return SkImage::NewRasterCopy(info, addr.get(), rowBytes);
81 } 81 }
82 82
83 // Test out the layer replacement functionality with and w/o a BBH 83 // Test out the layer replacement functionality with and w/o a BBH
84 void test_replacements(skiatest::Reporter* r, bool useBBH) { 84 void test_replacements(skiatest::Reporter* r, bool useBBH) {
85 SkRecord record; 85 SkRecord record;
(...skipping 30 matching lines...) Expand all
116 assert_type<SkRecords::Save>(r, rerecord, 0); 116 assert_type<SkRecords::Save>(r, rerecord, 0);
117 assert_type<SkRecords::DrawBitmapRectToRect>(r, rerecord, 1); 117 assert_type<SkRecords::DrawBitmapRectToRect>(r, rerecord, 1);
118 assert_type<SkRecords::DrawRect>(r, rerecord, 2); 118 assert_type<SkRecords::DrawRect>(r, rerecord, 2);
119 assert_type<SkRecords::Restore>(r, rerecord, 3); 119 assert_type<SkRecords::Restore>(r, rerecord, 3);
120 } 120 }
121 121
122 DEF_TEST(RecordReplaceDraw_Replace, r) { test_replacements(r, false); } 122 DEF_TEST(RecordReplaceDraw_Replace, r) { test_replacements(r, false); }
123 DEF_TEST(RecordReplaceDraw_ReplaceWithBBH, r) { test_replacements(r, true); } 123 DEF_TEST(RecordReplaceDraw_ReplaceWithBBH, r) { test_replacements(r, true); }
124 124
125 #endif 125 #endif
OLDNEW
« no previous file with comments | « tests/PremulAlphaRoundTripTest.cpp ('k') | tests/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698