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

Side by Side Diff: src/images/SkScaledBitmapSampler.h

Issue 321873003: Add sampler options to SkScaledBitmapSampler (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Simply SamplerOptions -> Options Created 6 years, 6 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 | « no previous file | src/images/SkScaledBitmapSampler.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #ifndef SkScaledBitmapSampler_DEFINED 8 #ifndef SkScaledBitmapSampler_DEFINED
9 #define SkScaledBitmapSampler_DEFINED 9 #define SkScaledBitmapSampler_DEFINED
10 10
(...skipping 16 matching lines...) Expand all
27 27
28 enum SrcConfig { 28 enum SrcConfig {
29 kGray, // 1 byte per pixel 29 kGray, // 1 byte per pixel
30 kIndex, // 1 byte per pixel 30 kIndex, // 1 byte per pixel
31 kRGB, // 3 bytes per pixel 31 kRGB, // 3 bytes per pixel
32 kRGBX, // 4 byes per pixel (ignore 4th) 32 kRGBX, // 4 byes per pixel (ignore 4th)
33 kRGBA, // 4 bytes per pixel 33 kRGBA, // 4 bytes per pixel
34 kRGB_565 // 2 bytes per pixel 34 kRGB_565 // 2 bytes per pixel
35 }; 35 };
36 36
37 struct Options {
38 bool fDither;
39 bool fPremultiplyAlpha;
40 bool fSkipZeros;
41 explicit Options(const SkImageDecoder &dec)
42 : fDither(dec.getDitherImage())
43 , fPremultiplyAlpha(!dec.getRequireUnpremultipliedColors())
44 , fSkipZeros(dec.getSkipWritingZeroes())
45 { }
46 };
47
37 // Given a dst bitmap (with pixels already allocated) and a src-config, 48 // Given a dst bitmap (with pixels already allocated) and a src-config,
38 // prepares iterator to process the src colors and write them into dst. 49 // prepares iterator to process the src colors and write them into dst.
39 // Returns false if the request cannot be fulfulled. 50 // Returns false if the request cannot be fulfulled.
40 bool begin(SkBitmap* dst, SrcConfig sc, const SkImageDecoder& decoder, 51 bool begin(SkBitmap* dst, SrcConfig sc, const SkImageDecoder& decoder,
41 const SkPMColor* = NULL); 52 const SkPMColor* = NULL);
53 bool begin(SkBitmap* dst, SrcConfig sc, const Options& opts,
54 const SkPMColor* = NULL);
42 // call with row of src pixels, for y = 0...scaledHeight-1. 55 // call with row of src pixels, for y = 0...scaledHeight-1.
43 // returns true if the row had non-opaque alpha in it 56 // returns true if the row had non-opaque alpha in it
44 bool next(const uint8_t* SK_RESTRICT src); 57 bool next(const uint8_t* SK_RESTRICT src);
45 58
46 // Like next(), but specifies the y value of the source row, so the 59 // Like next(), but specifies the y value of the source row, so the
47 // rows can come in any order. If the row is not part of the output 60 // rows can come in any order. If the row is not part of the output
48 // sample, it will be skipped. Only sampleInterlaced OR next should 61 // sample, it will be skipped. Only sampleInterlaced OR next should
49 // be called for one SkScaledBitmapSampler. 62 // be called for one SkScaledBitmapSampler.
50 bool sampleInterlaced(const uint8_t* SK_RESTRICT src, int srcY); 63 bool sampleInterlaced(const uint8_t* SK_RESTRICT src, int srcY);
51 64
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // optional reference to the src colors if the src is a palette model 98 // optional reference to the src colors if the src is a palette model
86 const SkPMColor* fCTable; 99 const SkPMColor* fCTable;
87 100
88 #ifdef SK_DEBUG 101 #ifdef SK_DEBUG
89 // Helper class allowing a test to have access to fRowProc. 102 // Helper class allowing a test to have access to fRowProc.
90 friend class RowProcTester; 103 friend class RowProcTester;
91 #endif 104 #endif
92 }; 105 };
93 106
94 #endif 107 #endif
OLDNEW
« no previous file with comments | « no previous file | src/images/SkScaledBitmapSampler.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698