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

Side by Side Diff: content/browser/devtools/protocol/page_handler_image_utils.cc

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Return gfx::Image from ui snapshot methods instead. Created 3 years, 11 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
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/browser/devtools/protocol/page_handler.h"
6
7
8 namespace content {
9 namespace protocol {
10
11 scoped_refptr<base::RefCountedMemory> EncodeScreenshotImageAsJpeg(
pfeldman 2017/01/07 01:13:27 Is this dead code?
Eric Seckler 2017/01/09 14:52:04 Yeah, I thought I had deleted these files.. Gone n
12 const SkBitmap& bitmap,
13 int quality) {
14 scoped_refptr<base::RefCountedBytes> data(new base::RefCountedBytes());
15 SkAutoLockPixels lock_image(bitmap);
16 bool encoded = gfx::JPEGCodec::Encode(
17 reinterpret_cast<unsigned char*>(bitmap.getPixels()),
18 gfx::JPEGCodec::FORMAT_SkBitmap, bitmap.width(), bitmap.height(),
19 base::checked_cast<int>(bitmap.rowBytes()), quality, &data->data());
20
21 if (!encoded)
22 return nullptr;
23 else
24 return data;
25 }
26
27
28 } // namespace protocol
29 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698