| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/exo/wayland/server.h" | 5 #include "components/exo/wayland/server.h" |
| 6 | 6 |
| 7 #include <grp.h> | 7 #include <grp.h> |
| 8 #include <linux/input.h> | 8 #include <linux/input.h> |
| 9 #include <stddef.h> | 9 #include <stddef.h> |
| 10 #include <stdint.h> | 10 #include <stdint.h> |
| (...skipping 2679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2690 // from being created for the same Surface. | 2690 // from being created for the same Surface. |
| 2691 class Blending : public SurfaceObserver { | 2691 class Blending : public SurfaceObserver { |
| 2692 public: | 2692 public: |
| 2693 explicit Blending(Surface* surface) : surface_(surface) { | 2693 explicit Blending(Surface* surface) : surface_(surface) { |
| 2694 surface_->AddSurfaceObserver(this); | 2694 surface_->AddSurfaceObserver(this); |
| 2695 surface_->SetProperty(kSurfaceHasBlendingKey, true); | 2695 surface_->SetProperty(kSurfaceHasBlendingKey, true); |
| 2696 } | 2696 } |
| 2697 ~Blending() override { | 2697 ~Blending() override { |
| 2698 if (surface_) { | 2698 if (surface_) { |
| 2699 surface_->RemoveSurfaceObserver(this); | 2699 surface_->RemoveSurfaceObserver(this); |
| 2700 surface_->SetBlendMode(SkXfermode::kSrcOver_Mode); | 2700 surface_->SetBlendMode(SkBlendMode::kSrcOver); |
| 2701 surface_->SetAlpha(1.0f); | 2701 surface_->SetAlpha(1.0f); |
| 2702 surface_->SetProperty(kSurfaceHasBlendingKey, false); | 2702 surface_->SetProperty(kSurfaceHasBlendingKey, false); |
| 2703 } | 2703 } |
| 2704 } | 2704 } |
| 2705 | 2705 |
| 2706 void SetBlendMode(SkXfermode::Mode blend_mode) { | 2706 void SetBlendMode(SkBlendMode blend_mode) { |
| 2707 if (surface_) | 2707 if (surface_) |
| 2708 surface_->SetBlendMode(blend_mode); | 2708 surface_->SetBlendMode(blend_mode); |
| 2709 } | 2709 } |
| 2710 | 2710 |
| 2711 void SetAlpha(float value) { | 2711 void SetAlpha(float value) { |
| 2712 if (surface_) | 2712 if (surface_) |
| 2713 surface_->SetAlpha(value); | 2713 surface_->SetAlpha(value); |
| 2714 } | 2714 } |
| 2715 | 2715 |
| 2716 // Overridden from SurfaceObserver: | 2716 // Overridden from SurfaceObserver: |
| (...skipping 10 matching lines...) Expand all Loading... |
| 2727 | 2727 |
| 2728 void blending_destroy(wl_client* client, wl_resource* resource) { | 2728 void blending_destroy(wl_client* client, wl_resource* resource) { |
| 2729 wl_resource_destroy(resource); | 2729 wl_resource_destroy(resource); |
| 2730 } | 2730 } |
| 2731 | 2731 |
| 2732 void blending_set_blending(wl_client* client, | 2732 void blending_set_blending(wl_client* client, |
| 2733 wl_resource* resource, | 2733 wl_resource* resource, |
| 2734 uint32_t equation) { | 2734 uint32_t equation) { |
| 2735 switch (equation) { | 2735 switch (equation) { |
| 2736 case ZCR_BLENDING_V1_BLENDING_EQUATION_NONE: | 2736 case ZCR_BLENDING_V1_BLENDING_EQUATION_NONE: |
| 2737 GetUserDataAs<Blending>(resource)->SetBlendMode(SkXfermode::kSrc_Mode); | 2737 GetUserDataAs<Blending>(resource)->SetBlendMode(SkBlendMode::kSrc); |
| 2738 break; | 2738 break; |
| 2739 case ZCR_BLENDING_V1_BLENDING_EQUATION_PREMULT: | 2739 case ZCR_BLENDING_V1_BLENDING_EQUATION_PREMULT: |
| 2740 GetUserDataAs<Blending>(resource)->SetBlendMode( | 2740 GetUserDataAs<Blending>(resource)->SetBlendMode(SkBlendMode::kSrcOver); |
| 2741 SkXfermode::kSrcOver_Mode); | |
| 2742 break; | 2741 break; |
| 2743 case ZCR_BLENDING_V1_BLENDING_EQUATION_COVERAGE: | 2742 case ZCR_BLENDING_V1_BLENDING_EQUATION_COVERAGE: |
| 2744 NOTIMPLEMENTED(); | 2743 NOTIMPLEMENTED(); |
| 2745 break; | 2744 break; |
| 2746 default: | 2745 default: |
| 2747 DLOG(WARNING) << "Unsupported blending equation: " << equation; | 2746 DLOG(WARNING) << "Unsupported blending equation: " << equation; |
| 2748 break; | 2747 break; |
| 2749 } | 2748 } |
| 2750 } | 2749 } |
| 2751 | 2750 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3072 DCHECK(event_loop); | 3071 DCHECK(event_loop); |
| 3073 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); | 3072 wl_event_loop_dispatch(event_loop, timeout.InMilliseconds()); |
| 3074 } | 3073 } |
| 3075 | 3074 |
| 3076 void Server::Flush() { | 3075 void Server::Flush() { |
| 3077 wl_display_flush_clients(wl_display_.get()); | 3076 wl_display_flush_clients(wl_display_.get()); |
| 3078 } | 3077 } |
| 3079 | 3078 |
| 3080 } // namespace wayland | 3079 } // namespace wayland |
| 3081 } // namespace exo | 3080 } // namespace exo |
| OLD | NEW |