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