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

Side by Side Diff: content/renderer/skia_benchmarking_extension.cc

Issue 1547073003: Switch to standard integer types in content/renderer/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/skia_benchmarking_extension.h" 5 #include "content/renderer/skia_benchmarking_extension.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include "base/base64.h" 10 #include "base/base64.h"
8 #include "base/time/time.h" 11 #include "base/time/time.h"
9 #include "base/values.h" 12 #include "base/values.h"
10 #include "cc/base/math_util.h" 13 #include "cc/base/math_util.h"
11 #include "content/public/child/v8_value_converter.h" 14 #include "content/public/child/v8_value_converter.h"
12 #include "content/public/renderer/chrome_object_extensions_utils.h" 15 #include "content/public/renderer/chrome_object_extensions_utils.h"
13 #include "content/renderer/render_thread_impl.h" 16 #include "content/renderer/render_thread_impl.h"
14 #include "gin/arguments.h" 17 #include "gin/arguments.h"
15 #include "gin/handle.h" 18 #include "gin/handle.h"
16 #include "gin/object_template_builder.h" 19 #include "gin/object_template_builder.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 skia::BenchmarkingCanvas benchmarking_canvas( 226 skia::BenchmarkingCanvas benchmarking_canvas(
224 &canvas, 227 &canvas,
225 overdraw ? skia::BenchmarkingCanvas::kOverdrawVisualization_Flag : 0); 228 overdraw ? skia::BenchmarkingCanvas::kOverdrawVisualization_Flag : 0);
226 size_t playback_count = 229 size_t playback_count =
227 (stop_index < 0) ? std::numeric_limits<size_t>::max() : stop_index; 230 (stop_index < 0) ? std::numeric_limits<size_t>::max() : stop_index;
228 PicturePlaybackController controller(benchmarking_canvas, playback_count); 231 PicturePlaybackController controller(benchmarking_canvas, playback_count);
229 picture->picture->playback(&benchmarking_canvas, &controller); 232 picture->picture->playback(&benchmarking_canvas, &controller);
230 233
231 blink::WebArrayBuffer buffer = 234 blink::WebArrayBuffer buffer =
232 blink::WebArrayBuffer::create(bitmap.getSize(), 1); 235 blink::WebArrayBuffer::create(bitmap.getSize(), 1);
233 uint32* packed_pixels = reinterpret_cast<uint32*>(bitmap.getPixels()); 236 uint32_t* packed_pixels = reinterpret_cast<uint32_t*>(bitmap.getPixels());
234 uint8* buffer_pixels = reinterpret_cast<uint8*>(buffer.data()); 237 uint8_t* buffer_pixels = reinterpret_cast<uint8_t*>(buffer.data());
235 // Swizzle from native Skia format to RGBA as we copy out. 238 // Swizzle from native Skia format to RGBA as we copy out.
236 for (size_t i = 0; i < bitmap.getSize(); i += 4) { 239 for (size_t i = 0; i < bitmap.getSize(); i += 4) {
237 uint32 c = packed_pixels[i >> 2]; 240 uint32_t c = packed_pixels[i >> 2];
238 buffer_pixels[i] = SkGetPackedR32(c); 241 buffer_pixels[i] = SkGetPackedR32(c);
239 buffer_pixels[i + 1] = SkGetPackedG32(c); 242 buffer_pixels[i + 1] = SkGetPackedG32(c);
240 buffer_pixels[i + 2] = SkGetPackedB32(c); 243 buffer_pixels[i + 2] = SkGetPackedB32(c);
241 buffer_pixels[i + 3] = SkGetPackedA32(c); 244 buffer_pixels[i + 3] = SkGetPackedA32(c);
242 } 245 }
243 246
244 v8::Local<v8::Object> result = v8::Object::New(isolate); 247 v8::Local<v8::Object> result = v8::Object::New(isolate);
245 result->Set(v8::String::NewFromUtf8(isolate, "width"), 248 result->Set(v8::String::NewFromUtf8(isolate, "width"),
246 v8::Number::New(isolate, snapped_clip.width())); 249 v8::Number::New(isolate, snapped_clip.width()));
247 result->Set(v8::String::NewFromUtf8(isolate, "height"), 250 result->Set(v8::String::NewFromUtf8(isolate, "height"),
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 v8::Local<v8::Object> result = v8::Object::New(isolate); 331 v8::Local<v8::Object> result = v8::Object::New(isolate);
329 result->Set(v8::String::NewFromUtf8(isolate, "width"), 332 result->Set(v8::String::NewFromUtf8(isolate, "width"),
330 v8::Number::New(isolate, picture->layer_rect.width())); 333 v8::Number::New(isolate, picture->layer_rect.width()));
331 result->Set(v8::String::NewFromUtf8(isolate, "height"), 334 result->Set(v8::String::NewFromUtf8(isolate, "height"),
332 v8::Number::New(isolate, picture->layer_rect.height())); 335 v8::Number::New(isolate, picture->layer_rect.height()));
333 336
334 args->Return(result); 337 args->Return(result);
335 } 338 }
336 339
337 } // namespace content 340 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/skia_benchmarking_extension.h ('k') | content/renderer/skia_benchmarking_extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698