Chromium Code Reviews| Index: cc/layers/nine_patch_layer_impl.cc |
| diff --git a/cc/layers/nine_patch_layer_impl.cc b/cc/layers/nine_patch_layer_impl.cc |
| index 933bf60775ae5c59e5bcda8ac80be5223b472eab..93c2f745a2e3ecd112a1018086b186540544679c 100644 |
| --- a/cc/layers/nine_patch_layer_impl.cc |
| +++ b/cc/layers/nine_patch_layer_impl.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/strings/stringprintf.h" |
| #include "base/values.h" |
| #include "cc/base/math_util.h" |
| +#include "cc/quads/solid_color_draw_quad.h" |
| #include "cc/quads/texture_draw_quad.h" |
| #include "cc/trees/layer_tree_impl.h" |
| #include "cc/trees/occlusion.h" |
| @@ -14,6 +15,9 @@ |
| namespace cc { |
| +// Maximum number of patches that can be produced for one NinePatchLayer. |
| +static const int kMaxPatches = 12; |
| + |
| NinePatchLayerImpl::NinePatchLayerImpl(LayerTreeImpl* tree_impl, int id) |
| : UIResourceLayerImpl(tree_impl, id), |
| fill_center_(false), |
| @@ -31,37 +35,39 @@ void NinePatchLayerImpl::PushPropertiesTo(LayerImpl* layer) { |
| NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer); |
| layer_impl->SetLayout(image_aperture_, border_, fill_center_, |
| - nearest_neighbor_); |
| + nearest_neighbor_, layer_occlusion_); |
| +} |
| + |
| +static gfx::Rect BoundsToRect(int x1, int y1, int x2, int y2) { |
| + return gfx::Rect(x1, y1, x2 - x1, y2 - y1); |
| } |
| -static gfx::RectF NormalizedRect(float x, |
| - float y, |
| - float width, |
| - float height, |
| +static gfx::RectF NormalizedRect(const gfx::Rect& rect, |
|
aelias_OOO_until_Jul13
2016/04/20 05:54:57
This argument change loses precision, use a gfx::R
llandwerlin-old
2016/04/21 09:53:14
I could be missing something, but I don't think we
|
| float total_width, |
| float total_height) { |
| - return gfx::RectF(x / total_width, |
| - y / total_height, |
| - width / total_width, |
| - height / total_height); |
| + return gfx::RectF(rect.x() / total_width, rect.y() / total_height, |
| + rect.width() / total_width, rect.height() / total_height); |
| } |
| void NinePatchLayerImpl::SetLayout(const gfx::Rect& aperture, |
| const gfx::Rect& border, |
| bool fill_center, |
| - bool nearest_neighbor) { |
| + bool nearest_neighbor, |
| + const gfx::Rect& layer_occlusion) { |
| // This check imposes an ordering on the call sequence. An UIResource must |
| // exist before SetLayout can be called. |
| DCHECK(ui_resource_id_); |
| if (image_aperture_ == aperture && border_ == border && |
| - fill_center_ == fill_center && nearest_neighbor_ == nearest_neighbor) |
| + fill_center_ == fill_center && nearest_neighbor_ == nearest_neighbor && |
| + layer_occlusion_ == layer_occlusion) |
| return; |
| image_aperture_ = aperture; |
| border_ = border; |
| fill_center_ = fill_center; |
| nearest_neighbor_ = nearest_neighbor; |
| + layer_occlusion_ = layer_occlusion; |
| NoteLayerPropertyChanged(); |
| } |
| @@ -84,6 +90,191 @@ void NinePatchLayerImpl::CheckGeometryLimitations() { |
| << " image_aperture_ " << image_aperture_.ToString(); |
| } |
| +void NinePatchLayerImpl::AppendQuadsWithoutOcclusion( |
|
aelias_OOO_until_Jul13
2016/04/20 05:54:57
These functions aren't actually appending the quad
llandwerlin-old
2016/04/21 09:53:14
Done.
|
| + RenderPass* render_pass, |
|
aelias_OOO_until_Jul13
2016/04/20 05:54:57
This doesn't use render_pass, resource or shared_q
llandwerlin-old
2016/04/21 09:53:14
Done.
|
| + ResourceId resource, |
| + SharedQuadState* shared_quad_state, |
| + std::vector<gfx::Rect>* image_rects, |
| + std::vector<gfx::Rect>* layer_rects) { |
| + // Utility values. |
| + float image_width = image_bounds_.width(); |
| + float image_height = image_bounds_.height(); |
| + int layer_width = bounds().width(); |
| + int layer_height = bounds().height(); |
| + gfx::Rect layer_aperture(border_.x(), border_.y(), |
| + layer_width - border_.width(), |
| + layer_height - border_.height()); |
| + |
| + // Top-left. |
| + image_rects->push_back( |
| + BoundsToRect(0, 0, image_aperture_.x(), image_aperture_.y())); |
| + layer_rects->push_back( |
| + BoundsToRect(0, 0, layer_aperture.x(), layer_aperture.y())); |
| + |
| + // Top-right. |
| + image_rects->push_back(BoundsToRect(image_aperture_.right(), 0, image_width, |
| + image_aperture_.y())); |
| + layer_rects->push_back( |
| + BoundsToRect(layer_aperture.right(), 0, layer_width, layer_aperture.y())); |
| + |
| + // Bottom-left. |
| + image_rects->push_back(BoundsToRect(0, image_aperture_.bottom(), |
| + image_aperture_.x(), image_height)); |
| + layer_rects->push_back(BoundsToRect(0, layer_aperture.bottom(), |
| + layer_aperture.x(), layer_height)); |
| + |
| + // Bottom-right. |
| + image_rects->push_back(BoundsToRect(image_aperture_.right(), |
| + image_aperture_.bottom(), image_width, |
| + image_height)); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.right(), |
| + layer_aperture.bottom(), layer_width, |
| + layer_height)); |
| + |
| + // Top. |
| + image_rects->push_back(BoundsToRect( |
| + image_aperture_.x(), 0, image_aperture_.right(), image_aperture_.y())); |
| + layer_rects->push_back(BoundsToRect( |
| + layer_aperture.x(), 0, layer_aperture.right(), layer_aperture.y())); |
| + |
| + // Left. |
| + image_rects->push_back(BoundsToRect( |
| + 0, image_aperture_.y(), image_aperture_.x(), image_aperture_.bottom())); |
| + layer_rects->push_back(BoundsToRect(0, layer_aperture.y(), layer_aperture.x(), |
| + layer_aperture.bottom())); |
| + |
| + // Right. |
| + image_rects->push_back(BoundsToRect(image_aperture_.right(), |
| + image_aperture_.y(), image_width, |
| + image_aperture_.bottom())); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.right(), |
| + layer_aperture.y(), layer_width, |
| + layer_aperture.bottom())); |
| + |
| + // Bottom. |
| + image_rects->push_back(BoundsToRect(image_aperture_.x(), |
| + image_aperture_.bottom(), |
| + image_aperture_.right(), image_height)); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.x(), |
| + layer_aperture.bottom(), |
| + layer_aperture.right(), layer_height)); |
| + |
| + // Center. |
| + if (fill_center_) { |
| + image_rects->push_back( |
| + BoundsToRect(image_aperture_.x(), image_aperture_.y(), |
| + image_aperture_.right(), image_aperture_.bottom())); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.x(), layer_aperture.y(), |
| + layer_aperture.right(), |
| + layer_aperture.bottom())); |
| + } |
| +} |
| + |
| +void NinePatchLayerImpl::AppendQuadsWithOcclusion( |
| + RenderPass* render_pass, |
| + ResourceId resource, |
| + SharedQuadState* shared_quad_state, |
| + std::vector<gfx::Rect>* image_rects, |
| + std::vector<gfx::Rect>* layer_rects) { |
| + // Helper values. |
| + float image_width = image_bounds_.width(); |
| + float image_height = image_bounds_.height(); |
| + int layer_width = bounds().width(); |
| + int layer_height = bounds().height(); |
| + gfx::Rect image_occlusion( |
| + BoundsToRect(layer_occlusion_.x(), layer_occlusion_.y(), |
| + image_width - (layer_width - layer_occlusion_.right()), |
| + image_height - (layer_height - layer_occlusion_.bottom()))); |
| + gfx::Rect layer_aperture( |
| + BoundsToRect(image_aperture_.x(), image_aperture_.y(), |
| + layer_width - (image_width - image_aperture_.right()), |
| + layer_height - (image_height - image_aperture_.bottom()))); |
| + |
| + // Top-left-left. |
| + image_rects->push_back( |
| + BoundsToRect(0, 0, image_occlusion.x(), image_aperture_.y())); |
| + layer_rects->push_back( |
| + BoundsToRect(0, 0, layer_occlusion_.x(), layer_aperture.y())); |
| + |
| + // Top-left-right. |
| + image_rects->push_back(BoundsToRect( |
| + image_occlusion.x(), 0, image_aperture_.x(), image_occlusion.y())); |
| + layer_rects->push_back(BoundsToRect( |
| + layer_occlusion_.x(), 0, layer_aperture.x(), layer_occlusion_.y())); |
| + |
| + // Top-center. |
| + image_rects->push_back(BoundsToRect( |
| + image_aperture_.x(), 0, image_aperture_.right(), image_occlusion.y())); |
| + layer_rects->push_back(BoundsToRect( |
| + layer_aperture.x(), 0, layer_aperture.right(), layer_occlusion_.y())); |
| + |
| + // Top-right-left. |
| + image_rects->push_back(BoundsToRect(image_aperture_.right(), 0, |
| + image_occlusion.right(), |
| + image_occlusion.y())); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.right(), 0, |
| + layer_occlusion_.right(), |
| + layer_occlusion_.y())); |
| + |
| + // Top-right-right. |
| + image_rects->push_back(BoundsToRect(image_occlusion.right(), 0, image_width, |
| + image_aperture_.y())); |
| + layer_rects->push_back(BoundsToRect(layer_occlusion_.right(), 0, layer_width, |
| + layer_aperture.y())); |
| + |
| + // Right-center. |
| + image_rects->push_back(BoundsToRect( |
| + 0, image_aperture_.y(), image_occlusion.x(), image_aperture_.bottom())); |
| + layer_rects->push_back(BoundsToRect( |
| + 0, layer_aperture.y(), layer_occlusion_.x(), layer_aperture.bottom())); |
| + |
| + // Left-center. |
| + image_rects->push_back(BoundsToRect(image_occlusion.right(), |
| + image_aperture_.y(), image_width, |
| + image_aperture_.bottom())); |
| + layer_rects->push_back(BoundsToRect(layer_occlusion_.right(), |
| + layer_aperture.y(), layer_width, |
| + layer_aperture.bottom())); |
| + |
| + // Bottom-left-left. |
| + image_rects->push_back(BoundsToRect(0, image_aperture_.bottom(), |
| + image_occlusion.x(), image_height)); |
| + layer_rects->push_back(BoundsToRect(0, layer_aperture.bottom(), |
| + layer_occlusion_.x(), layer_height)); |
| + |
| + // Bottom-left-right. |
| + image_rects->push_back(BoundsToRect(image_occlusion.x(), |
| + image_occlusion.bottom(), |
| + image_aperture_.x(), image_height)); |
| + layer_rects->push_back(BoundsToRect(layer_occlusion_.x(), |
| + layer_occlusion_.bottom(), |
| + layer_aperture.x(), layer_height)); |
| + |
| + // Bottom-center. |
| + image_rects->push_back(BoundsToRect(image_aperture_.x(), |
| + image_occlusion.bottom(), |
| + image_aperture_.right(), image_height)); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.x(), |
| + layer_occlusion_.bottom(), |
| + layer_aperture.right(), layer_height)); |
| + |
| + // Bottom-right-left. |
| + image_rects->push_back(BoundsToRect(image_aperture_.right(), |
| + image_occlusion.bottom(), |
| + image_occlusion.right(), image_height)); |
| + layer_rects->push_back(BoundsToRect(layer_aperture.right(), |
| + layer_occlusion_.bottom(), |
| + layer_occlusion_.right(), layer_height)); |
| + |
| + // Bottom-right-right. |
| + image_rects->push_back(BoundsToRect(image_occlusion.right(), |
| + image_aperture_.bottom(), image_width, |
| + image_height)); |
| + layer_rects->push_back(BoundsToRect(layer_occlusion_.right(), |
| + layer_aperture.bottom(), layer_width, |
| + layer_height)); |
| +} |
| + |
| void NinePatchLayerImpl::AppendQuads( |
| RenderPass* render_pass, |
| AppendQuadsData* append_quads_data) { |
| @@ -104,242 +295,46 @@ void NinePatchLayerImpl::AppendQuads( |
| if (!resource) |
| return; |
| - static const bool flipped = false; |
| - static const bool premultiplied_alpha = true; |
| - |
| DCHECK(!bounds().IsEmpty()); |
| - // NinePatch border widths in layer space. |
| - int layer_left_width = border_.x(); |
| - int layer_top_height = border_.y(); |
| - int layer_right_width = border_.width() - layer_left_width; |
| - int layer_bottom_height = border_.height() - layer_top_height; |
| - |
| - int layer_middle_width = bounds().width() - border_.width(); |
| - int layer_middle_height = bounds().height() - border_.height(); |
| - |
| - // Patch positions in layer space |
| - gfx::Rect layer_top_left(0, 0, layer_left_width, layer_top_height); |
| - gfx::Rect layer_top_right(bounds().width() - layer_right_width, |
| - 0, |
| - layer_right_width, |
| - layer_top_height); |
| - gfx::Rect layer_bottom_left(0, |
| - bounds().height() - layer_bottom_height, |
| - layer_left_width, |
| - layer_bottom_height); |
| - gfx::Rect layer_bottom_right(layer_top_right.x(), |
| - layer_bottom_left.y(), |
| - layer_right_width, |
| - layer_bottom_height); |
| - gfx::Rect layer_top( |
| - layer_top_left.right(), 0, layer_middle_width, layer_top_height); |
| - gfx::Rect layer_left( |
| - 0, layer_top_left.bottom(), layer_left_width, layer_middle_height); |
| - gfx::Rect layer_right(layer_top_right.x(), |
| - layer_top_right.bottom(), |
| - layer_right_width, |
| - layer_left.height()); |
| - gfx::Rect layer_bottom(layer_top.x(), |
| - layer_bottom_left.y(), |
| - layer_top.width(), |
| - layer_bottom_height); |
| - gfx::Rect layer_center(layer_left_width, |
| - layer_top_height, |
| - layer_middle_width, |
| - layer_middle_height); |
| - |
| - // Note the following values are in image (bitmap) space. |
| - float image_width = image_bounds_.width(); |
| - float image_height = image_bounds_.height(); |
| + // Patch positions in bitmap UV space (from zero to one). |
| + std::vector<gfx::Rect> image_rects; |
| + image_rects.reserve(kMaxPatches); |
| + // Patch positions in layer space. |
| + std::vector<gfx::Rect> layer_rects; |
| + layer_rects.reserve(kMaxPatches); |
| + |
| + if (!layer_occlusion_.IsEmpty() && border_.IsEmpty() && !fill_center_) |
| + AppendQuadsWithOcclusion(render_pass, resource, shared_quad_state, |
| + &image_rects, &layer_rects); |
| + else |
| + AppendQuadsWithoutOcclusion(render_pass, resource, shared_quad_state, |
| + &image_rects, &layer_rects); |
| - int image_aperture_left_width = image_aperture_.x(); |
| - int image_aperture_top_height = image_aperture_.y(); |
| - int image_aperture_right_width = image_width - image_aperture_.right(); |
| - int image_aperture_bottom_height = image_height - image_aperture_.bottom(); |
| - // Patch positions in bitmap UV space (from zero to one) |
| - gfx::RectF uv_top_left = NormalizedRect(0, |
| - 0, |
| - image_aperture_left_width, |
| - image_aperture_top_height, |
| - image_width, |
| - image_height); |
| - gfx::RectF uv_top_right = |
| - NormalizedRect(image_width - image_aperture_right_width, |
| - 0, |
| - image_aperture_right_width, |
| - image_aperture_top_height, |
| - image_width, |
| - image_height); |
| - gfx::RectF uv_bottom_left = |
| - NormalizedRect(0, |
| - image_height - image_aperture_bottom_height, |
| - image_aperture_left_width, |
| - image_aperture_bottom_height, |
| - image_width, |
| - image_height); |
| - gfx::RectF uv_bottom_right = |
| - NormalizedRect(image_width - image_aperture_right_width, |
| - image_height - image_aperture_bottom_height, |
| - image_aperture_right_width, |
| - image_aperture_bottom_height, |
| - image_width, |
| - image_height); |
| - gfx::RectF uv_top( |
| - uv_top_left.right(), |
| - 0, |
| - (image_width - image_aperture_left_width - image_aperture_right_width) / |
| - image_width, |
| - (image_aperture_top_height) / image_height); |
| - gfx::RectF uv_left(0, |
| - uv_top_left.bottom(), |
| - image_aperture_left_width / image_width, |
| - (image_height - image_aperture_top_height - |
| - image_aperture_bottom_height) / |
| - image_height); |
| - gfx::RectF uv_right(uv_top_right.x(), |
| - uv_top_right.bottom(), |
| - image_aperture_right_width / image_width, |
| - uv_left.height()); |
| - gfx::RectF uv_bottom(uv_top.x(), |
| - uv_bottom_left.y(), |
| - uv_top.width(), |
| - image_aperture_bottom_height / image_height); |
| - gfx::RectF uv_center(uv_top_left.right(), |
| - uv_top_left.bottom(), |
| - uv_top.width(), |
| - uv_left.height()); |
| + DCHECK_EQ(image_rects.size(), layer_rects.size()); |
| gfx::Rect opaque_rect; |
| gfx::Rect visible_rect; |
| const float vertex_opacity[] = {1.0f, 1.0f, 1.0f, 1.0f}; |
| const bool opaque = layer_tree_impl()->IsUIResourceOpaque(ui_resource_id_); |
| + static const bool flipped = false; |
| + static const bool premultiplied_alpha = true; |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_top_left); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_top_left, opaque_rect, visible_rect, |
| - resource, premultiplied_alpha, uv_top_left.origin(), |
| - uv_top_left.bottom_right(), SK_ColorTRANSPARENT, |
| - vertex_opacity, flipped, nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_top_right); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_top_right, opaque_rect, visible_rect, |
| - resource, premultiplied_alpha, uv_top_right.origin(), |
| - uv_top_right.bottom_right(), SK_ColorTRANSPARENT, |
| - vertex_opacity, flipped, nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_bottom_left); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_bottom_left, opaque_rect, |
| - visible_rect, resource, premultiplied_alpha, |
| - uv_bottom_left.origin(), uv_bottom_left.bottom_right(), |
| - SK_ColorTRANSPARENT, vertex_opacity, flipped, |
| - nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_bottom_right); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_bottom_right, opaque_rect, |
| - visible_rect, resource, premultiplied_alpha, |
| - uv_bottom_right.origin(), uv_bottom_right.bottom_right(), |
| - SK_ColorTRANSPARENT, vertex_opacity, flipped, |
| - nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_top); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_top, opaque_rect, visible_rect, |
| - resource, premultiplied_alpha, uv_top.origin(), |
| - uv_top.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| - flipped, nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_left); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_left, opaque_rect, visible_rect, |
| - resource, premultiplied_alpha, uv_left.origin(), |
| - uv_left.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| - flipped, nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_right); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_right, opaque_rect, layer_right, |
| - resource, premultiplied_alpha, uv_right.origin(), |
| - uv_right.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| - flipped, nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| - |
| - visible_rect = |
| - draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_bottom); |
| - opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| - if (!visible_rect.IsEmpty()) { |
| - TextureDrawQuad* quad = |
| - render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_bottom, opaque_rect, visible_rect, |
| - resource, premultiplied_alpha, uv_bottom.origin(), |
| - uv_bottom.bottom_right(), SK_ColorTRANSPARENT, vertex_opacity, |
| - flipped, nearest_neighbor_); |
| - ValidateQuadResources(quad); |
| - } |
| + for (size_t i = 0; i < image_rects.size(); i++) { |
| + const gfx::Rect& layer_rect(layer_rects[i]); |
| - if (fill_center_) { |
| visible_rect = |
| draw_properties().occlusion_in_content_space.GetUnoccludedContentRect( |
| - layer_center); |
| + layer_rect); |
| opaque_rect = opaque ? visible_rect : gfx::Rect(); |
| if (!visible_rect.IsEmpty()) { |
| + gfx::RectF image_rect(NormalizedRect( |
| + image_rects[i], image_bounds_.width(), image_bounds_.height())); |
| TextureDrawQuad* quad = |
| render_pass->CreateAndAppendDrawQuad<TextureDrawQuad>(); |
| - quad->SetNew(shared_quad_state, layer_center, opaque_rect, visible_rect, |
| - resource, premultiplied_alpha, uv_center.origin(), |
| - uv_center.bottom_right(), SK_ColorTRANSPARENT, |
| + quad->SetNew(shared_quad_state, layer_rect, opaque_rect, visible_rect, |
| + resource, premultiplied_alpha, image_rect.origin(), |
| + image_rect.bottom_right(), SK_ColorTRANSPARENT, |
| vertex_opacity, flipped, nearest_neighbor_); |
| ValidateQuadResources(quad); |
| } |
| @@ -369,6 +364,13 @@ base::DictionaryValue* NinePatchLayerImpl::LayerTreeAsJson() const { |
| result->SetBoolean("FillCenter", fill_center_); |
| + list = new base::ListValue; |
| + list->AppendInteger(layer_occlusion_.x()); |
| + list->AppendInteger(layer_occlusion_.y()); |
| + list->AppendInteger(layer_occlusion_.width()); |
| + list->AppendInteger(layer_occlusion_.height()); |
| + result->Set("LayerOcclusion", list); |
| + |
| return result; |
| } |