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

Unified Diff: chrome/browser/extensions/extension_tabs_module.cc

Issue 2819050: Deal with alpha values when building PNG in chrome.tabs.captureVisibleTab(). (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Rerebase. Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tabs/capture_visible_tab/red.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_tabs_module.cc
diff --git a/chrome/browser/extensions/extension_tabs_module.cc b/chrome/browser/extensions/extension_tabs_module.cc
index 36ada09cee939b0501534c42829b8aa8fa5204dc..a4b1ee158a87e3a3551d2480c54ce47de0e03a41 100644
--- a/chrome/browser/extensions/extension_tabs_module.cc
+++ b/chrome/browser/extensions/extension_tabs_module.cc
@@ -889,6 +889,8 @@ bool CaptureVisibleTabFunction::CaptureSnapshotFromBackingStore(
&temp_canvas)) {
return false;
}
+ LOG(INFO) << "captureVisibleTab() Got image from backing store.";
+
SendResultFromBitmap(
temp_canvas.getTopPlatformDevice().accessBitmap(false));
return true;
@@ -909,6 +911,7 @@ void CaptureVisibleTabFunction::Observe(NotificationType type,
error_ = keys::kInternalVisibleTabCaptureError;
SendResponse(false);
} else {
+ LOG(INFO) << "captureVisibleTab() Got image from renderer.";
SendResultFromBitmap(*screen_capture);
}
@@ -930,17 +933,15 @@ void CaptureVisibleTabFunction::SendResultFromBitmap(
gfx::JPEGCodec::FORMAT_BGRA,
screen_capture.width(),
screen_capture.height(),
- static_cast<int>(screen_capture.rowBytes()), image_quality_,
+ static_cast<int>(screen_capture.rowBytes()),
+ image_quality_,
&image_data->data);
mime_type = keys::kMimeTypeJpeg;
break;
case FORMAT_PNG:
- encoded = gfx::PNGCodec::Encode(
- reinterpret_cast<unsigned char*>(screen_capture.getAddr32(0, 0)),
- gfx::PNGCodec::FORMAT_BGRA,
- screen_capture.width(),
- screen_capture.height(),
- static_cast<int>(screen_capture.rowBytes()), false,
+ encoded = gfx::PNGCodec::EncodeBGRASkBitmap(
+ screen_capture,
+ true, // Discard transparency.
&image_data->data);
mime_type = keys::kMimeTypePng;
break;
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tabs/capture_visible_tab/red.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698