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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 // calls this to free the bitmap data, but other functions like | 62 // calls this to free the bitmap data, but other functions like |
63 // initFrameBuffer() and frameComplete() may still need to read | 63 // initFrameBuffer() and frameComplete() may still need to read |
64 // other metadata out of this frame later. | 64 // other metadata out of this frame later. |
65 } | 65 } |
66 | 66 |
67 void RGBA32Buffer::zeroFill() | 67 void RGBA32Buffer::zeroFill() |
68 { | 68 { |
69 m_bitmap.eraseARGB(0, 0, 0, 0); | 69 m_bitmap.eraseARGB(0, 0, 0, 0); |
70 } | 70 } |
71 | 71 |
72 void RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) | 72 bool RGBA32Buffer::copyBitmapData(const RGBA32Buffer& other) |
73 { | 73 { |
74 if (this == &other) | 74 if (this == &other) |
75 return; | 75 return true; |
76 | 76 |
77 m_bitmap.reset(); | 77 m_bitmap.reset(); |
78 const NativeImageSkia& otherBitmap = other.m_bitmap; | 78 const NativeImageSkia& otherBitmap = other.m_bitmap; |
79 otherBitmap.copyTo(&m_bitmap, otherBitmap.config()); | 79 return otherBitmap.copyTo(&m_bitmap, otherBitmap.config()); |
80 } | 80 } |
81 | 81 |
82 bool RGBA32Buffer::setSize(int newWidth, int newHeight) | 82 bool RGBA32Buffer::setSize(int newWidth, int newHeight) |
83 { | 83 { |
84 // This function should only be called once, it will leak memory | 84 // This function should only be called once, it will leak memory |
85 // otherwise. | 85 // otherwise. |
86 ASSERT(width() == 0 && height() == 0); | 86 ASSERT(width() == 0 && height() == 0); |
87 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, newWidth, newHeight); | 87 m_bitmap.setConfig(SkBitmap::kARGB_8888_Config, newWidth, newHeight); |
88 if (!m_bitmap.allocPixels()) | 88 if (!m_bitmap.allocPixels()) |
89 return false; | 89 return false; |
(...skipping 30 matching lines...) Expand all Loading... |
120 { | 120 { |
121 return m_bitmap.width(); | 121 return m_bitmap.width(); |
122 } | 122 } |
123 | 123 |
124 int RGBA32Buffer::height() const | 124 int RGBA32Buffer::height() const |
125 { | 125 { |
126 return m_bitmap.height(); | 126 return m_bitmap.height(); |
127 } | 127 } |
128 | 128 |
129 } // namespace WebCore | 129 } // namespace WebCore |
OLD | NEW |