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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(config); |
72 view->GetScaledContentBitmap( | 73 view->GetScaledContentBitmap( |
73 scale, config, gfx::Rect(x, y, width, height), result_callback); | 74 scale, skbitmap_format, gfx::Rect(x, y, width, height), result_callback); |
74 } | 75 } |
75 | 76 |
76 void ContentReadbackHandler::GetCompositorBitmap(JNIEnv* env, | 77 void ContentReadbackHandler::GetCompositorBitmap(JNIEnv* env, |
77 jobject obj, | 78 jobject obj, |
78 jint readback_id, | 79 jint readback_id, |
79 jlong native_window_android) { | 80 jlong native_window_android) { |
80 ui::WindowAndroid* window_android = | 81 ui::WindowAndroid* window_android = |
81 reinterpret_cast<ui::WindowAndroid*>(native_window_android); | 82 reinterpret_cast<ui::WindowAndroid*>(native_window_android); |
82 DCHECK(window_android); | 83 DCHECK(window_android); |
83 | 84 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 } | 117 } |
117 | 118 |
118 // static | 119 // static |
119 static jlong Init(JNIEnv* env, jobject obj) { | 120 static jlong Init(JNIEnv* env, jobject obj) { |
120 ContentReadbackHandler* content_readback_handler = | 121 ContentReadbackHandler* content_readback_handler = |
121 new ContentReadbackHandler(env, obj); | 122 new ContentReadbackHandler(env, obj); |
122 return reinterpret_cast<intptr_t>(content_readback_handler); | 123 return reinterpret_cast<intptr_t>(content_readback_handler); |
123 } | 124 } |
124 | 125 |
125 } // namespace content | 126 } // namespace content |
OLD | NEW |