| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/android/content_readback_handler.h" | 5 #include "content/browser/android/content_readback_handler.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "content/browser/android/content_view_core_impl.h" | 9 #include "content/browser/android/content_view_core_impl.h" |
| 10 #include "jni/ContentReadbackHandler_jni.h" | 10 #include "jni/ContentReadbackHandler_jni.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 jobject content_view_core) { | 54 jobject content_view_core) { |
| 55 ContentViewCore* view = | 55 ContentViewCore* view = |
| 56 ContentViewCore::GetNativeContentViewCore(env, content_view_core); | 56 ContentViewCore::GetNativeContentViewCore(env, content_view_core); |
| 57 DCHECK(view); | 57 DCHECK(view); |
| 58 | 58 |
| 59 base::Callback<void(bool, const SkBitmap&)> result_callback = | 59 base::Callback<void(bool, const SkBitmap&)> result_callback = |
| 60 base::Bind(&ContentReadbackHandler::OnFinishContentReadback, | 60 base::Bind(&ContentReadbackHandler::OnFinishContentReadback, |
| 61 weak_factory_.GetWeakPtr(), | 61 weak_factory_.GetWeakPtr(), |
| 62 readback_id); | 62 readback_id); |
| 63 | 63 |
| 64 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(config); |
| 64 view->GetScaledContentBitmap( | 65 view->GetScaledContentBitmap( |
| 65 scale, config, gfx::Rect(x, y, width, height), result_callback); | 66 scale, skbitmap_format, gfx::Rect(x, y, width, height), result_callback); |
| 66 return; | |
| 67 } | 67 } |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 static jlong Init(JNIEnv* env, jobject obj) { | 70 static jlong Init(JNIEnv* env, jobject obj) { |
| 71 ContentReadbackHandler* content_readback_handler = | 71 ContentReadbackHandler* content_readback_handler = |
| 72 new ContentReadbackHandler(env, obj); | 72 new ContentReadbackHandler(env, obj); |
| 73 return reinterpret_cast<intptr_t>(content_readback_handler); | 73 return reinterpret_cast<intptr_t>(content_readback_handler); |
| 74 } | 74 } |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| OLD | NEW |