| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer/gpu/gpu_benchmarking_extension.h" | 5 #include "content/renderer/gpu/gpu_benchmarking_extension.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 vector.push_back((width >> 24) & 0xFF); | 89 vector.push_back((width >> 24) & 0xFF); |
| 90 vector.push_back(height & 0xFF); | 90 vector.push_back(height & 0xFF); |
| 91 vector.push_back((height >> 8) & 0xFF); | 91 vector.push_back((height >> 8) & 0xFF); |
| 92 vector.push_back((height >> 16) & 0xFF); | 92 vector.push_back((height >> 16) & 0xFF); |
| 93 vector.push_back((height >> 24) & 0xFF); | 93 vector.push_back((height >> 24) & 0xFF); |
| 94 | 94 |
| 95 // Save any additional information about the bitmap that may be | 95 // Save any additional information about the bitmap that may be |
| 96 // interesting. | 96 // interesting. |
| 97 vector.push_back(pixmap.colorType()); | 97 vector.push_back(pixmap.colorType()); |
| 98 vector.push_back(pixmap.alphaType()); | 98 vector.push_back(pixmap.alphaType()); |
| 99 return SkData::NewWithCopy(&vector.front(), vector.size()); | 99 return SkData::MakeWithCopy(&vector.front(), vector.size()).release(); |
| 100 } else { | 100 } else { |
| 101 SkBitmap bm; | 101 SkBitmap bm; |
| 102 // The const_cast is fine, since we only read from the bitmap. | 102 // The const_cast is fine, since we only read from the bitmap. |
| 103 if (bm.installPixels(pixmap.info(), | 103 if (bm.installPixels(pixmap.info(), |
| 104 const_cast<void*>(pixmap.addr()), | 104 const_cast<void*>(pixmap.addr()), |
| 105 pixmap.rowBytes())) { | 105 pixmap.rowBytes())) { |
| 106 if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { | 106 if (gfx::PNGCodec::EncodeBGRASkBitmap(bm, false, &vector)) { |
| 107 return SkData::NewWithCopy(&vector.front(), vector.size()); | 107 return SkData::MakeWithCopy(&vector.front(), vector.size()).release(); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 } | 110 } |
| 111 return nullptr; | 111 return nullptr; |
| 112 } | 112 } |
| 113 }; | 113 }; |
| 114 | 114 |
| 115 class SkPictureSerializer { | 115 class SkPictureSerializer { |
| 116 public: | 116 public: |
| 117 explicit SkPictureSerializer(const base::FilePath& dirpath) | 117 explicit SkPictureSerializer(const base::FilePath& dirpath) |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 961 &gpu_driver_bug_workarounds))) { | 961 &gpu_driver_bug_workarounds))) { |
| 962 return; | 962 return; |
| 963 } | 963 } |
| 964 | 964 |
| 965 v8::Local<v8::Value> result; | 965 v8::Local<v8::Value> result; |
| 966 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) | 966 if (gin::TryConvertToV8(args->isolate(), gpu_driver_bug_workarounds, &result)) |
| 967 args->Return(result); | 967 args->Return(result); |
| 968 } | 968 } |
| 969 | 969 |
| 970 } // namespace content | 970 } // namespace content |
| OLD | NEW |