Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/ui/views/frame/browser_header_painter_ash.h" | 5 #include "chrome/browser/ui/views/frame/browser_header_painter_ash.h" |
| 6 | 6 |
| 7 #include "ash/common/ash_layout_constants.h" | 7 #include "ash/common/ash_layout_constants.h" |
| 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h " | 8 #include "ash/common/frame/caption_buttons/frame_caption_button_container_view.h " |
| 9 #include "ash/common/frame/header_painter_util.h" | 9 #include "ash/common/frame/header_painter_util.h" |
| 10 #include "ash/resources/vector_icons/vector_icons.h" | 10 #include "ash/resources/vector_icons/vector_icons.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 gfx::ScopedCanvas scoped_save(canvas); | 72 gfx::ScopedCanvas scoped_save(canvas); |
| 73 canvas->ClipPath(frame_path, antialias); | 73 canvas->ClipPath(frame_path, antialias); |
| 74 | 74 |
| 75 cc::PaintFlags flags; | 75 cc::PaintFlags flags; |
| 76 flags.setBlendMode(SkBlendMode::kPlus); | 76 flags.setBlendMode(SkBlendMode::kPlus); |
| 77 flags.setAntiAlias(antialias); | 77 flags.setAntiAlias(antialias); |
| 78 | 78 |
| 79 if (frame_image.isNull() && frame_overlay_image.isNull()) { | 79 if (frame_image.isNull() && frame_overlay_image.isNull()) { |
| 80 flags.setColor(background_color); | 80 flags.setColor(background_color); |
| 81 canvas->DrawRect(bounds, flags); | 81 canvas->DrawRect(bounds, flags); |
| 82 } else if (frame_overlay_image.isNull()) { | |
| 83 flags.setAlpha(alpha); | |
| 84 canvas->DrawImageInt(frame_image, -image_inset_x, 0, flags); | |
| 85 } else { | 82 } else { |
| 86 flags.setAlpha(alpha); | 83 flags.setAlpha(alpha); |
| 87 canvas->SaveLayerWithFlags(flags); | 84 canvas->SaveLayerWithFlags(flags); |
|
danakj
2017/03/24 14:59:54
SaveLayer isn't free, we should keep the middle br
Qiang(Joe) Xu
2017/03/24 16:22:05
Done.
| |
| 88 | 85 |
| 89 if (frame_image.isNull()) { | 86 if (frame_image.isNull()) { |
| 90 canvas->DrawColor(background_color); | 87 canvas->DrawColor(background_color); |
| 91 } else { | 88 } else { |
| 92 canvas->TileImageInt(frame_image, image_inset_x, 0, 0, 0, bounds.width(), | 89 canvas->TileImageInt(frame_image, image_inset_x, 0, 0, 0, bounds.width(), |
| 93 bounds.height()); | 90 bounds.height()); |
| 94 } | 91 } |
| 95 canvas->DrawImageInt(frame_overlay_image, 0, 0); | 92 canvas->DrawImageInt(frame_overlay_image, 0, 0); |
| 96 | 93 |
| 97 canvas->Restore(); | 94 canvas->Restore(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 298 } | 295 } |
| 299 | 296 |
| 300 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { | 297 gfx::Rect BrowserHeaderPainterAsh::GetPaintedBounds() const { |
| 301 return gfx::Rect(view_->width(), painted_height_); | 298 return gfx::Rect(view_->width(), painted_height_); |
| 302 } | 299 } |
| 303 | 300 |
| 304 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { | 301 gfx::Rect BrowserHeaderPainterAsh::GetTitleBounds() const { |
| 305 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, | 302 return ash::HeaderPainterUtil::GetTitleBounds(window_icon_, |
| 306 caption_button_container_, BrowserFrame::GetTitleFontList()); | 303 caption_button_container_, BrowserFrame::GetTitleFontList()); |
| 307 } | 304 } |
| OLD | NEW |