| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2009 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). | 4 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #ifndef Uint8ClampedArray_h | 28 #ifndef Uint8ClampedArray_h |
| 29 #define Uint8ClampedArray_h | 29 #define Uint8ClampedArray_h |
| 30 | 30 |
| 31 #include "wtf/Uint8Array.h" | 31 #include "wtf/Uint8Array.h" |
| 32 #include "wtf/MathExtras.h" | 32 #include "wtf/MathExtras.h" |
| 33 | 33 |
| 34 namespace WTF { | 34 namespace WTF { |
| 35 | 35 |
| 36 class Uint8ClampedArray FINAL : public Uint8Array { | 36 class Uint8ClampedArray final : public Uint8Array { |
| 37 public: | 37 public: |
| 38 static inline PassRefPtr<Uint8ClampedArray> create(unsigned length); | 38 static inline PassRefPtr<Uint8ClampedArray> create(unsigned length); |
| 39 static inline PassRefPtr<Uint8ClampedArray> create(const unsigned char* arra
y, unsigned length); | 39 static inline PassRefPtr<Uint8ClampedArray> create(const unsigned char* arra
y, unsigned length); |
| 40 static inline PassRefPtr<Uint8ClampedArray> create(PassRefPtr<ArrayBuffer>,
unsigned byteOffset, unsigned length); | 40 static inline PassRefPtr<Uint8ClampedArray> create(PassRefPtr<ArrayBuffer>,
unsigned byteOffset, unsigned length); |
| 41 | 41 |
| 42 // Should only be used when it is known the entire array will be filled. Do | 42 // Should only be used when it is known the entire array will be filled. Do |
| 43 // not return these results directly to JavaScript without filling first. | 43 // not return these results directly to JavaScript without filling first. |
| 44 static inline PassRefPtr<Uint8ClampedArray> createUninitialized(unsigned len
gth); | 44 static inline PassRefPtr<Uint8ClampedArray> createUninitialized(unsigned len
gth); |
| 45 | 45 |
| 46 // It's only needed to potentially call this method if the array | 46 // It's only needed to potentially call this method if the array |
| 47 // was created uninitialized -- the default initialization paths | 47 // was created uninitialized -- the default initialization paths |
| 48 // zero the allocated memory. | 48 // zero the allocated memory. |
| 49 inline void zeroFill(); | 49 inline void zeroFill(); |
| 50 | 50 |
| 51 using TypedArrayBase<unsigned char>::set; | 51 using TypedArrayBase<unsigned char>::set; |
| 52 inline void set(unsigned index, double value); | 52 inline void set(unsigned index, double value); |
| 53 | 53 |
| 54 inline PassRefPtr<Uint8ClampedArray> subarray(int start) const; | 54 inline PassRefPtr<Uint8ClampedArray> subarray(int start) const; |
| 55 inline PassRefPtr<Uint8ClampedArray> subarray(int start, int end) const; | 55 inline PassRefPtr<Uint8ClampedArray> subarray(int start, int end) const; |
| 56 | 56 |
| 57 virtual ViewType type() const OVERRIDE | 57 virtual ViewType type() const override |
| 58 { | 58 { |
| 59 return TypeUint8Clamped; | 59 return TypeUint8Clamped; |
| 60 } | 60 } |
| 61 | 61 |
| 62 private: | 62 private: |
| 63 inline Uint8ClampedArray(PassRefPtr<ArrayBuffer>, | 63 inline Uint8ClampedArray(PassRefPtr<ArrayBuffer>, |
| 64 unsigned byteOffset, | 64 unsigned byteOffset, |
| 65 unsigned length); | 65 unsigned length); |
| 66 // Make constructor visible to superclass. | 66 // Make constructor visible to superclass. |
| 67 friend class TypedArrayBase<unsigned char>; | 67 friend class TypedArrayBase<unsigned char>; |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::subarray(int start, int end) co
nst | 116 PassRefPtr<Uint8ClampedArray> Uint8ClampedArray::subarray(int start, int end) co
nst |
| 117 { | 117 { |
| 118 return subarrayImpl<Uint8ClampedArray>(start, end); | 118 return subarrayImpl<Uint8ClampedArray>(start, end); |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace WTF | 121 } // namespace WTF |
| 122 | 122 |
| 123 using WTF::Uint8ClampedArray; | 123 using WTF::Uint8ClampedArray; |
| 124 | 124 |
| 125 #endif // Uint8ClampedArray_h | 125 #endif // Uint8ClampedArray_h |
| OLD | NEW |