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

Side by Side Diff: webkit/plugins/ppapi/ppb_image_data_impl.cc

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_pdf_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/ppapi/ppb_image_data_impl.h" 5 #include "webkit/plugins/ppapi/ppb_image_data_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 return PP_TRUE; 99 return PP_TRUE;
100 } 100 }
101 101
102 void* PPB_ImageData_Impl::Map() { 102 void* PPB_ImageData_Impl::Map() {
103 if (!mapped_canvas_.get()) { 103 if (!mapped_canvas_.get()) {
104 mapped_canvas_.reset(platform_image_->Map()); 104 mapped_canvas_.reset(platform_image_->Map());
105 if (!mapped_canvas_.get()) 105 if (!mapped_canvas_.get())
106 return NULL; 106 return NULL;
107 } 107 }
108 const SkBitmap& bitmap = 108 const SkBitmap& bitmap =
109 mapped_canvas_->getTopPlatformDevice().accessBitmap(true); 109 skia::GetTopDevice(*mapped_canvas_)->accessBitmap(true);
110 110
111 // Our platform bitmaps are set to opaque by default, which we don't want. 111 // Our platform bitmaps are set to opaque by default, which we don't want.
112 const_cast<SkBitmap&>(bitmap).setIsOpaque(false); 112 const_cast<SkBitmap&>(bitmap).setIsOpaque(false);
113 113
114 bitmap.lockPixels(); 114 bitmap.lockPixels();
115 return bitmap.getAddr32(0, 0); 115 return bitmap.getAddr32(0, 0);
116 } 116 }
117 117
118 void PPB_ImageData_Impl::Unmap() { 118 void PPB_ImageData_Impl::Unmap() {
119 // This is currently unimplemented, which is OK. The data will just always 119 // This is currently unimplemented, which is OK. The data will just always
120 // be around once it's mapped. Chrome's TransportDIB isn't currently 120 // be around once it's mapped. Chrome's TransportDIB isn't currently
121 // unmappable without freeing it, but this may be something we want to support 121 // unmappable without freeing it, but this may be something we want to support
122 // in the future to save some memory. 122 // in the future to save some memory.
123 } 123 }
124 124
125 int PPB_ImageData_Impl::GetSharedMemoryHandle(uint32* byte_count) const { 125 int PPB_ImageData_Impl::GetSharedMemoryHandle(uint32* byte_count) const {
126 return platform_image_->GetSharedMemoryHandle(byte_count); 126 return platform_image_->GetSharedMemoryHandle(byte_count);
127 } 127 }
128 128
129 const SkBitmap* PPB_ImageData_Impl::GetMappedBitmap() const { 129 const SkBitmap* PPB_ImageData_Impl::GetMappedBitmap() const {
130 if (!mapped_canvas_.get()) 130 if (!mapped_canvas_.get())
131 return NULL; 131 return NULL;
132 return &mapped_canvas_->getTopPlatformDevice().accessBitmap(false); 132 return &skia::GetTopDevice(*mapped_canvas_)->accessBitmap(false);
133 } 133 }
134 134
135 void PPB_ImageData_Impl::Swap(PPB_ImageData_Impl* other) { 135 void PPB_ImageData_Impl::Swap(PPB_ImageData_Impl* other) {
136 swap(other->platform_image_, platform_image_); 136 swap(other->platform_image_, platform_image_);
137 swap(other->mapped_canvas_, mapped_canvas_); 137 swap(other->mapped_canvas_, mapped_canvas_);
138 std::swap(other->format_, format_); 138 std::swap(other->format_, format_);
139 std::swap(other->width_, width_); 139 std::swap(other->width_, width_);
140 std::swap(other->height_, height_); 140 std::swap(other->height_, height_);
141 } 141 }
142 142
143 } // namespace ppapi 143 } // namespace ppapi
144 } // namespace webkit 144 } // namespace webkit
145 145
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.cc ('k') | webkit/plugins/ppapi/ppb_pdf_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698