Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
| OLD | NEW |