| 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 "ui/android/resources/resource_manager_impl.h" | 5 #include "ui/android/resources/resource_manager_impl.h" |
| 6 | 6 |
| 7 #include <inttypes.h> | 7 #include <inttypes.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 resource->aperture.SetRect(aperture_left, aperture_top, | 213 resource->aperture.SetRect(aperture_left, aperture_top, |
| 214 aperture_right - aperture_left, | 214 aperture_right - aperture_left, |
| 215 aperture_bottom - aperture_top); | 215 aperture_bottom - aperture_top); |
| 216 | 216 |
| 217 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(jbitmap); | 217 SkBitmap skbitmap = gfx::CreateSkBitmapFromJavaBitmap(jbitmap); |
| 218 skbitmap.setImmutable(); | 218 skbitmap.setImmutable(); |
| 219 resource->ui_resource = cc::ScopedUIResource::Create( | 219 resource->ui_resource = cc::ScopedUIResource::Create( |
| 220 ui_resource_manager_, cc::UIResourceBitmap(skbitmap)); | 220 ui_resource_manager_, cc::UIResourceBitmap(skbitmap)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void ResourceManagerImpl::RemoveResource( |
| 224 JNIEnv* env, |
| 225 const base::android::JavaRef<jobject>& jobj, |
| 226 jint res_type, |
| 227 jint res_id) { |
| 228 resources_[res_type].erase(res_id); |
| 229 } |
| 230 |
| 223 CrushedSpriteResource* ResourceManagerImpl::GetCrushedSpriteResource( | 231 CrushedSpriteResource* ResourceManagerImpl::GetCrushedSpriteResource( |
| 224 int bitmap_res_id, int metadata_res_id) { | 232 int bitmap_res_id, int metadata_res_id) { |
| 225 | 233 |
| 226 CrushedSpriteResource* resource = nullptr; | 234 CrushedSpriteResource* resource = nullptr; |
| 227 if (crushed_sprite_resources_.find(bitmap_res_id) | 235 if (crushed_sprite_resources_.find(bitmap_res_id) |
| 228 != crushed_sprite_resources_.end()) { | 236 != crushed_sprite_resources_.end()) { |
| 229 resource = crushed_sprite_resources_[bitmap_res_id].get(); | 237 resource = crushed_sprite_resources_[bitmap_res_id].get(); |
| 230 } | 238 } |
| 231 | 239 |
| 232 if (!resource) { | 240 if (!resource) { |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 368 TRACE_EVENT2("ui", | 376 TRACE_EVENT2("ui", |
| 369 "ResourceManagerImpl::RequestCrushedSpriteResourceFromJava", | 377 "ResourceManagerImpl::RequestCrushedSpriteResourceFromJava", |
| 370 "bitmap_res_id", bitmap_res_id, | 378 "bitmap_res_id", bitmap_res_id, |
| 371 "metadata_res_id", metadata_res_id); | 379 "metadata_res_id", metadata_res_id); |
| 372 Java_ResourceManager_crushedSpriteResourceRequested( | 380 Java_ResourceManager_crushedSpriteResourceRequested( |
| 373 base::android::AttachCurrentThread(), java_obj_, bitmap_res_id, | 381 base::android::AttachCurrentThread(), java_obj_, bitmap_res_id, |
| 374 metadata_res_id, reloading); | 382 metadata_res_id, reloading); |
| 375 } | 383 } |
| 376 | 384 |
| 377 } // namespace ui | 385 } // namespace ui |
| OLD | NEW |