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

Side by Side Diff: tools/SkBitmapRegionCodec.h

Issue 1418093006: Refactor SkBitmapRegionDecoderInterface for Android (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapRegionDecoderInterface.h" 9 #include "SkBitmapRegionDecoderInterface.h"
10 #include "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
11 11
12 /* 12 /*
13 * This class implements SkBitmapRegionDecoder using an SkAndroidCodec. 13 * This class implements SkBitmapRegionDecoder using an SkAndroidCodec.
14 */ 14 */
15 class SkBitmapRegionCodec : public SkBitmapRegionDecoderInterface { 15 class SkBitmapRegionCodec : public SkBitmapRegionDecoderInterface {
16 public: 16 public:
17 17
18 /* 18 /*
19 * Takes ownership of pointer to codec 19 * Takes ownership of pointer to codec
20 */ 20 */
21 SkBitmapRegionCodec(SkAndroidCodec* codec); 21 SkBitmapRegionCodec(SkAndroidCodec* codec);
22 22
23 /* 23 bool prepareRegion(const SkIRect& desiredSubset, int sampleSize,
24 * Three differences from the Android version: 24 SkColorType colorType, bool requireUnpremul, SkImageInfo* outSize) o verride;
25 * Returns a Skia bitmap instead of an Android bitmap.
26 * Android version attempts to reuse a recycled bitmap.
27 * Removed the options object and used parameters for color type and
28 * sample size.
29 */
30 SkBitmap* decodeRegion(int start_x, int start_y, int width, int height,
31 int sampleSize, SkColorType prefColorType) override;
32 25
33 bool conversionSupported(SkColorType colorType) override; 26 bool decodeRegion(SkBitmap& bitmap) override;
34 27
35 private: 28 private:
36 29
37 SkAutoTDelete<SkAndroidCodec> fCodec; 30 SkAutoTDelete<SkAndroidCodec> fCodec;
38 31
32
33 // Fields set by prepareRegion()
34 int fScaledOutX; // Offset of decoded pixels in output bitmap
35 int fScaledOutY; // Offset of decoded pixels in output bitmap
36 SkImageInfo fOutInfo; // Image properties for output bitmap
37 SkImageInfo fDecodeInfo; // Image properties for fCodec
38 int fSampleSize; // Integer downscale factor
39 SkIRect fSubset; // Subset of the original image to decode
40 SubsetType fSubsetType;
41
39 typedef SkBitmapRegionDecoderInterface INHERITED; 42 typedef SkBitmapRegionDecoderInterface INHERITED;
40 43
41 }; 44 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698