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

Side by Side Diff: include/core/SkMask.h

Issue 728673002: remove unused kLCD_MaskFormat (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove associated Gr enum Created 6 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
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('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 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
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 8
9 9
10 #ifndef SkMask_DEFINED 10 #ifndef SkMask_DEFINED
11 #define SkMask_DEFINED 11 #define SkMask_DEFINED
12 12
13 #include "SkRect.h" 13 #include "SkRect.h"
14 14
15 /** \class SkMask 15 /** \class SkMask
16 SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or 16 SkMask is used to describe alpha bitmaps, either 1bit, 8bit, or
17 the 3-channel 3D format. These are passed to SkMaskFilter objects. 17 the 3-channel 3D format. These are passed to SkMaskFilter objects.
18 */ 18 */
19 struct SkMask { 19 struct SkMask {
20 enum Format { 20 enum Format {
21 kBW_Format, //!< 1bit per pixel mask (e.g. monochrome) 21 kBW_Format, //!< 1bit per pixel mask (e.g. monochrome)
22 kA8_Format, //!< 8bits per pixel mask (e.g. antialiasing) 22 kA8_Format, //!< 8bits per pixel mask (e.g. antialiasing)
23 k3D_Format, //!< 3 8bit per pixl planes: alpha, mul, add 23 k3D_Format, //!< 3 8bit per pixl planes: alpha, mul, add
24 kARGB32_Format, //!< SkPMColor 24 kARGB32_Format, //!< SkPMColor
25 kLCD16_Format, //!< 565 alpha for r/g/b 25 kLCD16_Format, //!< 565 alpha for r/g/b
26 kLCD32_Format //!< 888 alpha for r/g/b
27 }; 26 };
28 27
29 enum { 28 enum {
30 kCountMaskFormats = kLCD32_Format + 1 29 kCountMaskFormats = kLCD16_Format + 1
31 }; 30 };
32 31
33 uint8_t* fImage; 32 uint8_t* fImage;
34 SkIRect fBounds; 33 SkIRect fBounds;
35 uint32_t fRowBytes; 34 uint32_t fRowBytes;
36 Format fFormat; 35 Format fFormat;
37 36
38 /** Returns true if the mask is empty: i.e. it has an empty bounds. 37 /** Returns true if the mask is empty: i.e. it has an empty bounds.
39 */ 38 */
40 bool isEmpty() const { return fBounds.isEmpty(); } 39 bool isEmpty() const { return fBounds.isEmpty(); }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 uint16_t* getAddrLCD16(int x, int y) const { 80 uint16_t* getAddrLCD16(int x, int y) const {
82 SkASSERT(kLCD16_Format == fFormat); 81 SkASSERT(kLCD16_Format == fFormat);
83 SkASSERT(fBounds.contains(x, y)); 82 SkASSERT(fBounds.contains(x, y));
84 SkASSERT(fImage != NULL); 83 SkASSERT(fImage != NULL);
85 uint16_t* row = (uint16_t*)(fImage + (y - fBounds.fTop) * fRowBytes); 84 uint16_t* row = (uint16_t*)(fImage + (y - fBounds.fTop) * fRowBytes);
86 return row + (x - fBounds.fLeft); 85 return row + (x - fBounds.fLeft);
87 } 86 }
88 87
89 /** 88 /**
90 * Return the address of the specified 32bit mask. In the debug build, 89 * Return the address of the specified 32bit mask. In the debug build,
91 * this asserts that the mask's format is kLCD32_Format, and that (x,y)
92 * are contained in the mask's fBounds.
93 */
94 uint32_t* getAddrLCD32(int x, int y) const {
95 SkASSERT(kLCD32_Format == fFormat);
96 SkASSERT(fBounds.contains(x, y));
97 SkASSERT(fImage != NULL);
98 uint32_t* row = (uint32_t*)(fImage + (y - fBounds.fTop) * fRowBytes);
99 return row + (x - fBounds.fLeft);
100 }
101
102 /**
103 * Return the address of the specified 32bit mask. In the debug build,
104 * this asserts that the mask's format is 32bits, and that (x,y) 90 * this asserts that the mask's format is 32bits, and that (x,y)
105 * are contained in the mask's fBounds. 91 * are contained in the mask's fBounds.
106 */ 92 */
107 uint32_t* getAddr32(int x, int y) const { 93 uint32_t* getAddr32(int x, int y) const {
108 SkASSERT(kLCD32_Format == fFormat || kARGB32_Format == fFormat); 94 SkASSERT(kARGB32_Format == fFormat);
109 SkASSERT(fBounds.contains(x, y)); 95 SkASSERT(fBounds.contains(x, y));
110 SkASSERT(fImage != NULL); 96 SkASSERT(fImage != NULL);
111 uint32_t* row = (uint32_t*)(fImage + (y - fBounds.fTop) * fRowBytes); 97 uint32_t* row = (uint32_t*)(fImage + (y - fBounds.fTop) * fRowBytes);
112 return row + (x - fBounds.fLeft); 98 return row + (x - fBounds.fLeft);
113 } 99 }
114 100
115 /** 101 /**
116 * Returns the address of the specified pixel, computing the pixel-size 102 * Returns the address of the specified pixel, computing the pixel-size
117 * at runtime based on the mask format. This will be slightly slower than 103 * at runtime based on the mask format. This will be slightly slower than
118 * using one of the routines where the format is implied by the name 104 * using one of the routines where the format is implied by the name
119 * e.g. getAddr8 or getAddrLCD32. 105 * e.g. getAddr8 or getAddr32.
120 * 106 *
121 * x,y must be contained by the mask's bounds (this is asserted in the 107 * x,y must be contained by the mask's bounds (this is asserted in the
122 * debug build, but not checked in the release build.) 108 * debug build, but not checked in the release build.)
123 * 109 *
124 * This should not be called with kBW_Format, as it will give unspecified 110 * This should not be called with kBW_Format, as it will give unspecified
125 * results (and assert in the debug build). 111 * results (and assert in the debug build).
126 */ 112 */
127 void* getAddr(int x, int y) const; 113 void* getAddr(int x, int y) const;
128 114
129 static uint8_t* AllocImage(size_t bytes); 115 static uint8_t* AllocImage(size_t bytes);
(...skipping 23 matching lines...) Expand all
153 ~SkAutoMaskFreeImage() { 139 ~SkAutoMaskFreeImage() {
154 SkMask::FreeImage(fImage); 140 SkMask::FreeImage(fImage);
155 } 141 }
156 142
157 private: 143 private:
158 uint8_t* fImage; 144 uint8_t* fImage;
159 }; 145 };
160 #define SkAutoMaskFreeImage(...) SK_REQUIRE_LOCAL_VAR(SkAutoMaskFreeImage) 146 #define SkAutoMaskFreeImage(...) SK_REQUIRE_LOCAL_VAR(SkAutoMaskFreeImage)
161 147
162 #endif 148 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698