| 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 "cc/output/copy_output_request.h" | 9 #include "cc/output/copy_output_request.h" |
| 10 #include "cc/output/copy_output_result.h" | 10 #include "cc/output/copy_output_result.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } | 47 } |
| 48 | 48 |
| 49 void ContentReadbackHandler::Destroy(JNIEnv* env, jobject obj) { | 49 void ContentReadbackHandler::Destroy(JNIEnv* env, jobject obj) { |
| 50 delete this; | 50 delete this; |
| 51 } | 51 } |
| 52 | 52 |
| 53 void ContentReadbackHandler::GetContentBitmap(JNIEnv* env, | 53 void ContentReadbackHandler::GetContentBitmap(JNIEnv* env, |
| 54 jobject obj, | 54 jobject obj, |
| 55 jint readback_id, | 55 jint readback_id, |
| 56 jfloat scale, | 56 jfloat scale, |
| 57 jobject config, | 57 jobject color_type, |
| 58 jfloat x, | 58 jfloat x, |
| 59 jfloat y, | 59 jfloat y, |
| 60 jfloat width, | 60 jfloat width, |
| 61 jfloat height, | 61 jfloat height, |
| 62 jobject content_view_core) { | 62 jobject content_view_core) { |
| 63 ContentViewCore* view = | 63 ContentViewCore* view = |
| 64 ContentViewCore::GetNativeContentViewCore(env, content_view_core); | 64 ContentViewCore::GetNativeContentViewCore(env, content_view_core); |
| 65 DCHECK(view); | 65 DCHECK(view); |
| 66 | 66 |
| 67 ResultCallback result_callback = | 67 ResultCallback result_callback = |
| 68 base::Bind(&ContentReadbackHandler::OnFinishReadback, | 68 base::Bind(&ContentReadbackHandler::OnFinishReadback, |
| 69 weak_factory_.GetWeakPtr(), | 69 weak_factory_.GetWeakPtr(), |
| 70 readback_id); | 70 readback_id); |
| 71 | 71 |
| 72 view->GetScaledContentBitmap( | 72 view->GetScaledContentBitmap( |
| 73 scale, config, gfx::Rect(x, y, width, height), result_callback); | 73 scale, color_type, gfx::Rect(x, y, width, height), result_callback); |
| 74 } | 74 } |
| 75 | 75 |
| 76 void ContentReadbackHandler::GetCompositorBitmap(JNIEnv* env, | 76 void ContentReadbackHandler::GetCompositorBitmap(JNIEnv* env, |
| 77 jobject obj, | 77 jobject obj, |
| 78 jint readback_id, | 78 jint readback_id, |
| 79 jlong native_window_android) { | 79 jlong native_window_android) { |
| 80 ui::WindowAndroid* window_android = | 80 ui::WindowAndroid* window_android = |
| 81 reinterpret_cast<ui::WindowAndroid*>(native_window_android); | 81 reinterpret_cast<ui::WindowAndroid*>(native_window_android); |
| 82 DCHECK(window_android); | 82 DCHECK(window_android); |
| 83 | 83 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 // static | 118 // static |
| 119 static jlong Init(JNIEnv* env, jobject obj) { | 119 static jlong Init(JNIEnv* env, jobject obj) { |
| 120 ContentReadbackHandler* content_readback_handler = | 120 ContentReadbackHandler* content_readback_handler = |
| 121 new ContentReadbackHandler(env, obj); | 121 new ContentReadbackHandler(env, obj); |
| 122 return reinterpret_cast<intptr_t>(content_readback_handler); | 122 return reinterpret_cast<intptr_t>(content_readback_handler); |
| 123 } | 123 } |
| 124 | 124 |
| 125 } // namespace content | 125 } // namespace content |
| OLD | NEW |