Changeset 39625 in webkit for trunk/JavaScriptCore/runtime/ByteArray.cpp
- Timestamp:
- Jan 5, 2009, 3:57:09 PM (16 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/ByteArray.cpp
r39624 r39625 1 1 /* 2 * Copyright (C) 200 8 Apple Inc. All rights reserved.2 * Copyright (C) 2009 Apple Inc. All Rights Reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 11 11 * documentation and/or other materials provided with the distribution. 12 12 * 13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER,INC. ``AS IS'' AND ANY13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER,INC. OR16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, … … 24 24 */ 25 25 26 #include "JSCanvasPixelArray.h" 26 #include "config.h" 27 #include "ByteArray.h" 27 28 28 #include "CanvasPixelArray.h" 29 namespace JSC { 29 30 30 using namespace JSC; 31 PassRefPtr<ByteArray> ByteArray::create(size_t size) 32 { 33 unsigned char* buffer = new unsigned char[size + sizeof(ByteArray)]; 34 ASSERT((reinterpret_cast<size_t>(buffer) & 3) == 0); 35 return adoptRef(new (buffer) ByteArray(size)); 36 } 31 37 32 namespace WebCore { 33 34 inline JSValue* JSCanvasPixelArray::getByIndex(ExecState*, unsigned index) 35 { 36 unsigned char result; 37 if (!impl()->get(index, result)) 38 return jsUndefined(); 39 return JSImmediate::from(result); 40 } 41 42 inline void JSCanvasPixelArray::indexSetter(ExecState* exec, unsigned index, JSValue* value) 43 { 44 double pixelValue = value->toNumber(exec); 45 if (exec->hadException()) 46 return; 47 m_impl->set(index, pixelValue); 48 } 49 50 } // namespace WebCore 38 }
Note:
See TracChangeset
for help on using the changeset viewer.