| 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) 2008, 2009 Google, Inc. | 3 * Copyright (C) 2008, 2009 Google, Inc. |
| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 m_bitmap->bitmap().reset(); | 101 m_bitmap->bitmap().reset(); |
| 102 const NativeImageSkia* otherBitmap = other.m_bitmap.get(); | 102 const NativeImageSkia* otherBitmap = other.m_bitmap.get(); |
| 103 return otherBitmap->bitmap().copyTo(&m_bitmap->bitmap(), otherBitmap->bitmap
().colorType()); | 103 return otherBitmap->bitmap().copyTo(&m_bitmap->bitmap(), otherBitmap->bitmap
().colorType()); |
| 104 } | 104 } |
| 105 | 105 |
| 106 bool ImageFrame::setSize(int newWidth, int newHeight) | 106 bool ImageFrame::setSize(int newWidth, int newHeight) |
| 107 { | 107 { |
| 108 // setSize() should only be called once, it leaks memory otherwise. | 108 // setSize() should only be called once, it leaks memory otherwise. |
| 109 ASSERT(!width() && !height()); | 109 ASSERT(!width() && !height()); |
| 110 | 110 |
| 111 m_bitmap->bitmap().setConfig(SkBitmap::kARGB_8888_Config, newWidth, newHeigh
t); | 111 m_bitmap->bitmap().setConfig(SkImageInfo::MakeN32Premul(newWidth, newHeight)
); |
| 112 if (!m_bitmap->bitmap().allocPixels(m_allocator, 0)) | 112 if (!m_bitmap->bitmap().allocPixels(m_allocator, 0)) |
| 113 return false; | 113 return false; |
| 114 | 114 |
| 115 zeroFillPixelData(); | 115 zeroFillPixelData(); |
| 116 return true; | 116 return true; |
| 117 } | 117 } |
| 118 | 118 |
| 119 PassRefPtr<NativeImageSkia> ImageFrame::asNewNativeImage() const | 119 PassRefPtr<NativeImageSkia> ImageFrame::asNewNativeImage() const |
| 120 { | 120 { |
| 121 return m_bitmap->clone(); | 121 return m_bitmap->clone(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 void ImageFrame::zeroFillFrameRect(const IntRect& rect) | 153 void ImageFrame::zeroFillFrameRect(const IntRect& rect) |
| 154 { | 154 { |
| 155 if (rect.isEmpty()) | 155 if (rect.isEmpty()) |
| 156 return; | 156 return; |
| 157 | 157 |
| 158 m_bitmap->bitmap().eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); | 158 m_bitmap->bitmap().eraseArea(rect, SkColorSetARGB(0, 0, 0, 0)); |
| 159 setHasAlpha(true); | 159 setHasAlpha(true); |
| 160 } | 160 } |
| 161 | 161 |
| 162 } // namespace WebCore | 162 } // namespace WebCore |
| OLD | NEW |