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

Side by Side Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 1372593002: SkInstallDiscardablePixelRef is deprecated, enforce that (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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 | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/KtxTest.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 2013 Google Inc. 2 * Copyright 2013 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 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 } 135 }
136 } 136 }
137 bool comparePixels = (SkImageEncoder::kPNG_Type == type); 137 bool comparePixels = (SkImageEncoder::kPNG_Type == type);
138 compare_bitmaps(reporter, original, lazy, comparePixels); 138 compare_bitmaps(reporter, original, lazy, comparePixels);
139 } 139 }
140 } 140 }
141 141
142 //////////////////////////////////////////////////////////////////////////////// 142 ////////////////////////////////////////////////////////////////////////////////
143 static bool install_skDiscardablePixelRef(SkData* encoded, SkBitmap* dst) { 143 static bool install_skDiscardablePixelRef(SkData* encoded, SkBitmap* dst) {
144 // Use system-default discardable memory. 144 // Use system-default discardable memory.
145 return SkInstallDiscardablePixelRef(encoded, dst); 145 return SkDEPRECATED_InstallDiscardablePixelRef(encoded, dst);
146 } 146 }
147 147
148 //////////////////////////////////////////////////////////////////////////////// 148 ////////////////////////////////////////////////////////////////////////////////
149 /** 149 /**
150 * This checks to see that SkDiscardablePixelRef works as advertised with a 150 * This checks to see that SkDiscardablePixelRef works as advertised with a
151 * SkDecodingImageGenerator. 151 * SkDecodingImageGenerator.
152 */ 152 */
153 DEF_TEST(DecodingImageGenerator, reporter) { 153 DEF_TEST(DecodingImageGenerator, reporter) {
154 test_three_encodings(reporter, install_skDiscardablePixelRef); 154 test_three_encodings(reporter, install_skDiscardablePixelRef);
155 } 155 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 } 221 }
222 REPORTER_ASSERT(reporter, 0 == errors); 222 REPORTER_ASSERT(reporter, 0 == errors);
223 } 223 }
224 224
225 static void check_pixelref(TestImageGenerator::TestType type, 225 static void check_pixelref(TestImageGenerator::TestType type,
226 skiatest::Reporter* reporter, 226 skiatest::Reporter* reporter,
227 SkDiscardableMemory::Factory* factory) { 227 SkDiscardableMemory::Factory* factory) {
228 SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter)); 228 SkAutoTDelete<SkImageGenerator> gen(new TestImageGenerator(type, reporter));
229 REPORTER_ASSERT(reporter, gen.get() != nullptr); 229 REPORTER_ASSERT(reporter, gen.get() != nullptr);
230 SkBitmap lazy; 230 SkBitmap lazy;
231 bool success = SkInstallDiscardablePixelRef(gen.detach(), nullptr, &lazy, fa ctory); 231 bool success = SkDEPRECATED_InstallDiscardablePixelRef(gen.detach(), nullptr , &lazy, factory);
232 232
233 REPORTER_ASSERT(reporter, success); 233 REPORTER_ASSERT(reporter, success);
234 if (TestImageGenerator::kSucceedGetPixels_TestType == type) { 234 if (TestImageGenerator::kSucceedGetPixels_TestType == type) {
235 check_test_image_generator_bitmap(reporter, lazy); 235 check_test_image_generator_bitmap(reporter, lazy);
236 } else if (TestImageGenerator::kFailGetPixels_TestType == type) { 236 } else if (TestImageGenerator::kFailGetPixels_TestType == type) {
237 SkAutoLockPixels autoLockPixels(lazy); 237 SkAutoLockPixels autoLockPixels(lazy);
238 REPORTER_ASSERT(reporter, nullptr == lazy.getPixels()); 238 REPORTER_ASSERT(reporter, nullptr == lazy.getPixels());
239 } 239 }
240 } 240 }
241 241
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 canvas.clear(kDefaultColor); 291 canvas.clear(kDefaultColor);
292 canvas.drawImage(image, 0, 0, nullptr); 292 canvas.drawImage(image, 0, 0, nullptr);
293 if (TestImageGenerator::kSucceedGetPixels_TestType == test) { 293 if (TestImageGenerator::kSucceedGetPixels_TestType == test) {
294 REPORTER_ASSERT( 294 REPORTER_ASSERT(
295 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0)); 295 r, TestImageGenerator::Color() == *bitmap.getAddr32(0, 0));
296 } else { 296 } else {
297 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0)); 297 REPORTER_ASSERT(r, kDefaultColor == bitmap.getColor(0,0));
298 } 298 }
299 } 299 }
300 } 300 }
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/KtxTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698