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

Side by Side Diff: tests/ImageTest.cpp

Issue 1266143003: lock pixels in image when bitmap is immutable and not-lazy (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkData.h" 9 #include "SkData.h"
10 #include "SkDevice.h" 10 #include "SkDevice.h"
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) { 238 for (size_t i = 0; i < SK_ARRAY_COUNT(rec); ++i) {
239 SkBitmap bm; 239 SkBitmap bm;
240 rec[i].fMakeProc(&bm); 240 rec[i].fMakeProc(&bm);
241 241
242 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bm)); 242 SkAutoTUnref<SkImage> image(SkImage::NewFromBitmap(bm));
243 SkPixmap pmap; 243 SkPixmap pmap;
244 244
245 const bool sharedID = (image->uniqueID() == bm.getGenerationID()); 245 const bool sharedID = (image->uniqueID() == bm.getGenerationID());
246 REPORTER_ASSERT(reporter, sharedID == rec[i].fExpectSharedID); 246 REPORTER_ASSERT(reporter, sharedID == rec[i].fExpectSharedID);
247 247
248 #if 0 // TODO: fix so that peek will succeed in the immutable case
249 const bool peekSuccess = image->peekPixels(&pmap); 248 const bool peekSuccess = image->peekPixels(&pmap);
250 REPORTER_ASSERT(reporter, peekSuccess == rec[i].fExpectPeekSuccess); 249 REPORTER_ASSERT(reporter, peekSuccess == rec[i].fExpectPeekSuccess);
251 #endif
252 } 250 }
253 } 251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698