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

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

Issue 7019013: Removal of dependencies on PlatformDevice classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Syncing merge conflicts. Created 9 years, 7 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after
1469 reinterpret_cast<const unsigned char*>(pixels), 1469 reinterpret_cast<const unsigned char*>(pixels),
1470 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(), bitmap.height(), 1470 gfx::JPEGCodec::FORMAT_BGRA, bitmap.width(), bitmap.height(),
1471 static_cast<int>(bitmap.rowBytes()), 100, &compressed_image); 1471 static_cast<int>(bitmap.rowBytes()), 100, &compressed_image);
1472 UMA_HISTOGRAM_TIMES("PepperPluginPrint.RasterBitmapCompressTime", 1472 UMA_HISTOGRAM_TIMES("PepperPluginPrint.RasterBitmapCompressTime",
1473 base::TimeTicks::Now() - start_time); 1473 base::TimeTicks::Now() - start_time);
1474 if (!encoded) { 1474 if (!encoded) {
1475 NOTREACHED(); 1475 NOTREACHED();
1476 return false; 1476 return false;
1477 } 1477 }
1478 1478
1479 HDC dc = skia::BeginPlatformPaint(canvas); 1479 skia::ScopedPlatformPaint scoped_platform_paint(canvas);
1480 HDC dc = scoped_platform_paint.GetPlatformSurface();
1480 // TODO(sanjeevr): This is a temporary hack. If we output a JPEG 1481 // TODO(sanjeevr): This is a temporary hack. If we output a JPEG
1481 // to the EMF, the EnumEnhMetaFile call fails in the browser 1482 // to the EMF, the EnumEnhMetaFile call fails in the browser
1482 // process. The failure also happens if we output nothing here. 1483 // process. The failure also happens if we output nothing here.
1483 // We need to investigate the reason for this failure and fix it. 1484 // We need to investigate the reason for this failure and fix it.
1484 // In the meantime this temporary hack of drawing an empty 1485 // In the meantime this temporary hack of drawing an empty
1485 // rectangle in the DC gets us by. 1486 // rectangle in the DC gets us by.
1486 Rectangle(dc, 0, 0, 0, 0); 1487 Rectangle(dc, 0, 0, 0, 0);
1487 BITMAPINFOHEADER bmi = {0}; 1488 BITMAPINFOHEADER bmi = {0};
1488 gfx::CreateBitmapHeader(bitmap.width(), bitmap.height(), &bmi); 1489 gfx::CreateBitmapHeader(bitmap.width(), bitmap.height(), &bmi);
1489 bmi.biCompression = BI_JPEG; 1490 bmi.biCompression = BI_JPEG;
1490 bmi.biSizeImage = compressed_image.size(); 1491 bmi.biSizeImage = compressed_image.size();
1491 bmi.biHeight = -bmi.biHeight; 1492 bmi.biHeight = -bmi.biHeight;
1492 StretchDIBits(dc, printable_area.x(), printable_area.y(), 1493 StretchDIBits(dc, printable_area.x(), printable_area.y(),
1493 printable_area.width(), printable_area.height(), 1494 printable_area.width(), printable_area.height(),
1494 0, 0, bitmap.width(), bitmap.height(), 1495 0, 0, bitmap.width(), bitmap.height(),
1495 &compressed_image.front(), 1496 &compressed_image.front(),
1496 reinterpret_cast<const BITMAPINFO*>(&bmi), 1497 reinterpret_cast<const BITMAPINFO*>(&bmi),
1497 DIB_RGB_COLORS, SRCCOPY); 1498 DIB_RGB_COLORS, SRCCOPY);
1498 skia::EndPlatformPaint(canvas);
1499 return true; 1499 return true;
1500 } 1500 }
1501 #endif // OS_WIN 1501 #endif // OS_WIN
1502 1502
1503 #if defined(OS_MACOSX) && !defined(USE_SKIA) 1503 #if defined(OS_MACOSX) && !defined(USE_SKIA)
1504 void PluginInstance::DrawSkBitmapToCanvas( 1504 void PluginInstance::DrawSkBitmapToCanvas(
1505 const SkBitmap& bitmap, WebKit::WebCanvas* canvas, 1505 const SkBitmap& bitmap, WebKit::WebCanvas* canvas,
1506 const gfx::Rect& dest_rect, 1506 const gfx::Rect& dest_rect,
1507 int canvas_height) { 1507 int canvas_height) {
1508 SkAutoLockPixels lock(bitmap); 1508 SkAutoLockPixels lock(bitmap);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1604 return found->second; 1604 return found->second;
1605 } 1605 }
1606 1606
1607 bool PluginInstance::IsFullPagePlugin() const { 1607 bool PluginInstance::IsFullPagePlugin() const {
1608 WebFrame* frame = container()->element().document().frame(); 1608 WebFrame* frame = container()->element().document().frame();
1609 return frame->view()->mainFrame()->document().isPluginDocument(); 1609 return frame->view()->mainFrame()->document().isPluginDocument();
1610 } 1610 }
1611 1611
1612 } // namespace ppapi 1612 } // namespace ppapi
1613 } // namespace webkit 1613 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/npapi/webplugin_delegate_impl_win.cc ('k') | webkit/plugins/ppapi/ppb_image_data_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698