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

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

Issue 1288483002: Consolidate SkCodec functions for handling rewind (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 {} 49 {}
50 50
51 /* 51 /*
52 * Initiates the bitmap decode 52 * Initiates the bitmap decode
53 */ 53 */
54 SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo, 54 SkCodec::Result SkBmpMaskCodec::onGetPixels(const SkImageInfo& dstInfo,
55 void* dst, size_t dstRowBytes, 55 void* dst, size_t dstRowBytes,
56 const Options& opts, 56 const Options& opts,
57 SkPMColor* inputColorPtr, 57 SkPMColor* inputColorPtr,
58 int* inputColorCount) { 58 int* inputColorCount) {
59 if (!this->handleRewind(false)) { 59 if (!this->rewindIfNeeded()) {
60 return kCouldNotRewind; 60 return kCouldNotRewind;
61 } 61 }
62 if (opts.fSubset) { 62 if (opts.fSubset) {
63 // Subsets are not supported. 63 // Subsets are not supported.
64 return kUnimplemented; 64 return kUnimplemented;
65 } 65 }
66 if (dstInfo.dimensions() != this->getInfo().dimensions()) { 66 if (dstInfo.dimensions() != this->getInfo().dimensions()) {
67 SkCodecPrintf("Error: scaling not supported.\n"); 67 SkCodecPrintf("Error: scaling not supported.\n");
68 return kInvalidScale; 68 return kInvalidScale;
69 } 69 }
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 128
129 // Decode the row in destination format 129 // Decode the row in destination format
130 int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height - 1 - y : y; 130 int row = SkBmpCodec::kBottomUp_RowOrder == this->rowOrder() ? height - 1 - y : y;
131 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes); 131 void* dstRow = SkTAddOffset<void>(dst, row * dstRowBytes);
132 fMaskSwizzler->swizzle(dstRow, srcRow); 132 fMaskSwizzler->swizzle(dstRow, srcRow);
133 } 133 }
134 134
135 // Finished decoding the entire image 135 // Finished decoding the entire image
136 return kSuccess; 136 return kSuccess;
137 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698