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 22 matching lines...) Expand all Loading... |
33 resource_.reset(); | 33 resource_.reset(); |
34 if (!bitmap_.isNull()) | 34 if (!bitmap_.isNull()) |
35 CreateResource(); | 35 CreateResource(); |
36 } else if (bitmap_dirty_ && DrawsContent()) { | 36 } else if (bitmap_dirty_ && DrawsContent()) { |
37 CreateResource(); | 37 CreateResource(); |
38 } | 38 } |
39 | 39 |
40 if (resource_) { | 40 if (resource_) { |
41 resource_->texture()->set_request_priority( | 41 resource_->texture()->set_request_priority( |
42 PriorityCalculator::UIPriority(true)); | 42 PriorityCalculator::UIPriority(true)); |
43 GLenum texture_format = | |
44 layer_tree_host()->GetRendererCapabilities().best_texture_format; | |
45 resource_->texture()->SetDimensions( | 43 resource_->texture()->SetDimensions( |
46 gfx::Size(bitmap_.width(), bitmap_.height()), texture_format); | 44 gfx::Size(bitmap_.width(), bitmap_.height()), |
| 45 layer_tree_host()->GetRendererCapabilities().best_texture_format); |
47 } | 46 } |
48 } | 47 } |
49 | 48 |
50 void NinePatchLayer::SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture) { | 49 void NinePatchLayer::SetBitmap(const SkBitmap& bitmap, gfx::Rect aperture) { |
51 bitmap_ = bitmap; | 50 bitmap_ = bitmap; |
52 image_aperture_ = aperture; | 51 image_aperture_ = aperture; |
53 bitmap_dirty_ = true; | 52 bitmap_dirty_ = true; |
54 SetNeedsDisplay(); | 53 SetNeedsDisplay(); |
55 } | 54 } |
56 | 55 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 gfx::Size(bitmap_.width(), bitmap_.height()), image_aperture_); | 112 gfx::Size(bitmap_.width(), bitmap_.height()), image_aperture_); |
114 } | 113 } |
115 | 114 |
116 // NinePatchLayer must push properties every commit to make sure | 115 // NinePatchLayer must push properties every commit to make sure |
117 // NinePatchLayerImpl::resource_id_ is valid. | 116 // NinePatchLayerImpl::resource_id_ is valid. |
118 // http://crbug.com/276482 | 117 // http://crbug.com/276482 |
119 needs_push_properties_ = true; | 118 needs_push_properties_ = true; |
120 } | 119 } |
121 | 120 |
122 } // namespace cc | 121 } // namespace cc |
OLD | NEW |