Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 167 r = (r * alpha) >> 24; | 167 r = (r * alpha) >> 24; |
| 168 g = (g * alpha) >> 24; | 168 g = (g * alpha) >> 24; |
| 169 b = (b * alpha) >> 24; | 169 b = (b * alpha) >> 24; |
| 170 } | 170 } |
| 171 | 171 |
| 172 // Call the "NoCheck" version since we may deliberately pass non-pre multiplied | 172 // Call the "NoCheck" version since we may deliberately pass non-pre multiplied |
| 173 // values, and we don't want an assert. | 173 // values, and we don't want an assert. |
| 174 *dest = SkPackARGB32NoCheck(a, r, g, b); | 174 *dest = SkPackARGB32NoCheck(a, r, g, b); |
| 175 } | 175 } |
| 176 | 176 |
| 177 inline void setRGBAPremultiply(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a) | |
|
Peter Kasting
2013/07/10 18:24:47
I think we ought to be able to define setRGBA() in
Noel Gordon
2013/07/11 08:23:40
Seems perfectly reasonable ...
| |
| 178 { | |
| 179 if (a < 255) { | |
| 180 if (!a) { | |
| 181 *dest = 0; | |
| 182 return; | |
| 183 } | |
| 184 | |
| 185 unsigned alpha = a * div255; | |
| 186 r = (r * alpha) >> 24; | |
| 187 g = (g * alpha) >> 24; | |
| 188 b = (b * alpha) >> 24; | |
| 189 } | |
| 190 | |
| 191 *dest = SkPackARGB32NoCheck(a, r, g, b); | |
| 192 } | |
| 193 | |
| 177 inline void setRGBARaw(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a) | 194 inline void setRGBARaw(PixelData* dest, unsigned r, unsigned g, unsigned b, unsigned a) |
| 178 { | 195 { |
| 179 *dest = SkPackARGB32NoCheck(a, r, g, b); | 196 *dest = SkPackARGB32NoCheck(a, r, g, b); |
| 180 } | 197 } |
| 181 | 198 |
| 182 private: | 199 private: |
| 183 int width() const | 200 int width() const |
| 184 { | 201 { |
| 185 return m_bitmap->bitmap().width(); | 202 return m_bitmap->bitmap().width(); |
| 186 } | 203 } |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 423 | 440 |
| 424 IntSize m_size; | 441 IntSize m_size; |
| 425 bool m_sizeAvailable; | 442 bool m_sizeAvailable; |
| 426 bool m_isAllDataReceived; | 443 bool m_isAllDataReceived; |
| 427 bool m_failed; | 444 bool m_failed; |
| 428 }; | 445 }; |
| 429 | 446 |
| 430 } // namespace WebCore | 447 } // namespace WebCore |
| 431 | 448 |
| 432 #endif | 449 #endif |
| OLD | NEW |