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

Side by Side Diff: content/shell/renderer/test_runner/TestPlugin.cpp

Issue 363933002: setConfig is deprecated, use setInfo or allocPixels instead. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
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 "content/shell/renderer/test_runner/TestPlugin.h" 5 #include "content/shell/renderer/test_runner/TestPlugin.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/shared_memory.h" 10 #include "base/memory/shared_memory.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 422
423 void TestPlugin::drawSceneSoftware(void* memory, size_t bytes) { 423 void TestPlugin::drawSceneSoftware(void* memory, size_t bytes) {
424 DCHECK_EQ(bytes, m_rect.width * m_rect.height * 4u); 424 DCHECK_EQ(bytes, m_rect.width * m_rect.height * 4u);
425 425
426 SkColor backgroundColor = 426 SkColor backgroundColor =
427 SkColorSetARGB(static_cast<uint8>(m_scene.opacity * 255), 427 SkColorSetARGB(static_cast<uint8>(m_scene.opacity * 255),
428 m_scene.backgroundColor[0], 428 m_scene.backgroundColor[0],
429 m_scene.backgroundColor[1], 429 m_scene.backgroundColor[1],
430 m_scene.backgroundColor[2]); 430 m_scene.backgroundColor[2]);
431 431
432 const SkImageInfo info = SkImageInfo::MakeN32Premul(m_rect.width,
433 m_rect.height);
432 SkBitmap bitmap; 434 SkBitmap bitmap;
433 bitmap.setConfig(SkBitmap::kARGB_8888_Config, m_rect.width, m_rect.height); 435 bitmap.installPixels(info, memory, info.minRowBytes());
434 bitmap.setPixels(memory);
435 SkCanvas canvas(bitmap); 436 SkCanvas canvas(bitmap);
436 canvas.clear(backgroundColor); 437 canvas.clear(backgroundColor);
437 438
438 if (m_scene.primitive != PrimitiveNone) { 439 if (m_scene.primitive != PrimitiveNone) {
439 DCHECK_EQ(PrimitiveTriangle, m_scene.primitive); 440 DCHECK_EQ(PrimitiveTriangle, m_scene.primitive);
440 SkColor foregroundColor = 441 SkColor foregroundColor =
441 SkColorSetARGB(static_cast<uint8>(m_scene.opacity * 255), 442 SkColorSetARGB(static_cast<uint8>(m_scene.opacity * 255),
442 m_scene.primitiveColor[0], 443 m_scene.primitiveColor[0],
443 m_scene.primitiveColor[1], 444 m_scene.primitiveColor[1],
444 m_scene.primitiveColor[2]); 445 m_scene.primitiveColor[2]);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 } 685 }
685 686
686 bool TestPlugin::isSupportedMimeType(const WebString& mimeType) 687 bool TestPlugin::isSupportedMimeType(const WebString& mimeType)
687 { 688 {
688 return mimeType == TestPlugin::mimeType() 689 return mimeType == TestPlugin::mimeType()
689 || mimeType == pluginPersistsMimeType() 690 || mimeType == pluginPersistsMimeType()
690 || mimeType == canCreateWithoutRendererMimeType(); 691 || mimeType == canCreateWithoutRendererMimeType();
691 } 692 }
692 693
693 } // namespace content 694 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698