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

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

Issue 1918873002: Remove SkEncodedInfo kUnknown_Color and kUnknown_Alpha from public API (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix errors Created 4 years, 7 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 | « src/codec/SkPngCodec.cpp ('k') | src/codec/SkWebpCodec.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 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 if (!is_valid_endian_marker(header, &littleEndian)) { 549 if (!is_valid_endian_marker(header, &littleEndian)) {
550 return false; 550 return false;
551 } 551 }
552 552
553 return 0x2A == get_endian_short(header + 2, littleEndian); 553 return 0x2A == get_endian_short(header + 2, littleEndian);
554 } 554 }
555 555
556 void init(int width, int height, const dng_point& cfaPatternSize) { 556 void init(int width, int height, const dng_point& cfaPatternSize) {
557 fWidth = width; 557 fWidth = width;
558 fHeight = height; 558 fHeight = height;
559 fEncodedInfo = SkEncodedInfo::Make(SkEncodedInfo::kRGB_Color,
560 SkEncodedInfo::kOpaque_Alpha, 8);
561 559
562 // The DNG SDK scales only during demosaicing, so scaling is only possib le when 560 // The DNG SDK scales only during demosaicing, so scaling is only possib le when
563 // a mosaic info is available. 561 // a mosaic info is available.
564 fIsScalable = cfaPatternSize.v != 0 && cfaPatternSize.h != 0; 562 fIsScalable = cfaPatternSize.v != 0 && cfaPatternSize.h != 0;
565 fIsXtransImage = fIsScalable ? (cfaPatternSize.v == 6 && cfaPatternSize. h == 6) : false; 563 fIsXtransImage = fIsScalable ? (cfaPatternSize.v == 6 && cfaPatternSize. h == 6) : false;
566 } 564 }
567 565
568 bool initFromPiex() { 566 bool initFromPiex() {
569 // Does not take the ownership of rawStream. 567 // Does not take the ownership of rawStream.
570 SkPiexStream piexStream(fStream.get()); 568 SkPiexStream piexStream(fStream.get());
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 this->init(static_cast<int>(fNegative->DefaultCropSizeH().As_real64( )), 609 this->init(static_cast<int>(fNegative->DefaultCropSizeH().As_real64( )),
612 static_cast<int>(fNegative->DefaultCropSizeV().As_real64( )), 610 static_cast<int>(fNegative->DefaultCropSizeV().As_real64( )),
613 cfaPatternSize); 611 cfaPatternSize);
614 return true; 612 return true;
615 } catch (...) { 613 } catch (...) {
616 return false; 614 return false;
617 } 615 }
618 } 616 }
619 617
620 SkDngImage(SkRawStream* stream) 618 SkDngImage(SkRawStream* stream)
621 : fStream(stream) {} 619 : fStream(stream)
620 , fEncodedInfo(SkEncodedInfo::Make(SkEncodedInfo::kRGB_Color,
621 SkEncodedInfo::kOpaque_Alpha, 8))
622 {}
622 623
623 SkDngMemoryAllocator fAllocator; 624 SkDngMemoryAllocator fAllocator;
624 SkAutoTDelete<SkRawStream> fStream; 625 SkAutoTDelete<SkRawStream> fStream;
625 SkAutoTDelete<dng_host> fHost; 626 SkAutoTDelete<dng_host> fHost;
626 SkAutoTDelete<dng_info> fInfo; 627 SkAutoTDelete<dng_info> fInfo;
627 SkAutoTDelete<dng_negative> fNegative; 628 SkAutoTDelete<dng_negative> fNegative;
628 SkAutoTDelete<dng_stream> fDngStream; 629 SkAutoTDelete<dng_stream> fDngStream;
629 630
630 int fWidth; 631 int fWidth;
631 int fHeight; 632 int fHeight;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge)); 773 SkISize sizeFloor = this->onGetScaledDimensions(1.f / std::floor(fullShortEd ge / shortEdge));
773 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge)); 774 SkISize sizeCeil = this->onGetScaledDimensions(1.f / std::ceil(fullShortEdge / shortEdge));
774 return sizeFloor == dim || sizeCeil == dim; 775 return sizeFloor == dim || sizeCeil == dim;
775 } 776 }
776 777
777 SkRawCodec::~SkRawCodec() {} 778 SkRawCodec::~SkRawCodec() {}
778 779
779 SkRawCodec::SkRawCodec(SkDngImage* dngImage) 780 SkRawCodec::SkRawCodec(SkDngImage* dngImage)
780 : INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo( ), nullptr) 781 : INHERITED(dngImage->width(), dngImage->height(), dngImage->getEncodedInfo( ), nullptr)
781 , fDngImage(dngImage) {} 782 , fDngImage(dngImage) {}
OLDNEW
« no previous file with comments | « src/codec/SkPngCodec.cpp ('k') | src/codec/SkWebpCodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698