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

Side by Side Diff: tests/ImageDecodingTest.cpp

Issue 159653004: SkBitmap now really stores SkImageInfo -- config is just a ruse (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | tests/PixelRefTest.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 "SkColor.h" 10 #include "SkColor.h"
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 //////////////////////////////////////////////////////////////////////////////// 326 ////////////////////////////////////////////////////////////////////////////////
327 327
328 // example of how Android will do this inside their BitmapFactory 328 // example of how Android will do this inside their BitmapFactory
329 static SkPixelRef* install_pixel_ref(SkBitmap* bitmap, 329 static SkPixelRef* install_pixel_ref(SkBitmap* bitmap,
330 SkStreamRewindable* stream, 330 SkStreamRewindable* stream,
331 int sampleSize, bool ditherImage) { 331 int sampleSize, bool ditherImage) {
332 SkASSERT(bitmap != NULL); 332 SkASSERT(bitmap != NULL);
333 SkASSERT(stream != NULL); 333 SkASSERT(stream != NULL);
334 SkASSERT(stream->rewind()); 334 SkASSERT(stream->rewind());
335 SkASSERT(stream->unique()); 335 SkASSERT(stream->unique());
336 SkColorType colorType; 336 SkColorType colorType = bitmap->colorType();
337 if (!SkBitmapConfigToColorType(bitmap->config(), &colorType)) {
338 return NULL;
339 }
340 SkDecodingImageGenerator::Options opts(sampleSize, ditherImage, colorType); 337 SkDecodingImageGenerator::Options opts(sampleSize, ditherImage, colorType);
341 SkAutoTDelete<SkImageGenerator> gen( 338 SkAutoTDelete<SkImageGenerator> gen(
342 SkDecodingImageGenerator::Create(stream, opts)); 339 SkDecodingImageGenerator::Create(stream, opts));
343 SkImageInfo info; 340 SkImageInfo info;
344 if ((NULL == gen.get()) || !gen->getInfo(&info)) { 341 if ((NULL == gen.get()) || !gen->getInfo(&info)) {
345 return NULL; 342 return NULL;
346 } 343 }
347 SkDiscardableMemory::Factory* factory = NULL; 344 SkDiscardableMemory::Factory* factory = NULL;
348 if (info.getSafeSize(info.minRowBytes()) < (32 * 1024)) { 345 if (info.getSafeSize(info.minRowBytes()) < (32 * 1024)) {
349 // only use ashmem for large images, since mmaps come at a price 346 // only use ashmem for large images, since mmaps come at a price
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 } 569 }
573 SkDecodingImageGenerator::Options options(scaleList[i], 570 SkDecodingImageGenerator::Options options(scaleList[i],
574 ditherList[j]); 571 ditherList[j]);
575 test_options(reporter, options, encodedStream, encodedData, 572 test_options(reporter, options, encodedStream, encodedData,
576 useDataList[m], path); 573 useDataList[m], path);
577 } 574 }
578 } 575 }
579 } 576 }
580 } 577 }
581 } 578 }
OLDNEW
« no previous file with comments | « src/images/SkDecodingImageGenerator.cpp ('k') | tests/PixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698