Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: webkit/api/src/WebImageCG.cpp

Issue 155172: Start using WebCursorInfo from the WebKit API. WebCursorInfo is a... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/api/src/WebCursorInfo.cpp ('k') | webkit/api/src/WebImageSkia.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 18 matching lines...) Expand all
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "WebImage.h" 32 #include "WebImage.h"
33 33
34 #include <CoreGraphics/CGImage.h> 34 #include <CoreGraphics/CGImage.h>
35 35
36 #include "WebData.h" 36 #include "WebData.h"
37 #include "WebSize.h" 37 #include "WebSize.h"
38 38
39 #include "Image.h"
39 #include "ImageSource.h" 40 #include "ImageSource.h"
40 #include "SharedBuffer.h" 41 #include "SharedBuffer.h"
41 #include <wtf/PassRefPtr.h> 42 #include <wtf/PassRefPtr.h>
42 #include <wtf/RetainPtr.h> 43 #include <wtf/RetainPtr.h>
43 44
44 using namespace WebCore; 45 using namespace WebCore;
45 46
46 namespace WebKit { 47 namespace WebKit {
47 48
48 WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize) 49 WebImage WebImage::fromData(const WebData& data, const WebSize& desiredSize)
(...skipping 27 matching lines...) Expand all
76 bool WebImage::isNull() const 77 bool WebImage::isNull() const
77 { 78 {
78 return m_imageRef != 0; 79 return m_imageRef != 0;
79 } 80 }
80 81
81 WebSize WebImage::size() const 82 WebSize WebImage::size() const
82 { 83 {
83 return WebSize(CGImageGetWidth(m_imageRef), CGImageGetHeight(m_imageRef)); 84 return WebSize(CGImageGetWidth(m_imageRef), CGImageGetHeight(m_imageRef));
84 } 85 }
85 86
87 WebImage::WebImage(const PassRefPtr<Image>& image)
88 : m_imageRef(0)
89 {
90 if (image.get())
91 assign(image->nativeImageForCurrentFrame());
92 }
93
94 WebImage& WebImage::operator=(const PassRefPtr<Image>& image)
95 {
96 if (image.get())
97 assign(image->nativeImageForCurrentFrame());
98 else
99 reset();
100 return *this;
101 }
102
86 void WebImage::assign(CGImageRef imageRef) 103 void WebImage::assign(CGImageRef imageRef)
87 { 104 {
88 CGImageRelease(m_imageRef); 105 CGImageRelease(m_imageRef);
89 CGImageRetain(m_imageRef = imageRef); 106 CGImageRetain(m_imageRef = imageRef);
90 } 107 }
91 108
92 } // namespace WebKit 109 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/api/src/WebCursorInfo.cpp ('k') | webkit/api/src/WebImageSkia.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698