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

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

Issue 1638323002: Filx complier issue [-Werror, -Wvla] (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 2016 Google Inc. 2 * Copyright 2016 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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 // Because the DNG SDK can not guarantee to render to requested size, we all ow a small 398 // Because the DNG SDK can not guarantee to render to requested size, we all ow a small
399 // difference. Only the overlapping region will be converted. 399 // difference. Only the overlapping region will be converted.
400 const float maxDiffRatio = 1.03f; 400 const float maxDiffRatio = 1.03f;
401 const dng_point& imageSize = image->Size(); 401 const dng_point& imageSize = image->Size();
402 if (imageSize.h / width > maxDiffRatio || imageSize.h < width || 402 if (imageSize.h / width > maxDiffRatio || imageSize.h < width ||
403 imageSize.v / height > maxDiffRatio || imageSize.v < height) { 403 imageSize.v / height > maxDiffRatio || imageSize.v < height) {
404 return SkCodec::kInvalidScale; 404 return SkCodec::kInvalidScale;
405 } 405 }
406 406
407 void* dstRow = dst; 407 void* dstRow = dst;
408 uint8_t srcRow[width * 3]; 408
409 static const int kStackBytes = 640 * 1024; // Ought to be enough for anybod y.
msarett 2016/01/27 14:51:05 Any reason to not put this on the heap?
yujieqin 2016/01/27 14:53:00 I do not have preference here. Just follow the cod
mtklein 2016/01/27 14:53:32 Sorry, that number was a bit of a joke. How long
yujieqin 2016/01/27 14:57:53 Normally I would think it should be around thousan
msarett 2016/01/27 15:02:14 Let's use this: SkAutoTMalloc<uint8_t> srcRow(widt
yujieqin 2016/01/27 15:16:23 Done.
410 SkAutoSTMalloc<kStackBytes, uint8_t> srcRow(width * 3);
409 411
410 dng_pixel_buffer buffer; 412 dng_pixel_buffer buffer;
411 buffer.fData = &srcRow[0]; 413 buffer.fData = &srcRow[0];
412 buffer.fPlane = 0; 414 buffer.fPlane = 0;
413 buffer.fPlanes = 3; 415 buffer.fPlanes = 3;
414 buffer.fColStep = buffer.fPlanes; 416 buffer.fColStep = buffer.fPlanes;
415 buffer.fPlaneStep = 1; 417 buffer.fPlaneStep = 1;
416 buffer.fPixelType = ttByte; 418 buffer.fPixelType = ttByte;
417 buffer.fPixelSize = sizeof(uint8_t); 419 buffer.fPixelSize = sizeof(uint8_t);
418 buffer.fRowStep = sizeof(srcRow); 420 buffer.fRowStep = sizeof(srcRow);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge)); 468 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge));
467 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge)); 469 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge));
468 return sizeFloor == dim || sizeCeil == dim; 470 return sizeFloor == dim || sizeCeil == dim;
469 } 471 }
470 472
471 SkRawCodec::~SkRawCodec() {} 473 SkRawCodec::~SkRawCodec() {}
472 474
473 SkRawCodec::SkRawCodec(SkDngImage* dngImage) 475 SkRawCodec::SkRawCodec(SkDngImage* dngImage)
474 : INHERITED(dngImage->getImageInfo(), nullptr) 476 : INHERITED(dngImage->getImageInfo(), nullptr)
475 , fDngImage(dngImage) {} 477 , fDngImage(dngImage) {}
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