Chromium Code Reviews
Help | Chromium Project | Sign in
(256)

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

Issue 11053003: Migrate Graphics2D to new design. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 1 year, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 bool PPB_ImageData_Impl::Init(PP_ImageDataFormat format, 49 bool PPB_ImageData_Impl::Init(PP_ImageDataFormat format,
50 int width, int height, 50 int width, int height,
51 bool init_to_zero) { 51 bool init_to_zero) {
52 // TODO(brettw) this should be called only on the main thread! 52 // TODO(brettw) this should be called only on the main thread!
53 if (!IsImageDataFormatSupported(format)) 53 if (!IsImageDataFormatSupported(format))
54 return false; // Only support this one format for now. 54 return false; // Only support this one format for now.
55 if (width <= 0 || height <= 0) 55 if (width <= 0 || height <= 0)
56 return false; 56 return false;
57 if (static_cast<int64>(width) * static_cast<int64>(height) * 4 >= 57 if (static_cast<int64>(width) * static_cast<int64>(height) >=
58 std::numeric_limits<int32>::max()) 58 std::numeric_limits<int32>::max() / 4)
Cris Neckar 2012/11/14 07:15:56 Oops, actually we need to fix this in a separate p
59 return false; // Prevent overflow of signed 32-bit ints. 59 return false; // Prevent overflow of signed 32-bit ints.
60 60
61 format_ = format; 61 format_ = format;
62 width_ = width; 62 width_ = width;
63 height_ = height; 63 height_ = height;
64 return backend_->Init(this, format, width, height, init_to_zero); 64 return backend_->Init(this, format, width, height, init_to_zero);
65 } 65 }
66 66
67 // static 67 // static
68 PP_Resource PPB_ImageData_Impl::CreatePlatform(PP_Instance instance, 68 PP_Resource PPB_ImageData_Impl::CreatePlatform(PP_Instance instance,
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 } 278 }
279 279
280 const SkBitmap* ImageDataNaClBackend::GetMappedBitmap() const { 280 const SkBitmap* ImageDataNaClBackend::GetMappedBitmap() const {
281 if (!IsMapped()) 281 if (!IsMapped())
282 return NULL; 282 return NULL;
283 return &skia_bitmap_; 283 return &skia_bitmap_;
284 } 284 }
285 285
286 } // namespace ppapi 286 } // namespace ppapi
287 } // namespace webkit 287 } // namespace webkit
288
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppb_graphics_2d_impl.h ('k') | webkit/plugins/ppapi/resource_creation_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld 1280:2d3e6564b7b6