OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 WebSize WebImage::size() const | 84 WebSize WebImage::size() const |
85 { | 85 { |
86 return WebSize(CGImageGetWidth(m_imageRef), CGImageGetHeight(m_imageRef)); | 86 return WebSize(CGImageGetWidth(m_imageRef), CGImageGetHeight(m_imageRef)); |
87 } | 87 } |
88 | 88 |
89 WebImage::WebImage(const PassRefPtr<Image>& image) | 89 WebImage::WebImage(const PassRefPtr<Image>& image) |
90 : m_imageRef(0) | 90 : m_imageRef(0) |
91 { | 91 { |
92 NativeImagePtr p; | 92 NativeImagePtr p; |
93 if (image.get() && (p = image->nativeImageForCurrentFrame())) | 93 if (image.get() && (p = image->nativeImageForCurrentFrame())) |
94 assign(*p); | 94 assign(p); |
95 } | 95 } |
96 | 96 |
97 WebImage& WebImage::operator=(const PassRefPtr<Image>& image) | 97 WebImage& WebImage::operator=(const PassRefPtr<Image>& image) |
98 { | 98 { |
99 NativeImagePtr p; | 99 NativeImagePtr p; |
100 if (image.get() && (p = image->nativeImageForCurrentFrame())) | 100 if (image.get() && (p = image->nativeImageForCurrentFrame())) |
101 assign(*p); | 101 assign(p); |
102 else | 102 else |
103 reset(); | 103 reset(); |
104 return *this; | 104 return *this; |
105 } | 105 } |
106 | 106 |
107 void WebImage::assign(CGImageRef imageRef) | 107 void WebImage::assign(CGImageRef imageRef) |
108 { | 108 { |
109 // Make sure to retain the imageRef first incase m_imageRef == imageRef. | 109 // Make sure to retain the imageRef first incase m_imageRef == imageRef. |
110 CGImageRetain(imageRef); | 110 CGImageRetain(imageRef); |
111 CGImageRelease(m_imageRef); | 111 CGImageRelease(m_imageRef); |
112 m_imageRef = imageRef; | 112 m_imageRef = imageRef; |
113 } | 113 } |
114 | 114 |
115 } // namespace WebKit | 115 } // namespace WebKit |
OLD | NEW |