| 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/strings/stringprintf.h" | 7 #include "base/strings/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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode, | 58 bool NinePatchLayerImpl::WillDraw(DrawMode draw_mode, |
| 59 ResourceProvider* resource_provider) { | 59 ResourceProvider* resource_provider) { |
| 60 if (!resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) | 60 if (!resource_id_ || draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) |
| 61 return false; | 61 return false; |
| 62 return LayerImpl::WillDraw(draw_mode, resource_provider); | 62 return LayerImpl::WillDraw(draw_mode, resource_provider); |
| 63 } | 63 } |
| 64 | 64 |
| 65 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, | 65 void NinePatchLayerImpl::AppendQuads(QuadSink* quad_sink, |
| 66 AppendQuadsData* append_quads_data) { | 66 AppendQuadsData* append_quads_data) { |
| 67 DCHECK(resource_id_); | |
| 68 | |
| 69 SharedQuadState* shared_quad_state = | 67 SharedQuadState* shared_quad_state = |
| 70 quad_sink->UseSharedQuadState(CreateSharedQuadState()); | 68 quad_sink->UseSharedQuadState(CreateSharedQuadState()); |
| 71 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); | 69 AppendDebugBorderQuad(quad_sink, shared_quad_state, append_quads_data); |
| 72 | 70 |
| 71 if (!resource_id_) |
| 72 return; |
| 73 |
| 73 static const bool flipped = false; | 74 static const bool flipped = false; |
| 74 static const bool premultiplied_alpha = true; | 75 static const bool premultiplied_alpha = true; |
| 75 | 76 |
| 76 DCHECK(!bounds().IsEmpty()); | 77 DCHECK(!bounds().IsEmpty()); |
| 77 | 78 |
| 78 // NinePatch border widths in bitmap pixel space | 79 // NinePatch border widths in bitmap pixel space |
| 79 int left_width = image_aperture_.x(); | 80 int left_width = image_aperture_.x(); |
| 80 int top_height = image_aperture_.y(); | 81 int top_height = image_aperture_.y(); |
| 81 int right_width = image_bounds_.width() - image_aperture_.right(); | 82 int right_width = image_bounds_.width() - image_aperture_.right(); |
| 82 int bottom_height = image_bounds_.height() - image_aperture_.bottom(); | 83 int bottom_height = image_bounds_.height() - image_aperture_.bottom(); |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 297 |
| 297 list = new base::ListValue; | 298 list = new base::ListValue; |
| 298 list->AppendInteger(image_bounds_.width()); | 299 list->AppendInteger(image_bounds_.width()); |
| 299 list->AppendInteger(image_bounds_.height()); | 300 list->AppendInteger(image_bounds_.height()); |
| 300 result->Set("ImageBounds", list); | 301 result->Set("ImageBounds", list); |
| 301 | 302 |
| 302 return result; | 303 return result; |
| 303 } | 304 } |
| 304 | 305 |
| 305 } // namespace cc | 306 } // namespace cc |
| OLD | NEW |