| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "cc/layers/nine_patch_layer.h" | 5 #include "cc/layers/nine_patch_layer.h" |
| 6 | 6 |
| 7 #include "cc/layers/nine_patch_layer_impl.h" | 7 #include "cc/layers/nine_patch_layer_impl.h" |
| 8 #include "cc/resources/prioritized_resource.h" | 8 #include "cc/resources/prioritized_resource.h" |
| 9 #include "cc/resources/resource_update.h" | 9 #include "cc/resources/resource_update.h" |
| 10 #include "cc/resources/resource_update_queue.h" | 10 #include "cc/resources/resource_update_queue.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 void NinePatchLayer::SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture) { | 50 void NinePatchLayer::SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture) { |
| 51 bitmap_ = bitmap; | 51 bitmap_ = bitmap; |
| 52 image_aperture_ = aperture; | 52 image_aperture_ = aperture; |
| 53 bitmap_dirty_ = true; | 53 bitmap_dirty_ = true; |
| 54 SetNeedsDisplay(); | 54 SetNeedsDisplay(); |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool NinePatchLayer::Update(ResourceUpdateQueue* queue, | 57 bool NinePatchLayer::Update(ResourceUpdateQueue* queue, |
| 58 const OcclusionTracker* occlusion) { | 58 const OcclusionTracker* occlusion) { |
| 59 CreateUpdaterIfNeeded(); | 59 CreateUpdaterIfNeeded(); |
| 60 Layer::Update(queue, occlusion); |
| 60 | 61 |
| 61 if (resource_ && | 62 if (resource_ && |
| 62 (bitmap_dirty_ || resource_->texture()->resource_id() == 0)) { | 63 (bitmap_dirty_ || resource_->texture()->resource_id() == 0)) { |
| 63 gfx::Rect content_rect(0, 0, bitmap_.width(), bitmap_.height()); | 64 gfx::Rect content_rect(0, 0, bitmap_.width(), bitmap_.height()); |
| 64 ResourceUpdate upload = ResourceUpdate::Create(resource_->texture(), | 65 ResourceUpdate upload = ResourceUpdate::Create(resource_->texture(), |
| 65 &bitmap_, | 66 &bitmap_, |
| 66 content_rect, | 67 content_rect, |
| 67 content_rect, | 68 content_rect, |
| 68 gfx::Vector2d()); | 69 gfx::Vector2d()); |
| 69 queue->AppendFullUpload(upload); | 70 queue->AppendFullUpload(upload); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 106 |
| 106 if (resource_) { | 107 if (resource_) { |
| 107 DCHECK(!bitmap_.isNull()); | 108 DCHECK(!bitmap_.isNull()); |
| 108 layer_impl->SetResourceId(resource_->texture()->resource_id()); | 109 layer_impl->SetResourceId(resource_->texture()->resource_id()); |
| 109 layer_impl->SetLayout( | 110 layer_impl->SetLayout( |
| 110 gfx::Size(bitmap_.width(), bitmap_.height()), image_aperture_); | 111 gfx::Size(bitmap_.width(), bitmap_.height()), image_aperture_); |
| 111 } | 112 } |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace cc | 115 } // namespace cc |
| OLD | NEW |