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_impl.h" | 5 #include "cc/layers/nine_patch_layer_impl.h" |
6 | 6 |
7 #include "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "cc/layers/quad_sink.h" | 9 #include "cc/layers/quad_sink.h" |
10 #include "cc/quads/texture_draw_quad.h" | 10 #include "cc/quads/texture_draw_quad.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 y / total_height, | 48 y / total_height, |
49 width / total_width, | 49 width / total_width, |
50 height / total_height); | 50 height / total_height); |
51 } | 51 } |
52 | 52 |
53 void NinePatchLayerImpl::SetLayout(gfx::Size image_bounds, gfx::Rect aperture) { | 53 void NinePatchLayerImpl::SetLayout(gfx::Size image_bounds, gfx::Rect aperture) { |
54 image_bounds_ = image_bounds; | 54 image_bounds_ = image_bounds; |
55 image_aperture_ = aperture; | 55 image_aperture_ = aperture; |
56 } | 56 } |
57 | 57 |
| 58 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode, |
| 59 ResourceProvider* resource_provider) { |
| 60 if (!resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) |
| 61 return false; |
| 62 return LayerImpl::WillDraw(draw_mode, resource_provider); |
| 63 } |
| 64 |
58 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, | 65 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, |
59 AppendQuadsData* append_quads_data) { | 66 AppendQuadsData* append_quads_data) { |
60 if (!resource_id_) | 67 DCHECK(resource_id_); |
61 return; | |
62 | 68 |
63 SharedQuadState* shared_quad_state = | 69 SharedQuadState* shared_quad_state = |
64 quad_sink->UseSharedQuadState(CreateSharedQuadState()); | 70 quad_sink->UseSharedQuadState(CreateSharedQuadState()); |
65 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); | 71 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); |
66 | 72 |
67 static const bool flipped = false; | 73 static const bool flipped = false; |
68 static const bool premultiplied_alpha = true; | 74 static const bool premultiplied_alpha = true; |
69 | 75 |
70 DCHECK(!bounds().IsEmpty()); | 76 DCHECK(!bounds().IsEmpty()); |
71 | 77 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 296 |
291 list = new base::ListValue; | 297 list = new base::ListValue; |
292 list->AppendInteger(image_bounds_.width()); | 298 list->AppendInteger(image_bounds_.width()); |
293 list->AppendInteger(image_bounds_.height()); | 299 list->AppendInteger(image_bounds_.height()); |
294 result->Set("ImageBounds", list); | 300 result->Set("ImageBounds", list); |
295 | 301 |
296 return result; | 302 return result; |
297 } | 303 } |
298 | 304 |
299 } // namespace cc | 305 } // namespace cc |
OLD | NEW |