| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 104 static void premultitplyScanline(void* data, size_t tileNumber) | 104 static void premultitplyScanline(void* data, size_t tileNumber) |
| 105 { | 105 { |
| 106 convertScanline(data, tileNumber, true); | 106 convertScanline(data, tileNumber, true); |
| 107 } | 107 } |
| 108 #endif // USE(IOSURFACE_CANVAS_BACKING_STORE) | 108 #endif // USE(IOSURFACE_CANVAS_BACKING_STORE) |
| 109 #endif // USE(ACCELERATE) | 109 #endif // USE(ACCELERATE) |
| 110 | 110 |
| 111 PassRefPtr<ByteArray> ImageBufferData::getData(const IntRect& rect, const IntSiz
e& size, bool accelerateRendering, bool unmultiplied) const | 111 PassRefPtr<ByteArray> ImageBufferData::getData(const IntRect& rect, const IntSiz
e& size, bool accelerateRendering, bool unmultiplied) const |
| 112 { | 112 { |
| 113 float area = 4.0f * rect.width() * rect.height(); |
| 114 if (area > static_cast<float>(std::numeric_limits<int>::max())) |
| 115 return 0; |
| 116 |
| 113 RefPtr<ByteArray> result = ByteArray::create(rect.width() * rect.height() *
4); | 117 RefPtr<ByteArray> result = ByteArray::create(rect.width() * rect.height() *
4); |
| 114 unsigned char* data = result->data(); | 118 unsigned char* data = result->data(); |
| 115 | 119 |
| 116 if (rect.x() < 0 || rect.y() < 0 || rect.maxX() > size.width() || rect.maxY(
) > size.height()) | 120 if (rect.x() < 0 || rect.y() < 0 || rect.maxX() > size.width() || rect.maxY(
) > size.height()) |
| 117 memset(data, 0, result->length()); | 121 memset(data, 0, result->length()); |
| 118 | 122 |
| 119 int originx = rect.x(); | 123 int originx = rect.x(); |
| 120 int destx = 0; | 124 int destx = 0; |
| 121 if (originx < 0) { | 125 if (originx < 0) { |
| 122 destx = -originx; | 126 destx = -originx; |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 #endif // USE(ACCELERATE) | 382 #endif // USE(ACCELERATE) |
| 379 | 383 |
| 380 IOSurfaceUnlock(surface, 0, 0); | 384 IOSurfaceUnlock(surface, 0, 0); |
| 381 #else | 385 #else |
| 382 ASSERT_NOT_REACHED(); | 386 ASSERT_NOT_REACHED(); |
| 383 #endif // USE(IOSURFACE_CANVAS_BACKING_STORE) | 387 #endif // USE(IOSURFACE_CANVAS_BACKING_STORE) |
| 384 } | 388 } |
| 385 } | 389 } |
| 386 | 390 |
| 387 } // namespace WebCore | 391 } // namespace WebCore |
| OLD | NEW |