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

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

Issue 1390213002: Add subsetting to SkScanlineDecoder (Closed) Base URL: https://skia.googlesource.com/skia.git@fill-refactor
Patch Set: Response to comments Created 5 years, 2 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/SkBmpMaskCodec.h ('k') | src/codec/SkBmpRLECodec.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 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 "SkBmpMaskCodec.h" 8 #include "SkBmpMaskCodec.h"
9 #include "SkCodecPriv.h" 9 #include "SkCodecPriv.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts); 53 uint32_t rows = this->decodeRows(dstInfo, dst, dstRowBytes, opts);
54 if (rows != dstInfo.height()) { 54 if (rows != dstInfo.height()) {
55 *rowsDecoded = rows; 55 *rowsDecoded = rows;
56 return kIncompleteInput; 56 return kIncompleteInput;
57 } 57 }
58 return kSuccess; 58 return kSuccess;
59 } 59 }
60 60
61 bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo) { 61 bool SkBmpMaskCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Option s& options) {
62 // Create the swizzler 62 // Create the swizzler
63 fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler( 63 fMaskSwizzler.reset(SkMaskSwizzler::CreateMaskSwizzler(dstInfo, this->getInf o(), fMasks,
64 dstInfo, this->getInfo(), fMasks, this->bitsPerPixel())); 64 this->bitsPerPixel(), options));
65 65
66 if (nullptr == fMaskSwizzler.get()) { 66 if (nullptr == fMaskSwizzler.get()) {
67 return false; 67 return false;
68 } 68 }
69 69
70 return true; 70 return true;
71 } 71 }
72 72
73 SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo, 73 SkCodec::Result SkBmpMaskCodec::prepareToDecode(const SkImageInfo& dstInfo,
74 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo lorCount) { 74 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo lorCount) {
75 // Initialize a the mask swizzler 75 // Initialize a the mask swizzler
76 if (!this->initializeSwizzler(dstInfo)) { 76 if (!this->initializeSwizzler(dstInfo, options)) {
77 SkCodecPrintf("Error: cannot initialize swizzler.\n"); 77 SkCodecPrintf("Error: cannot initialize swizzler.\n");
78 return SkCodec::kInvalidConversion; 78 return SkCodec::kInvalidConversion;
79 } 79 }
80 80
81 return SkCodec::kSuccess; 81 return SkCodec::kSuccess;
82 } 82 }
83 83
84 /* 84 /*
85 * Performs the decoding 85 * Performs the decoding
86 */ 86 */
(...skipping 12 matching lines...) Expand all
99 99
100 // Decode the row in destination format 100 // Decode the row in destination format
101 uint32_t row = this->getDstRow(y, height); 101 uint32_t row = this->getDstRow(y, height);
102 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); 102 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes);
103 fMaskSwizzler->swizzle(dstRow, srcRow); 103 fMaskSwizzler->swizzle(dstRow, srcRow);
104 } 104 }
105 105
106 // Finished decoding the entire image 106 // Finished decoding the entire image
107 return height; 107 return height;
108 } 108 }
OLDNEW
« no previous file with comments | « src/codec/SkBmpMaskCodec.h ('k') | src/codec/SkBmpRLECodec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698