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

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

Issue 6282007: First pass at making the proxy handle multiple renderers. This associates the... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/ppb_image_data_impl.h ('k') | webkit/plugins/ppapi/resource_tracker.h » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // static 122 // static
123 const PPB_ImageData* PPB_ImageData_Impl::GetInterface() { 123 const PPB_ImageData* PPB_ImageData_Impl::GetInterface() {
124 return &ppb_imagedata; 124 return &ppb_imagedata;
125 } 125 }
126 126
127 // static 127 // static
128 const PPB_ImageDataTrusted* PPB_ImageData_Impl::GetTrustedInterface() { 128 const PPB_ImageDataTrusted* PPB_ImageData_Impl::GetTrustedInterface() {
129 return &ppb_imagedata_trusted; 129 return &ppb_imagedata_trusted;
130 } 130 }
131 131
132 // static
133 PP_ImageDataFormat PPB_ImageData_Impl::GetNativeImageDataFormat() {
134 if (SK_B32_SHIFT == 0)
135 return PP_IMAGEDATAFORMAT_BGRA_PREMUL;
136 else if (SK_R32_SHIFT == 0)
137 return PP_IMAGEDATAFORMAT_RGBA_PREMUL;
138 else
139 return PP_IMAGEDATAFORMAT_BGRA_PREMUL; // Default to something on failure.
140 }
141
142 // static
143 bool PPB_ImageData_Impl::IsImageDataFormatSupported(
144 PP_ImageDataFormat format) {
145 return format == PP_IMAGEDATAFORMAT_BGRA_PREMUL ||
146 format == PP_IMAGEDATAFORMAT_RGBA_PREMUL;
147 }
148
149 PPB_ImageData_Impl* PPB_ImageData_Impl::AsPPB_ImageData_Impl() { 132 PPB_ImageData_Impl* PPB_ImageData_Impl::AsPPB_ImageData_Impl() {
150 return this; 133 return this;
151 } 134 }
152 135
153 bool PPB_ImageData_Impl::Init(PP_ImageDataFormat format, 136 bool PPB_ImageData_Impl::Init(PP_ImageDataFormat format,
154 int width, int height, 137 int width, int height,
155 bool init_to_zero) { 138 bool init_to_zero) {
156 // TODO(brettw) this should be called only on the main thread! 139 // TODO(brettw) this should be called only on the main thread!
157 // TODO(brettw) use init_to_zero when we implement caching. 140 // TODO(brettw) use init_to_zero when we implement caching.
158 if (!IsImageDataFormatSupported(format)) 141 if (!IsImageDataFormatSupported(format))
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 swap(other->platform_image_, platform_image_); 198 swap(other->platform_image_, platform_image_);
216 swap(other->mapped_canvas_, mapped_canvas_); 199 swap(other->mapped_canvas_, mapped_canvas_);
217 std::swap(other->format_, format_); 200 std::swap(other->format_, format_);
218 std::swap(other->width_, width_); 201 std::swap(other->width_, width_);
219 std::swap(other->height_, height_); 202 std::swap(other->height_, height_);
220 } 203 }
221 204
222 } // namespace ppapi 205 } // namespace ppapi
223 } // namespace webkit 206 } // namespace webkit
224 207
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_image_data_impl.h ('k') | webkit/plugins/ppapi/resource_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698