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

Side by Side Diff: components/test_runner/test_plugin.cc

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (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
« no previous file with comments | « components/test_runner/test_plugin.h ('k') | components/test_runner/test_runner.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "components/test_runner/test_plugin.h" 5 #include "components/test_runner/test_plugin.h"
6 6
7 #include "base/basictypes.h" 7 #include <stddef.h>
8 #include <stdint.h>
9
8 #include "base/bind.h" 10 #include "base/bind.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 12 #include "base/memory/shared_memory.h"
11 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
12 #include "cc/blink/web_layer_impl.h" 14 #include "cc/blink/web_layer_impl.h"
13 #include "cc/layers/texture_layer.h" 15 #include "cc/layers/texture_layer.h"
14 #include "cc/resources/shared_bitmap_manager.h" 16 #include "cc/resources/shared_bitmap_manager.h"
15 #include "components/test_runner/web_test_delegate.h" 17 #include "components/test_runner/web_test_delegate.h"
16 #include "third_party/WebKit/public/platform/Platform.h" 18 #include "third_party/WebKit/public/platform/Platform.h"
17 #include "third_party/WebKit/public/platform/WebCompositorSupport.h" 19 #include "third_party/WebKit/public/platform/WebCompositorSupport.h"
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 413
412 void TestPlugin::DrawSceneGL() { 414 void TestPlugin::DrawSceneGL() {
413 context_->viewport(0, 0, rect_.width, rect_.height); 415 context_->viewport(0, 0, rect_.width, rect_.height);
414 context_->clear(GL_COLOR_BUFFER_BIT); 416 context_->clear(GL_COLOR_BUFFER_BIT);
415 417
416 if (scene_.primitive != PrimitiveNone) 418 if (scene_.primitive != PrimitiveNone)
417 DrawPrimitive(); 419 DrawPrimitive();
418 } 420 }
419 421
420 void TestPlugin::DrawSceneSoftware(void* memory) { 422 void TestPlugin::DrawSceneSoftware(void* memory) {
421 SkColor background_color = 423 SkColor background_color = SkColorSetARGB(
422 SkColorSetARGB(static_cast<uint8>(scene_.opacity * 255), 424 static_cast<uint8_t>(scene_.opacity * 255), scene_.background_color[0],
423 scene_.background_color[0], 425 scene_.background_color[1], scene_.background_color[2]);
424 scene_.background_color[1],
425 scene_.background_color[2]);
426 426
427 const SkImageInfo info = 427 const SkImageInfo info =
428 SkImageInfo::MakeN32Premul(rect_.width, rect_.height); 428 SkImageInfo::MakeN32Premul(rect_.width, rect_.height);
429 SkBitmap bitmap; 429 SkBitmap bitmap;
430 bitmap.installPixels(info, memory, info.minRowBytes()); 430 bitmap.installPixels(info, memory, info.minRowBytes());
431 SkCanvas canvas(bitmap); 431 SkCanvas canvas(bitmap);
432 canvas.clear(background_color); 432 canvas.clear(background_color);
433 433
434 if (scene_.primitive != PrimitiveNone) { 434 if (scene_.primitive != PrimitiveNone) {
435 DCHECK_EQ(PrimitiveTriangle, scene_.primitive); 435 DCHECK_EQ(PrimitiveTriangle, scene_.primitive);
436 SkColor foreground_color = 436 SkColor foreground_color = SkColorSetARGB(
437 SkColorSetARGB(static_cast<uint8>(scene_.opacity * 255), 437 static_cast<uint8_t>(scene_.opacity * 255), scene_.primitive_color[0],
438 scene_.primitive_color[0], 438 scene_.primitive_color[1], scene_.primitive_color[2]);
439 scene_.primitive_color[1],
440 scene_.primitive_color[2]);
441 SkPath triangle_path; 439 SkPath triangle_path;
442 triangle_path.moveTo(0.5f * rect_.width, 0.9f * rect_.height); 440 triangle_path.moveTo(0.5f * rect_.width, 0.9f * rect_.height);
443 triangle_path.lineTo(0.1f * rect_.width, 0.1f * rect_.height); 441 triangle_path.lineTo(0.1f * rect_.width, 0.1f * rect_.height);
444 triangle_path.lineTo(0.9f * rect_.width, 0.1f * rect_.height); 442 triangle_path.lineTo(0.9f * rect_.width, 0.1f * rect_.height);
445 SkPaint paint; 443 SkPaint paint;
446 paint.setColor(foreground_color); 444 paint.setColor(foreground_color);
447 paint.setStyle(SkPaint::kFill_Style); 445 paint.setStyle(SkPaint::kFill_Style);
448 canvas.drawPath(triangle_path, paint); 446 canvas.drawPath(triangle_path, paint);
449 } 447 }
450 } 448 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 return kPluginPersistsMimeType; 755 return kPluginPersistsMimeType;
758 } 756 }
759 757
760 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) { 758 bool TestPlugin::IsSupportedMimeType(const blink::WebString& mime_type) {
761 return mime_type == TestPlugin::MimeType() || 759 return mime_type == TestPlugin::MimeType() ||
762 mime_type == PluginPersistsMimeType() || 760 mime_type == PluginPersistsMimeType() ||
763 mime_type == CanCreateWithoutRendererMimeType(); 761 mime_type == CanCreateWithoutRendererMimeType();
764 } 762 }
765 763
766 } // namespace test_runner 764 } // namespace test_runner
OLDNEW
« no previous file with comments | « components/test_runner/test_plugin.h ('k') | components/test_runner/test_runner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698