| 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 } | 93 } |
| 94 | 94 |
| 95 bool ImageFrame::copyBitmapData(const ImageFrame& other) | 95 bool ImageFrame::copyBitmapData(const ImageFrame& other) |
| 96 { | 96 { |
| 97 if (this == &other) | 97 if (this == &other) |
| 98 return true; | 98 return true; |
| 99 | 99 |
| 100 m_hasAlpha = other.m_hasAlpha; | 100 m_hasAlpha = other.m_hasAlpha; |
| 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
().config()); | 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(SkBitmap::kARGB_8888_Config, newWidth, newHeigh
t); |
| 112 if (!m_bitmap->bitmap().allocPixels(m_allocator, 0)) | 112 if (!m_bitmap->bitmap().allocPixels(m_allocator, 0)) |
| 113 return false; | 113 return false; |
| (...skipping 39 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 |