OLD | NEW |
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 "SkBitmapRegionCanvas.h" | 8 #include "SkBitmapRegionCanvas.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkScanlineDecoder.h" | |
11 | 10 |
12 SkBitmapRegionCanvas::SkBitmapRegionCanvas(SkScanlineDecoder* decoder) | 11 SkBitmapRegionCanvas::SkBitmapRegionCanvas(SkCodec* decoder) |
13 : INHERITED(decoder->getInfo().width(), decoder->getInfo().height()) | 12 : INHERITED(decoder->getInfo().width(), decoder->getInfo().height()) |
14 , fDecoder(decoder) | 13 , fDecoder(decoder) |
15 {} | 14 {} |
16 | 15 |
17 /* | 16 /* |
18 * Chooses the correct image subset offsets and dimensions for the partial decod
e. | 17 * Chooses the correct image subset offsets and dimensions for the partial decod
e. |
19 */ | 18 */ |
20 static inline void set_subset_region(int inputOffset, int inputDimension, | 19 static inline void set_subset_region(int inputOffset, int inputDimension, |
21 int imageOriginalDimension, int* imageSubsetOffset, int* outOffset, | 20 int imageOriginalDimension, int* imageSubsetOffset, int* outOffset, |
22 int* imageSubsetDimension) { | 21 int* imageSubsetDimension) { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 (SkScalar) get_scaled_dimension(imageSubsetWidth, sampleSize), | 179 (SkScalar) get_scaled_dimension(imageSubsetWidth, sampleSize), |
181 (SkScalar) get_scaled_dimension(imageSubsetHeight, sampleSize)); | 180 (SkScalar) get_scaled_dimension(imageSubsetHeight, sampleSize)); |
182 SkPaint paint; | 181 SkPaint paint; |
183 // Overwrite the dst with the src pixels | 182 // Overwrite the dst with the src pixels |
184 paint.setXfermodeMode(SkXfermode::kSrc_Mode); | 183 paint.setXfermodeMode(SkXfermode::kSrc_Mode); |
185 // TODO (msarett): Test multiple filter qualities. kNone is the default. | 184 // TODO (msarett): Test multiple filter qualities. kNone is the default. |
186 canvas.drawBitmapRect(tmp, src, dst, &paint); | 185 canvas.drawBitmapRect(tmp, src, dst, &paint); |
187 | 186 |
188 return bitmap.detach(); | 187 return bitmap.detach(); |
189 } | 188 } |
OLD | NEW |