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

Side by Side Diff: src/android/SkBitmapRegionCanvas.h

Issue 1513023002: Make BitmapRegionDecoder succeed on invalid requests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update comments Created 5 years 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 | « include/codec/SkAndroidCodec.h ('k') | src/android/SkBitmapRegionCanvas.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 "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkBitmapRegionDecoder.h" 9 #include "SkBitmapRegionDecoder.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
11 11
12 /* 12 /*
13 * This class implements SkBitmapRegionDecoder using an SkCodec and 13 * This class implements SkBitmapRegionDecoder using an SkCodec and
14 * an SkCanvas. It uses the scanline decoder to subset the height. It then 14 * an SkCanvas. It uses the scanline decoder to subset the height. It then
15 * will subset the width and scale by drawing to an SkCanvas. 15 * will subset the width and scale by drawing to an SkCanvas.
16 */ 16 */
17 // FIXME (msarett): This implementation does not support WEBP, because WEBP 17 // FIXME: This class works well as a performance/quality comparison for
18 // does not have a scanline decoder. 18 // SkBitmapRegionCodec, but it lacks several capabilities that are
19 // required by BitmapRegionDecoder in Android.
20 // (1) WEBP decodes - because SkWebpCodec does not have a scanline
21 // decoder.
22 // (2) Decodes to kGray8 and kIndex8.
23 // (3) Decodes to kUnpremul.
24 // (4) Correcting an invalid dstColorType. For example, if the
25 // client requests kRGB_565 for a non-opaque image, rather than
26 // fail, we need to go ahead and decode to kN32.
19 class SkBitmapRegionCanvas : public SkBitmapRegionDecoder { 27 class SkBitmapRegionCanvas : public SkBitmapRegionDecoder {
20 public: 28 public:
21 29
22 /* 30 /*
23 * Takes ownership of pointer to decoder 31 * Takes ownership of pointer to decoder
24 */ 32 */
25 SkBitmapRegionCanvas(SkCodec* decoder); 33 SkBitmapRegionCanvas(SkCodec* decoder);
26 34
27 bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator, 35 bool decodeRegion(SkBitmap* bitmap, SkBRDAllocator* allocator,
28 const SkIRect& desiredSubset, int sampleSize, 36 const SkIRect& desiredSubset, int sampleSize,
29 SkColorType colorType, bool requireUnpremul) override; 37 SkColorType colorType, bool requireUnpremul) override;
30 38
31 bool conversionSupported(SkColorType colorType) override; 39 bool conversionSupported(SkColorType colorType) override;
32 40
33 SkEncodedFormat getEncodedFormat() override { return fDecoder->getEncodedFor mat(); } 41 SkEncodedFormat getEncodedFormat() override { return fDecoder->getEncodedFor mat(); }
34 42
35 private: 43 private:
36 44
37 SkAutoTDelete<SkCodec> fDecoder; 45 SkAutoTDelete<SkCodec> fDecoder;
38 46
39 typedef SkBitmapRegionDecoder INHERITED; 47 typedef SkBitmapRegionDecoder INHERITED;
40 48
41 }; 49 };
OLDNEW
« no previous file with comments | « include/codec/SkAndroidCodec.h ('k') | src/android/SkBitmapRegionCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698