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

Side by Side Diff: ppapi/cpp/image_data.cc

Issue 4310002: Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on W... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month 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 | « ppapi/cpp/graphics_2d.cc ('k') | ppapi/cpp/instance.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) 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 "ppapi/cpp/image_data.h" 5 #include "ppapi/cpp/image_data.h"
6 6
7 #include <string.h> // Needed for memset. 7 #include <string.h> // Needed for memset.
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
11 #include "ppapi/cpp/common.h"
11 #include "ppapi/cpp/instance.h" 12 #include "ppapi/cpp/instance.h"
12 #include "ppapi/cpp/module.h" 13 #include "ppapi/cpp/module.h"
13 #include "ppapi/cpp/module_impl.h" 14 #include "ppapi/cpp/module_impl.h"
14 15
15 namespace { 16 namespace {
16 17
17 DeviceFuncs<PPB_ImageData> image_data_f(PPB_IMAGEDATA_INTERFACE); 18 DeviceFuncs<PPB_ImageData> image_data_f(PPB_IMAGEDATA_INTERFACE);
18 19
19 } // namespace 20 } // namespace
20 21
(...skipping 23 matching lines...) Expand all
44 const Size& size, 45 const Size& size,
45 bool init_to_zero) 46 bool init_to_zero)
46 : data_(NULL) { 47 : data_(NULL) {
47 memset(&desc_, 0, sizeof(PP_ImageDataDesc)); 48 memset(&desc_, 0, sizeof(PP_ImageDataDesc));
48 49
49 if (!image_data_f) 50 if (!image_data_f)
50 return; 51 return;
51 52
52 PassRefAndInitData(image_data_f->Create(Module::Get()->pp_module(), 53 PassRefAndInitData(image_data_f->Create(Module::Get()->pp_module(),
53 format, &size.pp_size(), 54 format, &size.pp_size(),
54 init_to_zero)); 55 BoolToPPBool(init_to_zero)));
55 } 56 }
56 57
57 ImageData::~ImageData() { 58 ImageData::~ImageData() {
58 } 59 }
59 60
60 ImageData& ImageData::operator=(const ImageData& other) { 61 ImageData& ImageData::operator=(const ImageData& other) {
61 ImageData copy(other); 62 ImageData copy(other);
62 swap(copy); 63 swap(copy);
63 return *this; 64 return *this;
64 } 65 }
(...skipping 24 matching lines...) Expand all
89 } 90 }
90 91
91 void ImageData::PassRefAndInitData(PP_Resource resource) { 92 void ImageData::PassRefAndInitData(PP_Resource resource) {
92 PassRefFromConstructor(resource); 93 PassRefFromConstructor(resource);
93 if (!image_data_f->Describe(pp_resource(), &desc_) || 94 if (!image_data_f->Describe(pp_resource(), &desc_) ||
94 !(data_ = image_data_f->Map(pp_resource()))) 95 !(data_ = image_data_f->Map(pp_resource())))
95 *this = ImageData(); 96 *this = ImageData();
96 } 97 }
97 98
98 } // namespace pp 99 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/graphics_2d.cc ('k') | ppapi/cpp/instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698