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

Side by Side Diff: tests/CachedDecodingPixelRefTest.cpp

Issue 111713002: Sk_API for SkImageGenerator and SkInstallDiscardablePixelRef (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 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 | Annotate | Revision Log
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/DrawBitmapRectTest.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"
11 #include "SkDecodingImageGenerator.h" 11 #include "SkDecodingImageGenerator.h"
12 #include "SkDiscardablePixelRef.h"
13 #include "SkDiscardableMemoryPool.h" 12 #include "SkDiscardableMemoryPool.h"
14 #include "SkImageDecoder.h" 13 #include "SkImageDecoder.h"
15 #include "SkCachingPixelRef.h" 14 #include "SkCachingPixelRef.h"
16 #include "SkScaledImageCache.h" 15 #include "SkScaledImageCache.h"
17 #include "SkStream.h" 16 #include "SkStream.h"
18 #include "SkUtils.h" 17 #include "SkUtils.h"
19 18
20 #include "Test.h" 19 #include "Test.h"
21 #include "TestClassDef.h" 20 #include "TestClassDef.h"
22 21
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType)); 249 SkASSERT((pixelRefType >= 0) && (pixelRefType <= kLast_PixelRefType));
251 SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator, 250 SkAutoTDelete<SkImageGenerator> gen(SkNEW_ARGS(TestImageGenerator,
252 (type, reporter))); 251 (type, reporter)));
253 REPORTER_ASSERT(reporter, gen.get() != NULL); 252 REPORTER_ASSERT(reporter, gen.get() != NULL);
254 SkBitmap lazy; 253 SkBitmap lazy;
255 bool success; 254 bool success;
256 if (kSkCaching_PixelRefType == pixelRefType) { 255 if (kSkCaching_PixelRefType == pixelRefType) {
257 // Ignore factory; use global SkScaledImageCache. 256 // Ignore factory; use global SkScaledImageCache.
258 success = SkCachingPixelRef::Install(gen.detach(), &lazy); 257 success = SkCachingPixelRef::Install(gen.detach(), &lazy);
259 } else { 258 } else {
260 success = SkDiscardablePixelRef::Install(gen.detach(), &lazy, factory); 259 success = SkInstallDiscardablePixelRef(gen.detach(), &lazy, factory);
261 } 260 }
262 REPORTER_ASSERT(reporter, success 261 REPORTER_ASSERT(reporter, success
263 == (TestImageGenerator::kFailGetInfo_TestType != type)); 262 == (TestImageGenerator::kFailGetInfo_TestType != type));
264 if (TestImageGenerator::kSucceedGetPixels_TestType == type) { 263 if (TestImageGenerator::kSucceedGetPixels_TestType == type) {
265 CheckTestImageGeneratorBitmap(reporter, lazy); 264 CheckTestImageGeneratorBitmap(reporter, lazy);
266 } else if (TestImageGenerator::kFailGetPixels_TestType == type) { 265 } else if (TestImageGenerator::kFailGetPixels_TestType == type) {
267 SkAutoLockPixels autoLockPixels(lazy); 266 SkAutoLockPixels autoLockPixels(lazy);
268 REPORTER_ASSERT(reporter, NULL == lazy.getPixels()); 267 REPORTER_ASSERT(reporter, NULL == lazy.getPixels());
269 } 268 }
270 } 269 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool(); 301 SkDiscardableMemoryPool* globalPool = SkGetGlobalDiscardableMemoryPool();
303 // Only acts differently from NULL on a platform that has a 302 // Only acts differently from NULL on a platform that has a
304 // default discardable memory implementation that differs from the 303 // default discardable memory implementation that differs from the
305 // global DM pool. 304 // global DM pool.
306 CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType, 305 CheckPixelRef(TestImageGenerator::kFailGetPixels_TestType,
307 reporter, kSkDiscardable_PixelRefType, globalPool); 306 reporter, kSkDiscardable_PixelRefType, globalPool);
308 CheckPixelRef(TestImageGenerator::kSucceedGetPixels_TestType, 307 CheckPixelRef(TestImageGenerator::kSucceedGetPixels_TestType,
309 reporter, kSkDiscardable_PixelRefType, globalPool); 308 reporter, kSkDiscardable_PixelRefType, globalPool);
310 } 309 }
311 //////////////////////////////////////////////////////////////////////////////// 310 ////////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/lazy/SkDiscardablePixelRef.cpp ('k') | tests/DrawBitmapRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698