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 1719073002: Use new jpeg_crop_scanlines() API to optimize jpeg subset decodes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add to assert Created 4 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
« no previous file with comments | « gyp/codec.gyp ('k') | src/codec/SkJpegCodec.h » ('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 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 "SkCodecPriv.h" 10 #include "SkCodecPriv.h"
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 } 347 }
348 348
349 void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row Bytes, 349 void SkCodec::fillIncompleteImage(const SkImageInfo& info, void* dst, size_t row Bytes,
350 ZeroInitialized zeroInit, int linesRequested, int linesDecoded) { 350 ZeroInitialized zeroInit, int linesRequested, int linesDecoded) {
351 351
352 void* fillDst; 352 void* fillDst;
353 const uint32_t fillValue = this->getFillValue(info.colorType()); 353 const uint32_t fillValue = this->getFillValue(info.colorType());
354 const int linesRemaining = linesRequested - linesDecoded; 354 const int linesRemaining = linesRequested - linesDecoded;
355 SkSampler* sampler = this->getSampler(false); 355 SkSampler* sampler = this->getSampler(false);
356 356
357 int fillWidth = info.width();
358 if (fOptions.fSubset) {
359 fillWidth = fOptions.fSubset->width();
360 }
361
357 switch (this->getScanlineOrder()) { 362 switch (this->getScanlineOrder()) {
358 case kTopDown_SkScanlineOrder: 363 case kTopDown_SkScanlineOrder:
359 case kNone_SkScanlineOrder: { 364 case kNone_SkScanlineOrder: {
360 const SkImageInfo fillInfo = info.makeWH(info.width(), linesRemainin g); 365 const SkImageInfo fillInfo = info.makeWH(fillWidth, linesRemaining);
361 fillDst = SkTAddOffset<void>(dst, linesDecoded * rowBytes); 366 fillDst = SkTAddOffset<void>(dst, linesDecoded * rowBytes);
362 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler) ; 367 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler) ;
363 break; 368 break;
364 } 369 }
365 case kBottomUp_SkScanlineOrder: { 370 case kBottomUp_SkScanlineOrder: {
366 fillDst = dst; 371 fillDst = dst;
367 const SkImageInfo fillInfo = info.makeWH(info.width(), linesRemainin g); 372 const SkImageInfo fillInfo = info.makeWH(fillWidth, linesRemaining);
368 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler) ; 373 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, sampler) ;
369 break; 374 break;
370 } 375 }
371 case kOutOfOrder_SkScanlineOrder: { 376 case kOutOfOrder_SkScanlineOrder: {
372 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested); 377 SkASSERT(1 == linesRequested || this->getInfo().height() == linesReq uested);
373 const SkImageInfo fillInfo = info.makeWH(info.width(), 1); 378 const SkImageInfo fillInfo = info.makeWH(fillWidth, 1);
374 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) { 379 for (int srcY = linesDecoded; srcY < linesRequested; srcY++) {
375 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes); 380 fillDst = SkTAddOffset<void>(dst, this->outputScanline(srcY) * r owBytes);
376 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler); 381 fill_proc(fillInfo, fillDst, rowBytes, fillValue, zeroInit, samp ler);
377 } 382 }
378 break; 383 break;
379 } 384 }
380 } 385 }
381 } 386 }
OLDNEW
« no previous file with comments | « gyp/codec.gyp ('k') | src/codec/SkJpegCodec.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698