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

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

Issue 1728553002: Use new API instead of the deprecated ones (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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 | « 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 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 } else { 565 } else {
566 rawStream.reset(new SkRawBufferedStream(stream)); 566 rawStream.reset(new SkRawBufferedStream(stream));
567 } 567 }
568 568
569 // Does not take the ownership of rawStream. 569 // Does not take the ownership of rawStream.
570 SkPiexStream piexStream(rawStream.get()); 570 SkPiexStream piexStream(rawStream.get());
571 ::piex::PreviewImageData imageData; 571 ::piex::PreviewImageData imageData;
572 if (::piex::IsRaw(&piexStream)) { 572 if (::piex::IsRaw(&piexStream)) {
573 ::piex::Error error = ::piex::GetPreviewImageData(&piexStream, &imageDat a); 573 ::piex::Error error = ::piex::GetPreviewImageData(&piexStream, &imageDat a);
574 574
575 if (error == ::piex::Error::kOk && imageData.preview_length > 0) { 575 if (error == ::piex::Error::kOk && imageData.preview.length > 0) {
scroggo 2016/02/23 15:55:23 Unfortunately, this will mean that we need to upda
576 #if !defined(GOOGLE3) 576 #if !defined(GOOGLE3)
577 // transferBuffer() is destructive to the rawStream. Abandon the raw Stream after this 577 // transferBuffer() is destructive to the rawStream. Abandon the raw Stream after this
578 // function call. 578 // function call.
579 // FIXME: one may avoid the copy of memoryStream and use the buffere d rawStream. 579 // FIXME: one may avoid the copy of memoryStream and use the buffere d rawStream.
580 SkMemoryStream* memoryStream = 580 SkMemoryStream* memoryStream =
581 rawStream->transferBuffer(imageData.preview_offset, imageData.pr eview_length); 581 rawStream->transferBuffer(imageData.preview.offset, imageData.pr eview.length);
582 return memoryStream ? SkJpegCodec::NewFromStream(memoryStream) : nul lptr; 582 return memoryStream ? SkJpegCodec::NewFromStream(memoryStream) : nul lptr;
583 #else 583 #else
584 return nullptr; 584 return nullptr;
585 #endif 585 #endif
586 } else if (error == ::piex::Error::kFail) { 586 } else if (error == ::piex::Error::kFail) {
587 return nullptr; 587 return nullptr;
588 } 588 }
589 } 589 }
590 590
591 // Takes the ownership of the rawStream. 591 // Takes the ownership of the rawStream.
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge)); 688 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge));
689 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge)); 689 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge));
690 return sizeFloor == dim || sizeCeil == dim; 690 return sizeFloor == dim || sizeCeil == dim;
691 } 691 }
692 692
693 SkRawCodec::~SkRawCodec() {} 693 SkRawCodec::~SkRawCodec() {}
694 694
695 SkRawCodec::SkRawCodec(SkDngImage* dngImage) 695 SkRawCodec::SkRawCodec(SkDngImage* dngImage)
696 : INHERITED(dngImage->getImageInfo(), nullptr) 696 : INHERITED(dngImage->getImageInfo(), nullptr)
697 , fDngImage(dngImage) {} 697 , 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