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

Side by Side Diff: src/codec/SkCodec.cpp

Issue 1188223002: Improved subset benchmarks (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 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 "SkBmpCodec.h" 8 #include "SkBmpCodec.h"
9 #include "SkCodec.h" 9 #include "SkCodec.h"
10 #include "SkCodec_libpng.h" 10 #include "SkCodec_libpng.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 codec.reset(SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReade r)); 83 codec.reset(SkPngCodec::NewFromStream(streamDeleter.detach(), chunkReade r));
84 } else { 84 } else {
85 for (DecoderProc proc : gDecoderProcs) { 85 for (DecoderProc proc : gDecoderProcs) {
86 if (proc.IsFormat(buffer, bytesRead)) { 86 if (proc.IsFormat(buffer, bytesRead)) {
87 codec.reset(proc.NewFromStream(streamDeleter.detach())); 87 codec.reset(proc.NewFromStream(streamDeleter.detach()));
88 break; 88 break;
89 } 89 }
90 } 90 }
91 } 91 }
92 92
93 // Set the max size at 128 megapixels (512 MB for kN32). 93 return codec.detach();
94 // This is about 4x smaller than a test image that takes a few minutes for
95 // dm to decode and draw.
96 const int32_t maxSize = 1 << 27;
97 if (codec && codec->getInfo().width() * codec->getInfo().height() > maxSize) {
98 SkCodecPrintf("Error: Image size too large, cannot decode.\n");
99 return nullptr;
100 } else {
101 return codec.detach();
102 }
103 } 94 }
104 95
105 SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) { 96 SkCodec* SkCodec::NewFromData(SkData* data, SkPngChunkReader* reader) {
106 if (!data) { 97 if (!data) {
107 return nullptr; 98 return nullptr;
108 } 99 }
109 return NewFromStream(new SkMemoryStream(data), reader); 100 return NewFromStream(new SkMemoryStream(data), reader);
110 } 101 }
111 102
112 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream) 103 SkCodec::SkCodec(const SkImageInfo& info, SkStream* stream)
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested); 368 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested);
378 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); 369 const SkImageInfo fillInfo = info.makeWH(info.width(), 1);
379 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { 370 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) {
380 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes); 371 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes);
381 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler); 372 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler);
382 } 373 }
383 break; 374 break;
384 } 375 }
385 } 376 }
386 } 377 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698